Skip to content

Commit 949abfe

Browse files
committed
Add ci for DragonFly (disabled for now)
1 parent 690ff04 commit 949abfe

File tree

3 files changed

+179
-0
lines changed

3 files changed

+179
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
g++ \
5+
make \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python2.7 \
10+
git \
11+
cmake \
12+
sudo \
13+
bzip2 \
14+
xz-utils \
15+
wget \
16+
libssl-dev \
17+
bsdtar \
18+
pkg-config
19+
20+
21+
COPY dist-x86_64-dragonfly/build-toolchain.sh /tmp/
22+
COPY dist-x86_64-dragonfly/patch-toolchain /tmp/
23+
RUN /tmp/build-toolchain.sh /tmp/patch-toolchain
24+
25+
COPY scripts/sccache.sh /scripts/
26+
RUN sh /scripts/sccache.sh
27+
28+
ENV \
29+
AR_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-ar \
30+
CC_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-gcc \
31+
CXX_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-g++
32+
33+
ENV HOSTS=x86_64-unknown-dragonfly
34+
35+
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
36+
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/bin/bash
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.
5+
#
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.
11+
12+
set -ex
13+
14+
ARCH=x86_64
15+
PATCH_TOOLCHAIN=$1
16+
BINUTILS=2.25.1
17+
GCC=6.4.0
18+
19+
hide_output() {
20+
set +x
21+
on_err="
22+
echo ERROR: An error was encountered with the build.
23+
cat /tmp/build.log
24+
exit 1
25+
"
26+
trap "$on_err" ERR
27+
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
28+
PING_LOOP_PID=$!
29+
$@ &> /tmp/build.log
30+
trap - ERR
31+
kill $PING_LOOP_PID
32+
set -x
33+
}
34+
35+
mkdir binutils
36+
cd binutils
37+
38+
# First up, build binutils
39+
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
40+
mkdir binutils-build
41+
cd binutils-build
42+
hide_output ../binutils-$BINUTILS/configure \
43+
--target=$ARCH-unknown-dragonfly
44+
hide_output make -j10
45+
hide_output make install
46+
cd ../..
47+
rm -rf binutils
48+
49+
# Next, download the DragonFly libc and relevant header files
50+
51+
URL=http://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.0.0_REL.iso.bz2
52+
mkdir dragonfly
53+
curl $URL | bzcat | bsdtar xf - -C dragonfly ./usr/include ./usr/lib ./lib
54+
55+
dst=/usr/local/$ARCH-unknown-dragonfly
56+
57+
mkdir -p $dst/lib
58+
cp -r dragonfly/usr/include $dst/
59+
cp dragonfly/usr/lib/crt1.o $dst/lib
60+
cp dragonfly/usr/lib/Scrt1.o $dst/lib
61+
cp dragonfly/usr/lib/crti.o $dst/lib
62+
cp dragonfly/usr/lib/crtn.o $dst/lib
63+
cp dragonfly/usr/lib/libc.a $dst/lib
64+
cp dragonfly/usr/lib/libutil.a $dst/lib
65+
cp dragonfly/usr/lib/libm.a $dst/lib
66+
cp dragonfly/usr/lib/librt.so.0 $dst/lib
67+
cp dragonfly/usr/lib/libexecinfo.so.1 $dst/lib
68+
cp dragonfly/lib/libc.so.8 $dst/lib
69+
cp dragonfly/lib/libm.so.4 $dst/lib
70+
cp dragonfly/lib/libutil.so.4 $dst/lib
71+
cp dragonfly/usr/lib/libpthread.so $dst/lib/libpthread.so
72+
cp dragonfly/usr/lib/thread/libthread_xu.so.2 $dst/lib/libpthread.so.0
73+
74+
ln -s libc.so.8 $dst/lib/libc.so
75+
ln -s libm.so.4 $dst/lib/libm.so
76+
ln -s librt.so.0 $dst/lib/librt.so
77+
ln -s libutil.so.4 $dst/lib/libutil.so
78+
ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so
79+
rm -rf dragonfly
80+
81+
# Finally, download and build gcc to target DragonFly
82+
mkdir gcc
83+
cd gcc
84+
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf -
85+
cd gcc-$GCC
86+
87+
# The following three patches are taken from DragonFly's dports collection:
88+
# https://github.com/DragonFlyBSD/DPorts/tree/master/lang/gcc5
89+
# The dports specification for gcc5 contains a few more patches, but they are
90+
# not relevant in this situation, as they are for a language we don't need
91+
# (e.g. java), or a platform which is not supported by DragonFly (e.g. i386,
92+
# powerpc64, ia64, arm).
93+
#
94+
# These patches probably only need to be updated in case the gcc version is
95+
# updated.
96+
97+
patch -p0 < $PATCH_TOOLCHAIN
98+
99+
./contrib/download_prerequisites
100+
101+
mkdir ../gcc-build
102+
cd ../gcc-build
103+
hide_output ../gcc-$GCC/configure \
104+
--enable-languages=c,c++ \
105+
--target=$ARCH-unknown-dragonfly \
106+
--disable-multilib \
107+
--disable-nls \
108+
--disable-libgomp \
109+
--disable-libquadmath \
110+
--disable-libssp \
111+
--disable-libvtv \
112+
--disable-libcilkrts \
113+
--disable-libada \
114+
--disable-libsanitizer \
115+
--disable-libquadmath-support \
116+
--disable-lto
117+
hide_output make -j10
118+
hide_output make install
119+
cd ../..
120+
rm -rf gcc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- libstdc++-v3/config/os/bsd/dragonfly/os_defines.h.orig 2015-07-09 16:08:54 UTC
2+
+++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
3+
@@ -29,4 +29,9 @@
4+
// System-specific #define, typedefs, corrections, etc, go here. This
5+
// file will come before all others.
6+
7+
+#define _GLIBCXX_USE_C99_CHECK 1
8+
+#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
9+
+#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
10+
+#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
11+
+
12+
#endif
13+
--- libstdc++-v3/configure.orig 2016-05-26 18:34:47.163132921 +0200
14+
+++ libstdc++-v3/configure 2016-05-26 18:35:29.594590648 +0200
15+
@@ -52013,7 +52013,7 @@
16+
17+
;;
18+
19+
- *-freebsd*)
20+
+ *-freebsd* | *-dragonfly*)
21+
SECTION_FLAGS='-ffunction-sections -fdata-sections'
22+
23+

0 commit comments

Comments
 (0)