Skip to content

Commit

Permalink
Updating FreeBSD to 12.1 target.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
jaredwolff committed Oct 11, 2020
1 parent e88c7b2 commit df306ed
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 40 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,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-unknown-linux-gnu` | 2.15 | 4.6.2 || N/A ||
| `i686-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A ||
Expand All @@ -289,6 +290,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 ||
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
# `cargo build` fails with undefined symbols (https://github.com/rust-lang/rust/issues/32859) on `i686-pc-windows-gnu`.
# 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 }
Expand Down
18 changes: 18 additions & 0 deletions docker/Dockerfile.i686-unknown-freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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/
18 changes: 18 additions & 0 deletions docker/Dockerfile.x86_64-unknown-freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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/
14 changes: 0 additions & 14 deletions docker/disabled/Dockerfile.i686-unknown-freebsd

This file was deleted.

14 changes: 0 additions & 14 deletions docker/disabled/Dockerfile.x86_64-unknown-freebsd

This file was deleted.

55 changes: 55 additions & 0 deletions docker/freebsd-extras.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash

set -x
set -euo pipefail

main() {
local arch="${1}"

local sqlite_ver=2.8.17_5 \
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 sqlite
curl --retry 3 -sSfL "https://pkg.freebsd.org/FreeBSD:12:${bsd_arch}/quarterly/All/sqlite-${sqlite_ver}.txz" -O
tar -C "${td}/sqlite" -xJf sqlite-${sqlite_ver}.txz /usr/local/lib

# Copy the linked library
local destdir="/usr/local/${target}"
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 -r "${td}/openssl/usr/local/include" "${destdir}"
cp "${td}/sqlite/usr/local/lib/libsqlite.a" "${destdir}/lib"
cp "${td}/sqlite/usr/local/lib/libsqlite.so.0.8.6" "${destdir}/lib"
cp "${td}/sqlite/usr/local/lib/libsqlite.so" "${destdir}/lib"

# clean up
popd

rm -rf "${td}"
rm "${0}"
}

main "${@}"
20 changes: 10 additions & 10 deletions docker/freebsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -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}"

Expand All @@ -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
Expand Down Expand Up @@ -89,6 +89,7 @@ main() {
cd gcc-build
../gcc/configure \
--disable-libada \
--disable-libcilkrt \
--disable-libcilkrts \
--disable-libgomp \
--disable-libquadmath \
Expand All @@ -97,7 +98,6 @@ main() {
--disable-libssp \
--disable-libvtv \
--disable-lto \
--disable-multilib \
--disable-nls \
--enable-languages=c,c++ \
--target="${target}"
Expand Down

0 comments on commit df306ed

Please sign in to comment.