Skip to content

Commit

Permalink
Add ci for DragonFly (disabled for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
mneumann committed Nov 12, 2017
1 parent 690ff04 commit 949abfe
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-dragonfly/Dockerfile
@@ -0,0 +1,36 @@
FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
file \
curl \
ca-certificates \
python2.7 \
git \
cmake \
sudo \
bzip2 \
xz-utils \
wget \
libssl-dev \
bsdtar \
pkg-config


COPY dist-x86_64-dragonfly/build-toolchain.sh /tmp/
COPY dist-x86_64-dragonfly/patch-toolchain /tmp/
RUN /tmp/build-toolchain.sh /tmp/patch-toolchain

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

ENV \
AR_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-ar \
CC_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-gcc \
CXX_x86_64_unknown_dragonfly=x86_64-unknown-dragonfly-g++

ENV HOSTS=x86_64-unknown-dragonfly

ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
120 changes: 120 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh
@@ -0,0 +1,120 @@
#!/bin/bash
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
# option. This file may not be copied, modified, or distributed
# except according to those terms.

set -ex

ARCH=x86_64
PATCH_TOOLCHAIN=$1
BINUTILS=2.25.1
GCC=6.4.0

hide_output() {
set +x
on_err="
echo ERROR: An error was encountered with the build.
cat /tmp/build.log
exit 1
"
trap "$on_err" ERR
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
PING_LOOP_PID=$!
$@ &> /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}

mkdir binutils
cd binutils

# First up, build binutils
curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
mkdir binutils-build
cd binutils-build
hide_output ../binutils-$BINUTILS/configure \
--target=$ARCH-unknown-dragonfly
hide_output make -j10
hide_output make install
cd ../..
rm -rf binutils

# Next, download the DragonFly libc and relevant header files

URL=http://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-5.0.0_REL.iso.bz2
mkdir dragonfly
curl $URL | bzcat | bsdtar xf - -C dragonfly ./usr/include ./usr/lib ./lib

dst=/usr/local/$ARCH-unknown-dragonfly

mkdir -p $dst/lib
cp -r dragonfly/usr/include $dst/
cp dragonfly/usr/lib/crt1.o $dst/lib
cp dragonfly/usr/lib/Scrt1.o $dst/lib
cp dragonfly/usr/lib/crti.o $dst/lib
cp dragonfly/usr/lib/crtn.o $dst/lib
cp dragonfly/usr/lib/libc.a $dst/lib
cp dragonfly/usr/lib/libutil.a $dst/lib
cp dragonfly/usr/lib/libm.a $dst/lib
cp dragonfly/usr/lib/librt.so.0 $dst/lib
cp dragonfly/usr/lib/libexecinfo.so.1 $dst/lib
cp dragonfly/lib/libc.so.8 $dst/lib
cp dragonfly/lib/libm.so.4 $dst/lib
cp dragonfly/lib/libutil.so.4 $dst/lib
cp dragonfly/usr/lib/libpthread.so $dst/lib/libpthread.so
cp dragonfly/usr/lib/thread/libthread_xu.so.2 $dst/lib/libpthread.so.0

ln -s libc.so.8 $dst/lib/libc.so
ln -s libm.so.4 $dst/lib/libm.so
ln -s librt.so.0 $dst/lib/librt.so
ln -s libutil.so.4 $dst/lib/libutil.so
ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so
rm -rf dragonfly

# Finally, download and build gcc to target DragonFly
mkdir gcc
cd gcc
curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf -
cd gcc-$GCC

# The following three patches are taken from DragonFly's dports collection:
# https://github.com/DragonFlyBSD/DPorts/tree/master/lang/gcc5
# The dports specification for gcc5 contains a few more patches, but they are
# not relevant in this situation, as they are for a language we don't need
# (e.g. java), or a platform which is not supported by DragonFly (e.g. i386,
# powerpc64, ia64, arm).
#
# These patches probably only need to be updated in case the gcc version is
# updated.

patch -p0 < $PATCH_TOOLCHAIN

./contrib/download_prerequisites

mkdir ../gcc-build
cd ../gcc-build
hide_output ../gcc-$GCC/configure \
--enable-languages=c,c++ \
--target=$ARCH-unknown-dragonfly \
--disable-multilib \
--disable-nls \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libcilkrts \
--disable-libada \
--disable-libsanitizer \
--disable-libquadmath-support \
--disable-lto
hide_output make -j10
hide_output make install
cd ../..
rm -rf gcc
23 changes: 23 additions & 0 deletions src/ci/docker/disabled/dist-x86_64-dragonfly/patch-toolchain
@@ -0,0 +1,23 @@
--- libstdc++-v3/config/os/bsd/dragonfly/os_defines.h.orig 2015-07-09 16:08:54 UTC
+++ libstdc++-v3/config/os/bsd/dragonfly/os_defines.h
@@ -29,4 +29,9 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.

+#define _GLIBCXX_USE_C99_CHECK 1
+#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))
+#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1
+#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)
+
#endif
--- libstdc++-v3/configure.orig 2016-05-26 18:34:47.163132921 +0200
+++ libstdc++-v3/configure 2016-05-26 18:35:29.594590648 +0200
@@ -52013,7 +52013,7 @@

;;

- *-freebsd*)
+ *-freebsd* | *-dragonfly*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'


0 comments on commit 949abfe

Please sign in to comment.