build 1.87 KB
Newer Older
boklm's avatar
boklm committed
1
2
3
4
5
6
7
8
9
#!/bin/bash
[% c("var/set_default_env") -%]
[% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
[% IF c("var/linux") %]
  tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
  export PATH="/var/tmp/dist/binutils/bin:$PATH"
[% END -%]
distdir=/var/tmp/dist/[% project %]
boklm's avatar
boklm committed
10
11
[% c("var/set_PTDIR_DOCSDIR") -%]
mkdir -p $PTDIR $DOCSDIR
boklm's avatar
boklm committed
12
[% IF c("var/osx") %]
boklm's avatar
boklm committed
13
14
15
16
17
18
  export CGO_ENABLED=1
  export CGO_CFLAGS="[% c("var/FLAGS") %] -mmacosx-version-min=10.7"
  export CGO_CXXFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=10.7"
  export CGO_LDFLAGS="[% c("var/FLAGS") %] -stdlib=libc++ -mmacosx-version-min=10.7"
  export CC="$clangdir/bin/clang"
  export CXX="$clangdir/bin/clang++"
boklm's avatar
boklm committed
19
20
21
22
23
24
25
26
27
28
29
[% END %]

tar -C /var/tmp/dist -xf [% c('input_files_by_name/go-webrtc') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/uniuri') %]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]

mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
cd /var/tmp/build/[% project %]-[% c('version') %]

cd client
boklm's avatar
boklm committed
30
31
32
[% IF c("var/osx") -%]
  # Without faketime, snowflake-client would contain the timestamp of the
  # temporary client.a file created during "go build".
33
34
35
36
  # The -tmpdir flag overrides what would otherwise be a randomly generated
  # path, /tmp/go-link-RANDOMNUM/go.o.
  mkdir -p /var/tmp/go-link.tmpdir
  [% c("var/faketime") %] go build -ldflags '-s -tmpdir /var/tmp/go-link.tmpdir'
boklm's avatar
boklm committed
37
38
39
[% ELSE -%]
  go build -ldflags '-s'
[% END -%]
boklm's avatar
boklm committed
40
41
42
43
44
45
46
47
48
49
cp -a client[% IF c("var/windows") %].exe[% END %] $PTDIR/snowflake-client[% IF c("var/windows") %].exe[% END %]

cd ..
cp -a README.md LICENSE $DOCSDIR

cd $distdir
[% c('tar', {
        tar_src => [ '.' ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]