From 3954fd9fb07e3f4d51345fc783a8a6bb1a13eba6 Mon Sep 17 00:00:00 2001 From: Jared Wolff Date: Sat, 10 Oct 2020 00:48:29 -0400 Subject: [PATCH] Updating FreeBSD to 12.1 target. - Additionally, adding libssl + libsqlite3 as they are usually necessary - Enabling azure pipeline for freebsd again - Pre-baking openssl including cross compile openssl dir - Updating readme --- README.md | 2 + azure-pipelines.yml | 4 +- docker/Dockerfile.i686-unknown-freebsd | 19 +++++++ docker/Dockerfile.x86_64-unknown-freebsd | 19 +++++++ .../disabled/Dockerfile.i686-unknown-freebsd | 14 ----- .../Dockerfile.x86_64-unknown-freebsd | 14 ----- docker/freebsd-extras.sh | 56 +++++++++++++++++++ docker/freebsd.sh | 23 ++++---- 8 files changed, 110 insertions(+), 41 deletions(-) create mode 100644 docker/Dockerfile.i686-unknown-freebsd create mode 100644 docker/Dockerfile.x86_64-unknown-freebsd delete mode 100644 docker/disabled/Dockerfile.i686-unknown-freebsd delete mode 100644 docker/disabled/Dockerfile.x86_64-unknown-freebsd create mode 100755 docker/freebsd-extras.sh diff --git a/README.md b/README.md index b81dc37b4..b30d822dd 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,7 @@ terminate. | `armv7-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | | `i586-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | N/A | ✓ | | `i586-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A | ✓ | +| `i686-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A | ✓ | | `i686-linux-android` [2] | N/A | 4.9 | ✓ | N/A | ✓ | | `i686-pc-windows-gnu` | N/A | 7.3.0 | ✓ | N/A | ✓ | | `i686-unknown-linux-gnu` | 2.15 | 4.6.2 | ✓ | N/A | ✓ | @@ -300,6 +301,7 @@ terminate. | `x86_64-linux-android` [2] | N/A | 4.9 | ✓ | N/A | ✓ | | `x86_64-pc-windows-gnu` | N/A | 7.3.0 | ✓ | N/A | ✓ | | `x86_64-sun-solaris` [4] | 2.11 | 5.3.0 | ✓ | N/A | | +| `x86_64-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A | ✓ | | `x86_64-unknown-dragonfly` [4] [3] | 4.6.0 | 5.3.0 | ✓ | N/A | | | `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 | ✓ | N/A | ✓ | | `x86_64-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A | ✓ | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c86ee648..8395d5310 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -56,8 +56,8 @@ jobs: x86_64-pc-windows-gnu: { TARGET: x86_64-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 } i686-pc-windows-gnu: { TARGET: i686-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 } # x86_64-unknown-dragonfly: { TARGET: x86_64-unknown-dragonfly, CPP: 1, DYLIB: 1, TOOLCHAIN: nightly } - # i686-unknown-freebsd: { TARGET: i686-unknown-freebsd, DYLIB: 1, STD: 1 } - # x86_64-unknown-freebsd: { TARGET: x86_64-unknown-freebsd, DYLIB: 1, STD: 1 } + i686-unknown-freebsd: { TARGET: i686-unknown-freebsd, DYLIB: 1, STD: 1 } + x86_64-unknown-freebsd: { TARGET: x86_64-unknown-freebsd, DYLIB: 1, STD: 1 } x86_64-unknown-netbsd: { TARGET: x86_64-unknown-netbsd, CPP: 1, DYLIB: 1, STD: 1 } sparcv9-sun-solaris: { TARGET: sparcv9-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 } x86_64-sun-solaris: { TARGET: x86_64-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 } diff --git a/docker/Dockerfile.i686-unknown-freebsd b/docker/Dockerfile.i686-unknown-freebsd new file mode 100644 index 000000000..43abb86b0 --- /dev/null +++ b/docker/Dockerfile.i686-unknown-freebsd @@ -0,0 +1,19 @@ +FROM ubuntu:16.04 + +COPY common.sh / +RUN /common.sh + +COPY xargo.sh / +RUN /xargo.sh + +COPY freebsd.sh / +RUN /freebsd.sh i686 + +COPY freebsd-extras.sh / +RUN /freebsd-extras.sh i686 + +ENV CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd12-gcc \ + CC_i686_unknown_freebsd=i686-unknown-freebsd12-gcc \ + CXX_i686_unknown_freebsd=i686-unknown-freebsd12-g++ \ + I686_UNKNOWN_FREEBSD_OPENSSL_DIR=/usr/local/i686-unknown-freebsd12/ \ + SQLITE3_LIB_DIR=/usr/local/x86_64-unknown-freebsd12/lib/ diff --git a/docker/Dockerfile.x86_64-unknown-freebsd b/docker/Dockerfile.x86_64-unknown-freebsd new file mode 100644 index 000000000..0679a7f07 --- /dev/null +++ b/docker/Dockerfile.x86_64-unknown-freebsd @@ -0,0 +1,19 @@ +FROM ubuntu:16.04 + +COPY common.sh / +RUN /common.sh + +COPY xargo.sh / +RUN /xargo.sh + +COPY freebsd.sh / +RUN /freebsd.sh x86_64 + +COPY freebsd-extras.sh / +RUN /freebsd-extras.sh x86_64 + +ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd12-gcc \ + CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-gcc \ + CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-g++ \ + X86_64_UNKNOWN_FREEBSD_OPENSSL_DIR=/usr/local/x86_64-unknown-freebsd12/ \ + SQLITE3_LIB_DIR=/usr/local/x86_64-unknown-freebsd12/lib/ diff --git a/docker/disabled/Dockerfile.i686-unknown-freebsd b/docker/disabled/Dockerfile.i686-unknown-freebsd deleted file mode 100644 index dcbf42e04..000000000 --- a/docker/disabled/Dockerfile.i686-unknown-freebsd +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:16.04 - -COPY common.sh / -RUN /common.sh - -COPY xargo.sh / -RUN /xargo.sh - -COPY freebsd.sh / -RUN /freebsd.sh i686 - -ENV CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd10-gcc \ - CC_i686_unknown_freebsd=i686-unknown-freebsd10-gcc \ - CXX_i686_unknown_freebsd=i686-unknown-freebsd10-g++ diff --git a/docker/disabled/Dockerfile.x86_64-unknown-freebsd b/docker/disabled/Dockerfile.x86_64-unknown-freebsd deleted file mode 100644 index 5ca9aa16d..000000000 --- a/docker/disabled/Dockerfile.x86_64-unknown-freebsd +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu:16.04 - -COPY common.sh / -RUN /common.sh - -COPY xargo.sh / -RUN /xargo.sh - -COPY freebsd.sh / -RUN /freebsd.sh x86_64 - -ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc \ - CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \ - CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++ diff --git a/docker/freebsd-extras.sh b/docker/freebsd-extras.sh new file mode 100755 index 000000000..425fea7e6 --- /dev/null +++ b/docker/freebsd-extras.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +set -x +set -euo pipefail + +main() { + local arch="${1}" + + local sqlite_ver=3.33.0,1 \ + openssl_ver=1.1.1h,1 \ + target="${arch}-unknown-freebsd12" + + local td + td="$(mktemp -d)" + + mkdir "${td}"/{openssl,sqlite} + + pushd "${td}" + + local bsd_arch= + case "${arch}" in + x86_64) + bsd_arch=amd64 + ;; + i686) + bsd_arch=i386 + ;; + esac + + # Adding openssl lib + curl --retry 3 -sSfL "https://pkg.freebsd.org/FreeBSD:12:${bsd_arch}/quarterly/All/openssl-${openssl_ver}.txz" -O + tar -C "${td}/openssl" -xJf openssl-${openssl_ver}.txz /usr/local/lib /usr/local/include/ + + # Adding sqlite3 + curl --retry 3 -sSfL "https://pkg.freebsd.org/FreeBSD:12:${bsd_arch}/quarterly/All/sqlite3-${sqlite_ver}.txz" -O + tar -C "${td}/sqlite" -xJf sqlite3-${sqlite_ver}.txz /usr/local/lib + + # Copy the linked library + local destdir="/usr/local/${target}" + cp -r "${td}/openssl/usr/local/include" "${destdir}" + cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.a "${destdir}/lib" + cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.so.11 "${destdir}/lib" + cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.so "${destdir}/lib" + cp "${td}/sqlite/usr/local/lib/libsqlite3.a" "${destdir}/lib" + cp "${td}/sqlite/usr/local/lib/libsqlite3.so.0.8.6" "${destdir}/lib" + cp "${td}/sqlite/usr/local/lib/libsqlite3.so" "${destdir}/lib" + cp "${td}/sqlite/usr/local/lib/libsqlite3.so.0" "${destdir}/lib" + + # clean up + popd + + rm -rf "${td}" + rm "${0}" +} + +main "${@}" diff --git a/docker/freebsd.sh b/docker/freebsd.sh index b1ab3a5bc..ee05b1fc9 100755 --- a/docker/freebsd.sh +++ b/docker/freebsd.sh @@ -6,12 +6,12 @@ set -euo pipefail main() { local arch="${1}" - local binutils=2.25.1 \ - gcc=5.3.0 \ - target="${arch}-unknown-freebsd10" + local base_release=12.1 \ + binutils=2.32 \ + gcc=6.4.0 \ + target="${arch}-unknown-freebsd12" local dependencies=( - bzip2 ca-certificates curl g++ @@ -34,11 +34,11 @@ main() { mkdir "${td}"/{binutils,gcc}{,-build} "${td}/freebsd" - curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/binutils/binutils-${binutils}.tar.bz2" -O - tar -C "${td}/binutils" --strip-components=1 -xjf "binutils-${binutils}.tar.bz2" + curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/binutils/binutils-${binutils}.tar.gz" -O + tar -C "${td}/binutils" --strip-components=1 -xf "binutils-${binutils}.tar.gz" - curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-${gcc}/gcc-${gcc}.tar.bz2" -O - tar -C "${td}/gcc" --strip-components=1 -xjf "gcc-${gcc}.tar.bz2" + curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-${gcc}/gcc-${gcc}.tar.gz" -O + tar -C "${td}/gcc" --strip-components=1 -xf "gcc-${gcc}.tar.gz" pushd "${td}" @@ -57,7 +57,7 @@ main() { ;; esac - curl --retry 3 -sSfL "http://ftp.freebsd.org/pub/FreeBSD/releases/${bsd_arch}/10.2-RELEASE/base.txz" -O + curl --retry 3 -sSfL "http://ftp.freebsd.org/pub/FreeBSD/releases/${bsd_arch}/${base_release}-RELEASE/base.txz" -O tar -C "${td}/freebsd" -xJf base.txz ./usr/include ./usr/lib ./lib cd binutils-build @@ -71,7 +71,7 @@ main() { cp -r "${td}/freebsd/usr/include" "${destdir}" cp "${td}/freebsd/lib/libc.so.7" "${destdir}/lib" cp "${td}/freebsd/lib/libm.so.5" "${destdir}/lib" - cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib/libpthread.so" + cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib" cp "${td}/freebsd/lib/libutil.so.9" "${destdir}/lib" cp "${td}/freebsd/usr/lib/libc++.so.1" "${destdir}/lib" cp "${td}/freebsd/usr/lib/libc++.a" "${destdir}/lib" @@ -85,10 +85,12 @@ main() { ln -s libm.so.5 "${destdir}/lib/libm.so" ln -s librt.so.1 "${destdir}/lib/librt.so" ln -s libutil.so.9 "${destdir}/lib/libutil.so" + ln -s libthr.so.3 "${destdir}/lib/libpthread.so" cd gcc-build ../gcc/configure \ --disable-libada \ + --disable-libcilkrt \ --disable-libcilkrts \ --disable-libgomp \ --disable-libquadmath \ @@ -97,7 +99,6 @@ main() { --disable-libssp \ --disable-libvtv \ --disable-lto \ - --disable-multilib \ --disable-nls \ --enable-languages=c,c++ \ --target="${target}"