2
0

Support for building on Linux.

This commit is contained in:
Maarten Billemont 2018-06-30 23:35:29 -04:00
parent e4e2aaad95
commit 30dac64d5d
5 changed files with 34 additions and 7 deletions

6
Dockerfile Normal file
View File

@ -0,0 +1,6 @@
FROM alpine
WORKDIR /mpw/gradle
ADD . /mpw
RUN apk update && apk add libtool automake autoconf make g++ openjdk8
RUN ./gradlew -i build

View File

@ -151,7 +151,9 @@ _target_prepare() {
# #
# Configure the library for building the target. # Configure the library for building the target.
# #
# By default, this will run `./configure --host=<host> --prefix=<prefix>/<arch> --disable-shared <args>`. # By default, this will run `./configure --host=<host> --prefix=<prefix>/<arch> <args>`.
# By default, some platform-specific arguments will be passed in as well as
# --enable-pic --disable-pie to ensure the resulting library can be linked again.
target_configure() { _target_configure "$@"; } target_configure() { _target_configure "$@"; }
_target_configure() { _target_configure() {
local prefix=$1 platform=$2 arch=$3; shift 3 local prefix=$1 platform=$2 arch=$3; shift 3
@ -173,7 +175,7 @@ _target_configure() {
;; ;;
esac esac
./configure ${host:+--host="$host"} --prefix="$prefix/$arch" "$@" ./configure ${host:+--host="$host"} --enable-pic --disable-pie --prefix="$prefix/$arch" "$@"
} }
# target_build <prefix> <platform> <arch> # target_build <prefix> <platform> <arch>
@ -214,27 +216,34 @@ _finalize() {
finalize_merge() { _finalize_merge "$@"; } finalize_merge() { _finalize_merge "$@"; }
_finalize_merge() { _finalize_merge() {
local prefix=$1 platform=$2; shift 2 local prefix=$1 platform=$2; shift 2
local archs=( "$@" )
[[ -e "$prefix/$1/include" ]] && mv -f -- "$prefix/$1/include" "$prefix/out/" [[ -e "$prefix/$archs/include" ]] && mv -f -- "$prefix/$archs/include" "$prefix/out/"
mkdir -p "$prefix/out/lib" mkdir -p "$prefix/out/lib"
case "$platform" in case "$platform" in
'linux')
for arch in "${archs[@]}"; do
install -d "$prefix/out/lib/$arch"
install -p "$prefix/$arch/lib/"*.a "$prefix/out/lib/$arch/"
done
;;
'windows') 'windows')
for arch; do for arch in "${archs[@]}"; do
install -d "$prefix/out/lib/$arch" install -d "$prefix/out/lib/$arch"
install -p "$prefix/$arch/"*.lib "$prefix/out/lib/$arch/" install -p "$prefix/$arch/"*.lib "$prefix/out/lib/$arch/"
done done
;; ;;
'macos'|'ios') 'macos'|'ios')
for lib in "$prefix/$1/lib/"*; do for lib in "$prefix/$archs/lib/"*; do
if lipo -info "$lib" >/dev/null 2>&1; then if lipo -info "$lib" >/dev/null 2>&1; then
local lib=("${lib##*/}") libs=("${@/#/$prefix/}") libs=("${libs[@]/%//lib/$lib}") local lib=("${lib##*/}") libs=("${archs/#/$prefix/}") libs=("${libs[@]/%//lib/$lib}")
lipo -create "${libs[@]}" -output "$prefix/out/lib/$lib" lipo -create "${libs[@]}" -output "$prefix/out/lib/$lib"
fi fi
done done
;; ;;
'android') 'android')
for arch; do for arch in "${archs[@]}"; do
local abi=$arch local abi=$arch
case "$arch" in case "$arch" in
'arm') abi='armeabi-v7a' ;; 'arm') abi='armeabi-v7a' ;;

8
lib/bin/build_libjson-c-linux Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
source "${BASH_SOURCE%/*}/build_lib"
autoreconf() {
command autoreconf -Iautoconf-archive/m4 "$@"
}
build libjson-c linux

4
lib/bin/build_libsodium-linux Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
source "${BASH_SOURCE%/*}/build_lib"
build libsodium linux

Binary file not shown.