Skip to content

Commit 8df1f8c

Browse files
Merge #467
467: Updating FreeBSD to 12.1 target r=reitermarkus a=jaredwolff Restoring FreeBSD to its former glory! A few strategic changes to update the toolchain for compiling on FreeBSD 12.1. Co-authored-by: Jared Wolff <[email protected]>
2 parents ae02d9d + 3954fd9 commit 8df1f8c

8 files changed

+110
-41
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ terminate.
275275
| `armv7-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 4.1.0 ||
276276
| `i586-unknown-linux-gnu` | 2.23 | 5.3.1 || N/A ||
277277
| `i586-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A ||
278+
| `i686-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A ||
278279
| `i686-linux-android` [2] | N/A | 4.9 || N/A ||
279280
| `i686-pc-windows-gnu` | N/A | 7.3.0 || N/A ||
280281
| `i686-unknown-linux-gnu` | 2.15 | 4.6.2 || N/A ||
@@ -300,6 +301,7 @@ terminate.
300301
| `x86_64-linux-android` [2] | N/A | 4.9 || N/A ||
301302
| `x86_64-pc-windows-gnu` | N/A | 7.3.0 || N/A ||
302303
| `x86_64-sun-solaris` [4] | 2.11 | 5.3.0 || N/A | |
304+
| `x86_64-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A ||
303305
| `x86_64-unknown-dragonfly` [4] [3] | 4.6.0 | 5.3.0 || N/A | |
304306
| `x86_64-unknown-linux-gnu` | 2.15 | 4.6.2 || N/A ||
305307
| `x86_64-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A ||

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jobs:
5656
x86_64-pc-windows-gnu: { TARGET: x86_64-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 }
5757
i686-pc-windows-gnu: { TARGET: i686-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 }
5858
# x86_64-unknown-dragonfly: { TARGET: x86_64-unknown-dragonfly, CPP: 1, DYLIB: 1, TOOLCHAIN: nightly }
59-
# i686-unknown-freebsd: { TARGET: i686-unknown-freebsd, DYLIB: 1, STD: 1 }
60-
# x86_64-unknown-freebsd: { TARGET: x86_64-unknown-freebsd, DYLIB: 1, STD: 1 }
59+
i686-unknown-freebsd: { TARGET: i686-unknown-freebsd, DYLIB: 1, STD: 1 }
60+
x86_64-unknown-freebsd: { TARGET: x86_64-unknown-freebsd, DYLIB: 1, STD: 1 }
6161
x86_64-unknown-netbsd: { TARGET: x86_64-unknown-netbsd, CPP: 1, DYLIB: 1, STD: 1 }
6262
sparcv9-sun-solaris: { TARGET: sparcv9-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 }
6363
x86_64-sun-solaris: { TARGET: x86_64-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:16.04
2+
3+
COPY common.sh /
4+
RUN /common.sh
5+
6+
COPY xargo.sh /
7+
RUN /xargo.sh
8+
9+
COPY freebsd.sh /
10+
RUN /freebsd.sh i686
11+
12+
COPY freebsd-extras.sh /
13+
RUN /freebsd-extras.sh i686
14+
15+
ENV CARGO_TARGET_I686_UNKNOWN_FREEBSD_LINKER=i686-unknown-freebsd12-gcc \
16+
CC_i686_unknown_freebsd=i686-unknown-freebsd12-gcc \
17+
CXX_i686_unknown_freebsd=i686-unknown-freebsd12-g++ \
18+
I686_UNKNOWN_FREEBSD_OPENSSL_DIR=/usr/local/i686-unknown-freebsd12/ \
19+
SQLITE3_LIB_DIR=/usr/local/x86_64-unknown-freebsd12/lib/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM ubuntu:16.04
2+
3+
COPY common.sh /
4+
RUN /common.sh
5+
6+
COPY xargo.sh /
7+
RUN /xargo.sh
8+
9+
COPY freebsd.sh /
10+
RUN /freebsd.sh x86_64
11+
12+
COPY freebsd-extras.sh /
13+
RUN /freebsd-extras.sh x86_64
14+
15+
ENV CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd12-gcc \
16+
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-gcc \
17+
CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd12-g++ \
18+
X86_64_UNKNOWN_FREEBSD_OPENSSL_DIR=/usr/local/x86_64-unknown-freebsd12/ \
19+
SQLITE3_LIB_DIR=/usr/local/x86_64-unknown-freebsd12/lib/

docker/disabled/Dockerfile.i686-unknown-freebsd

Lines changed: 0 additions & 14 deletions
This file was deleted.

docker/disabled/Dockerfile.x86_64-unknown-freebsd

Lines changed: 0 additions & 14 deletions
This file was deleted.

docker/freebsd-extras.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -euo pipefail
5+
6+
main() {
7+
local arch="${1}"
8+
9+
local sqlite_ver=3.33.0,1 \
10+
openssl_ver=1.1.1h,1 \
11+
target="${arch}-unknown-freebsd12"
12+
13+
local td
14+
td="$(mktemp -d)"
15+
16+
mkdir "${td}"/{openssl,sqlite}
17+
18+
pushd "${td}"
19+
20+
local bsd_arch=
21+
case "${arch}" in
22+
x86_64)
23+
bsd_arch=amd64
24+
;;
25+
i686)
26+
bsd_arch=i386
27+
;;
28+
esac
29+
30+
# Adding openssl lib
31+
curl --retry 3 -sSfL "https://pkg.freebsd.org/FreeBSD:12:${bsd_arch}/quarterly/All/openssl-${openssl_ver}.txz" -O
32+
tar -C "${td}/openssl" -xJf openssl-${openssl_ver}.txz /usr/local/lib /usr/local/include/
33+
34+
# Adding sqlite3
35+
curl --retry 3 -sSfL "https://pkg.freebsd.org/FreeBSD:12:${bsd_arch}/quarterly/All/sqlite3-${sqlite_ver}.txz" -O
36+
tar -C "${td}/sqlite" -xJf sqlite3-${sqlite_ver}.txz /usr/local/lib
37+
38+
# Copy the linked library
39+
local destdir="/usr/local/${target}"
40+
cp -r "${td}/openssl/usr/local/include" "${destdir}"
41+
cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.a "${destdir}/lib"
42+
cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.so.11 "${destdir}/lib"
43+
cp "${td}/openssl/usr/local/lib"/lib{crypto,ssl}.so "${destdir}/lib"
44+
cp "${td}/sqlite/usr/local/lib/libsqlite3.a" "${destdir}/lib"
45+
cp "${td}/sqlite/usr/local/lib/libsqlite3.so.0.8.6" "${destdir}/lib"
46+
cp "${td}/sqlite/usr/local/lib/libsqlite3.so" "${destdir}/lib"
47+
cp "${td}/sqlite/usr/local/lib/libsqlite3.so.0" "${destdir}/lib"
48+
49+
# clean up
50+
popd
51+
52+
rm -rf "${td}"
53+
rm "${0}"
54+
}
55+
56+
main "${@}"

docker/freebsd.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ set -euo pipefail
66
main() {
77
local arch="${1}"
88

9-
local binutils=2.25.1 \
10-
gcc=5.3.0 \
11-
target="${arch}-unknown-freebsd10"
9+
local base_release=12.1 \
10+
binutils=2.32 \
11+
gcc=6.4.0 \
12+
target="${arch}-unknown-freebsd12"
1213

1314
local dependencies=(
14-
bzip2
1515
ca-certificates
1616
curl
1717
g++
@@ -34,11 +34,11 @@ main() {
3434

3535
mkdir "${td}"/{binutils,gcc}{,-build} "${td}/freebsd"
3636

37-
curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/binutils/binutils-${binutils}.tar.bz2" -O
38-
tar -C "${td}/binutils" --strip-components=1 -xjf "binutils-${binutils}.tar.bz2"
37+
curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/binutils/binutils-${binutils}.tar.gz" -O
38+
tar -C "${td}/binutils" --strip-components=1 -xf "binutils-${binutils}.tar.gz"
3939

40-
curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-${gcc}/gcc-${gcc}.tar.bz2" -O
41-
tar -C "${td}/gcc" --strip-components=1 -xjf "gcc-${gcc}.tar.bz2"
40+
curl --retry 3 -sSfL "https://ftp.gnu.org/gnu/gcc/gcc-${gcc}/gcc-${gcc}.tar.gz" -O
41+
tar -C "${td}/gcc" --strip-components=1 -xf "gcc-${gcc}.tar.gz"
4242

4343
pushd "${td}"
4444

@@ -57,7 +57,7 @@ main() {
5757
;;
5858
esac
5959

60-
curl --retry 3 -sSfL "http://ftp.freebsd.org/pub/FreeBSD/releases/${bsd_arch}/10.2-RELEASE/base.txz" -O
60+
curl --retry 3 -sSfL "http://ftp.freebsd.org/pub/FreeBSD/releases/${bsd_arch}/${base_release}-RELEASE/base.txz" -O
6161
tar -C "${td}/freebsd" -xJf base.txz ./usr/include ./usr/lib ./lib
6262

6363
cd binutils-build
@@ -71,7 +71,7 @@ main() {
7171
cp -r "${td}/freebsd/usr/include" "${destdir}"
7272
cp "${td}/freebsd/lib/libc.so.7" "${destdir}/lib"
7373
cp "${td}/freebsd/lib/libm.so.5" "${destdir}/lib"
74-
cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib/libpthread.so"
74+
cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib"
7575
cp "${td}/freebsd/lib/libutil.so.9" "${destdir}/lib"
7676
cp "${td}/freebsd/usr/lib/libc++.so.1" "${destdir}/lib"
7777
cp "${td}/freebsd/usr/lib/libc++.a" "${destdir}/lib"
@@ -85,10 +85,12 @@ main() {
8585
ln -s libm.so.5 "${destdir}/lib/libm.so"
8686
ln -s librt.so.1 "${destdir}/lib/librt.so"
8787
ln -s libutil.so.9 "${destdir}/lib/libutil.so"
88+
ln -s libthr.so.3 "${destdir}/lib/libpthread.so"
8889

8990
cd gcc-build
9091
../gcc/configure \
9192
--disable-libada \
93+
--disable-libcilkrt \
9294
--disable-libcilkrts \
9395
--disable-libgomp \
9496
--disable-libquadmath \
@@ -97,7 +99,6 @@ main() {
9799
--disable-libssp \
98100
--disable-libvtv \
99101
--disable-lto \
100-
--disable-multilib \
101102
--disable-nls \
102103
--enable-languages=c,c++ \
103104
--target="${target}"

0 commit comments

Comments
 (0)