2 # Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3 # file at the top-level directory of this distribution and at
4 # http://rust-lang.org/COPYRIGHT.
6 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9 # option. This file may not be copied, modified, or distributed
10 # except according to those terms.
12 # ignore-tidy-linelength
19 # First up, build binutils
22 curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
25 ../binutils-$BINUTILS/configure \
26 --target=x86_64-unknown-netbsd
32 # Next, download the NetBSD libc and relevant header files
35 # https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz
36 curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-base.tgz | \
37 tar xzf - -C netbsd ./usr/include ./usr/lib ./lib
39 # https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/comp.tgz
40 curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-comp.tgz | \
41 tar xzf - -C netbsd ./usr/include ./usr/lib
43 dst=/usr/local/x86_64-unknown-netbsd
44 cp -r netbsd/usr/include $dst
45 cp netbsd/usr/lib/crt0.o $dst/lib
46 cp netbsd/usr/lib/crti.o $dst/lib
47 cp netbsd/usr/lib/crtn.o $dst/lib
48 cp netbsd/usr/lib/crtbeginS.o $dst/lib
49 cp netbsd/usr/lib/crtendS.o $dst/lib
50 cp netbsd/usr/lib/crtbegin.o $dst/lib
51 cp netbsd/usr/lib/crtend.o $dst/lib
52 cp netbsd/usr/lib/gcrt0.o $dst/lib
53 cp netbsd/usr/lib/libc.a $dst/lib
54 cp netbsd/usr/lib/libc_p.a $dst/lib
55 cp netbsd/usr/lib/libc_pic.a $dst/lib
56 cp netbsd/lib/libc.so.12.193.1 $dst/lib
57 cp netbsd/lib/libutil.so.7.21 $dst/lib
58 cp netbsd/usr/lib/libm.a $dst/lib
59 cp netbsd/usr/lib/libm_p.a $dst/lib
60 cp netbsd/usr/lib/libm_pic.a $dst/lib
61 cp netbsd/lib/libm.so.0.11 $dst/lib
62 cp netbsd/usr/lib/librt.so.1.1 $dst/lib
63 cp netbsd/usr/lib/libpthread.a $dst/lib
64 cp netbsd/usr/lib/libpthread_p.a $dst/lib
65 cp netbsd/usr/lib/libpthread_pic.a $dst/lib
66 cp netbsd/usr/lib/libpthread.so.1.2 $dst/lib
68 ln -s libc.so.12.193.1 $dst/lib/libc.so
69 ln -s libc.so.12.193.1 $dst/lib/libc.so.12
70 ln -s libm.so.0.11 $dst/lib/libm.so
71 ln -s libm.so.0.11 $dst/lib/libm.so.0
72 ln -s libutil.so.7.21 $dst/lib/libutil.so
73 ln -s libutil.so.7.21 $dst/lib/libutil.so.7
74 ln -s libpthread.so.1.2 $dst/lib/libpthread.so
75 ln -s libpthread.so.1.2 $dst/lib/libpthread.so.1
76 ln -s librt.so.1.1 $dst/lib/librt.so
80 # Finally, download and build gcc to target NetBSD
83 curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
85 ./contrib/download_prerequisites
88 # ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__base.h
89 PATCHES="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch1.patch"
92 # ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__configure__char.cc
93 PATCHES="$PATCHES https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch2.patch"
95 for patch in $PATCHES; do
96 curl $patch | patch -Np0
101 ../gcc-$GCC/configure \
102 --enable-languages=c,c++ \
103 --target=x86_64-unknown-netbsd \
104 --disable-libcilkrts \
108 --disable-libquadmath \
111 --disable-libcilkrt \
113 --disable-libsanitizer \
114 --disable-libquadmath-support \