Update Darwin platform project with solid support for linking libsodium & libjson-c
This commit is contained in:
72
platform-darwin/Scripts/build_libjson-c-ios
Executable file
72
platform-darwin/Scripts/build_libjson-c-ios
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo "ARGS: $*"
|
||||
|
||||
cd "${BASH_SOURCE%/*}/../External/libjson-c"
|
||||
[[ -d libjson-c-ios ]] && exit
|
||||
|
||||
# Prepare
|
||||
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink --force 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
||||
rm -rf "${prefix=$PWD/libjson-c-ios}"
|
||||
mkdir -p "$prefix/lib" \
|
||||
"${prefix_x86_64=$prefix/tmp/x86_64}" \
|
||||
"${prefix_armv7=$prefix/tmp/armv7}" \
|
||||
"${prefix_armv7s=$prefix/tmp/armv7s}" \
|
||||
"${prefix_arm64=$prefix/tmp/arm64}"
|
||||
|
||||
# SDK: iOS Simulator
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk iphonesimulator)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)"
|
||||
(
|
||||
## ARCH: x86_64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-arch x86_64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-arch x86_64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s clean
|
||||
./configure --host=x86_64-apple-darwin10 --disable-shared --prefix="$prefix_x86_64"
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# SDK: iOS Device
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk iphoneos)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk iphoneos)"
|
||||
(
|
||||
## ARCH: armv7
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch armv7 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch armv7 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s clean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_armv7"
|
||||
make -j3 install
|
||||
)
|
||||
(
|
||||
## ARCH: armv7s
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch armv7s -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch armv7s -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s clean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_armv7s"
|
||||
make -j3 install
|
||||
)
|
||||
(
|
||||
## ARCH: arm64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch arm64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch arm64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s clean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_arm64"
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# Merge Binaries
|
||||
lipo -create \
|
||||
"$prefix_x86_64/lib/libjson-c.a" \
|
||||
"$prefix_armv7/lib/libjson-c.a" \
|
||||
"$prefix_armv7s/lib/libjson-c.a" \
|
||||
"$prefix_arm64/lib/libjson-c.a" \
|
||||
-output "$prefix/lib/libjson-c.a"
|
||||
mv -f -- "$prefix_arm64/include" "$prefix/"
|
||||
|
||||
# Cleanup
|
||||
rm -rf -- "$prefix/tmp"
|
||||
make -s clean
|
28
platform-darwin/Scripts/build_libjson-c-osx
Executable file
28
platform-darwin/Scripts/build_libjson-c-osx
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo "ARGS: $*"
|
||||
|
||||
cd "${BASH_SOURCE%/*}/../External/libjson-c"
|
||||
[[ -d libjson-c-osx ]] && exit
|
||||
|
||||
# Prepare
|
||||
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink --force 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
||||
rm -rf "${prefix=$PWD/libjson-c-osx}"
|
||||
mkdir -p "$prefix"
|
||||
|
||||
# SDK: macOS
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk macosx)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk macosx)"
|
||||
(
|
||||
## ARCH: x86_64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-arch x86_64 -isysroot $sdkPath -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-"10.8"} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-arch x86_64 -isysroot $sdkPath -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-"10.8"} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s clean #distclean
|
||||
./configure --disable-shared --prefix="$prefix"
|
||||
make -j3 #check
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# Cleanup
|
||||
make -s clean #distclean
|
73
platform-darwin/Scripts/build_libsodium-ios
Executable file
73
platform-darwin/Scripts/build_libsodium-ios
Executable file
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo "ARGS: $*"
|
||||
|
||||
cd "${BASH_SOURCE%/*}/../External/libsodium"
|
||||
[[ -d libsodium-ios ]] && exit
|
||||
|
||||
# Inspired by libsodium/dist-build/ios.sh
|
||||
# Prepare
|
||||
autoreconf --verbose --install --symlink --force 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
||||
rm -rf "${prefix=$PWD/libsodium-ios}"
|
||||
mkdir -p "$prefix/lib" \
|
||||
"${prefix_x86_64=$prefix/tmp/x86_64}" \
|
||||
"${prefix_armv7=$prefix/tmp/armv7}" \
|
||||
"${prefix_armv7s=$prefix/tmp/armv7s}" \
|
||||
"${prefix_arm64=$prefix/tmp/arm64}"
|
||||
|
||||
# SDK: iOS Simulator
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk iphonesimulator)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)"
|
||||
(
|
||||
## ARCH: x86_64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-arch x86_64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-arch x86_64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s distclean
|
||||
./configure --host=x86_64-apple-darwin10 --disable-shared --prefix="$prefix_x86_64"
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# SDK: iOS Device
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk iphoneos)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk iphoneos)"
|
||||
(
|
||||
## ARCH: armv7
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch armv7 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch armv7 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s distclean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_armv7"
|
||||
make -j3 install
|
||||
)
|
||||
(
|
||||
## ARCH: armv7s
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch armv7s -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch armv7s -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s distclean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_armv7s"
|
||||
make -j3 install
|
||||
)
|
||||
(
|
||||
## ARCH: arm64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-mthumb -arch arm64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-mthumb -arch arm64 -isysroot $sdkPath -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s distclean
|
||||
./configure --host=arm-apple-darwin10 --disable-shared --prefix="$prefix_arm64"
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# Merge Binaries
|
||||
lipo -create \
|
||||
"$prefix_x86_64/lib/libsodium.a" \
|
||||
"$prefix_armv7/lib/libsodium.a" \
|
||||
"$prefix_armv7s/lib/libsodium.a" \
|
||||
"$prefix_arm64/lib/libsodium.a" \
|
||||
-output "$prefix/lib/libsodium.a"
|
||||
mv -f -- "$prefix_arm64/include" "$prefix/"
|
||||
|
||||
# Cleanup
|
||||
rm -rf -- "$prefix/tmp"
|
||||
make -s distclean
|
29
platform-darwin/Scripts/build_libsodium-osx
Executable file
29
platform-darwin/Scripts/build_libsodium-osx
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
echo "ARGS: $*"
|
||||
|
||||
cd "${BASH_SOURCE%/*}/../External/libsodium"
|
||||
[[ -d libsodium-osx ]] && exit
|
||||
|
||||
# Inspired by libsodium/dist-build/osx.sh
|
||||
# Prepare
|
||||
autoreconf --verbose --install --symlink --force 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
|
||||
rm -rf "${prefix=$PWD/libsodium-osx}"
|
||||
mkdir -p "$prefix"
|
||||
|
||||
# SDK: macOS
|
||||
sdkPath="$(xcrun --show-sdk-path --sdk macosx)"
|
||||
platformPath="$(xcrun --show-sdk-platform-path --sdk macosx)"
|
||||
(
|
||||
## ARCH: x86_64
|
||||
export PATH="$platformPath/usr/bin:$platformPath/usr/sbin:$PATH"
|
||||
export CFLAGS="-arch x86_64 -isysroot $sdkPath -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-"10.8"} -O2 -g -flto $CFLAGS"
|
||||
export LDFLAGS="-arch x86_64 -isysroot $sdkPath -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-"10.8"} -flto $LDFLAGS"
|
||||
[[ -e Makefile ]] && make -s distclean
|
||||
./configure --disable-shared --prefix="$prefix"
|
||||
make -j3 check
|
||||
make -j3 install
|
||||
)
|
||||
|
||||
# Cleanup
|
||||
make -s distclean
|
Reference in New Issue
Block a user