summaryrefslogtreecommitdiffstats
path: root/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly')
-rw-r--r--src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/Dockerfile37
-rwxr-xr-xsrc/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh111
-rw-r--r--src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/patch-toolchain23
3 files changed, 171 insertions, 0 deletions
diff --git a/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/Dockerfile b/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/Dockerfile
new file mode 100644
index 000000000..5d594a805
--- /dev/null
+++ b/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/Dockerfile
@@ -0,0 +1,37 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ g++ \
+ make \
+ ninja-build \
+ file \
+ curl \
+ ca-certificates \
+ python3 \
+ git \
+ cmake \
+ sudo \
+ bzip2 \
+ xz-utils \
+ wget \
+ libssl-dev \
+ bsdtar \
+ pkg-config
+
+
+COPY host-x86_64/dist-x86_64-dragonfly/build-toolchain.sh /tmp/
+COPY host-x86_64/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 --enable-extended
+ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
diff --git a/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh b/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh
new file mode 100755
index 000000000..b305f358c
--- /dev/null
+++ b/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/build-toolchain.sh
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+
+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=https://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
diff --git a/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/patch-toolchain b/src/ci/docker/host-x86_64/disabled/dist-x86_64-dragonfly/patch-toolchain
new file mode 100644
index 000000000..98424309e
--- /dev/null
+++ b/src/ci/docker/host-x86_64/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'
+
+