2
0

Move library builds into /lib so they can be shared.

Also made the library build script more generic.
This commit is contained in:
Maarten Billemont 2018-05-20 14:24:58 -04:00
parent f41f07f0ae
commit e12e14ef03
15 changed files with 325 additions and 346 deletions

8
.gitmodules vendored
View File

@ -19,11 +19,11 @@
[submodule "MasterPassword/Web/js/mpw-js"] [submodule "MasterPassword/Web/js/mpw-js"]
path = platform-independent/web-js/js/mpw-js path = platform-independent/web-js/js/mpw-js
url = https://github.com/tmthrgd/mpw-js.git url = https://github.com/tmthrgd/mpw-js.git
[submodule "platform-darwin/External/libsodium"] [submodule "lib/libsodium"]
path = platform-darwin/External/libsodium path = lib/libsodium
url = https://github.com/jedisct1/libsodium.git url = https://github.com/jedisct1/libsodium.git
[submodule "platform-darwin/External/libjson-c"] [submodule "lib/libjson-c"]
path = platform-darwin/External/libjson-c path = lib/libjson-c
url = https://github.com/lhunath/json-c.git url = https://github.com/lhunath/json-c.git
[submodule "public/site"] [submodule "public/site"]
path = public/site path = public/site

242
lib/bin/build_lib Executable file
View File

@ -0,0 +1,242 @@
#!/usr/bin/env bash
#
# Your build script should simply source this script, optionally override any build hooks and then invoke `build`.
# The build product should be available under `build-<platform>~/out`, under the library path.
#
# Hook lifecycle:
# - build
# - initialize
# - needs
# - clean
# - prepare
# - target
# - prepare
# - configure
# - build
# - finalize
# - merge
# - clean
#
# You can override any of these hooks to provide a custom implementation or call their underscore variant to delegate to the default implementation.
# For example:
# target_prepare() { make -s distclean; }
# target_configure() { _target_configure "$@" --enable-minimal; }
set -e
# needs <binary> ...
#
# Utility for ensuring all tools needed by the script are installed prior to starting.
needs() { _needs "$@"; }
_needs() {
local failed=0
for tool; do
hash "$tool" || { echo >&2 "Missing: $tool. Please install this tool."; (( failed++ )); }
done
return $failed
}
# initialize <prefix>
#
# The build script invokes this once prior to all other actions if the user wants a clean slate.
initialize() { _initialize "$@"; }
_initialize() {
initialize_needs "$@"
initialize_clean "$@"
}
# initialize_needs <prefix>
#
# Check if all tools needed for the default implementations are available.
#
# By default, this will check for `automake` and `autoreconf`.
initialize_needs() { _initialize_needs "$@"; }
_initialize_needs() {
needs automake autoreconf
}
# initialize_clean <prefix>
#
# Perform any necessary clean-up of the library code prior to building.
#
# By default, this will run `make distclean`.
initialize_clean() { _initialize_clean "$@"; }
_initialize_clean() {
[[ ! -e Makefile ]] || make -s distclean
}
# prepare <prefix> [<arch> ...]
#
# Configure the library for building the <arch>s on this machine.
# The build script invokes this once prior to building each of its targets.
# The <prefix> has been newly created.
#
# By default, this will run `autoreconf`.
prepare() { _prepare "$@"; }
_prepare() {
local prefix=$1; shift 1
autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /')
}
# target <prefix> <arch> <platform>
#
# Build the library for the given <arch> and <platform> into the given <prefix>.
# The build script invokes this function when it's ready to build the library's code.
# Generic platform-specific environment setup has been done.
target() { _target "$@"; }
_target() {
target_prepare "$@"
target_configure "$@"
target_build "$@"
}
# target_prepare <prefix> <arch> <platform>
#
# Prepare the library configuration for building the target.
#
# By default, this will run `make clean` if a Makefile is found.
target_prepare() { _target_prepare "$@"; }
_target_prepare() {
local prefix=$1 arch=$2 platform=$3; shift 3
[[ ! -e Makefile ]] || make -s clean
}
# target_configure <prefix> <arch> <platform> [<args> ...]
#
# Configure the library for building the target.
#
# By default, this will run `./configure --host=<cpu> --prefix=<prefix>/<arch> --disable-shared <args>`.
target_configure() { _target_configure "$@"; }
_target_configure() {
local prefix=$1 arch=$2 platform=$3 cpu=$arch; shift 3
[[ $cpu = *arm* ]] && cpu=arm
./configure ${cpu:+--host="$cpu"} --prefix="$prefix/$arch" --disable-shared "$@"
}
# target_build <prefix> <arch> <platform>
#
# Build the library code for the target.
#
# By default, this will run `make check install`.
target_build() { _target_build "$@"; }
_target_build() {
local prefix=$1 arch=$2 platform=$3; shift 3
#make -j3 check
make -j3 install
}
# finalize <prefix> [ <arch> ... ]
#
# Prepare the final build product.
# The build script invokes this once after a successful build of all targets.
finalize() { _finalize "$@"; }
_finalize() {
finalize_merge "$@"
finalize_clean "$@"
}
# finalize_merge <prefix> [ <arch> ... ]
#
# Merge all targets into a product the application can use, available at `<prefix>/out`.
#
# By default, this will copy the headers to `<prefix>/out/include` and merge the libraries into `<prefix>/out/lib`.
finalize_merge() { _finalize_merge "$@"; }
_finalize_merge() {
local prefix=$1; shift 1
mv -f -- "$prefix/$1/include" "$prefix/out/"
mkdir -p "$prefix/out/lib"
for lib in "$prefix/$1/lib/"*; do
if lipo -info "$lib" >/dev/null 2>&1; then
local lib=("${lib##*/}") libs=("${@/#/$prefix/}") libs=("${libs[@]/%//lib/$lib}")
lipo -create "${libs[@]}" -output "$prefix/out/lib/$lib"
fi
done
}
# finalize_clean <prefix> [ <arch> ... ]
#
# Clean up the library after a successful build (eg. housekeeping of temporary files).
#
# By default, this will run `make distclean`.
finalize_clean() { _finalize_clean "$@"; }
_finalize_clean() {
[[ ! -e Makefile ]] || make -s distclean
}
# build <name> [<platform>]
#
# Build the library <name> (found at ../<name>) for platform <platform> (or "host" if unspecified).
build() { _build "$@"; }
_build() {
local name=$1 platform=${2:-host}
local path="../$name"
[[ $path = /* ]] || path="${BASH_SOURCE%/*}/$path"
cd "$path"
if [[ $platform = host ]]; then
case "$(uname -s)" in
'Darwin') platform='macos' archs=( "$(uname -m)" ) ;;
esac
fi
if (( ! ${#archs[@]} )); then
case "$platform" in
'macos') archs=( 'x86_64' ) ;;
'ios') archs=( 'i386' 'x86_64' 'armv7' 'armv7s' 'arm64' ) ;;
esac
fi
local prefix="$PWD/build-$platform~"
initialize "$prefix"
# "clean" argument wipes the prefix and exits. If lib exists in prefix, skip build.
if [[ ${BASH_ARGV[@]:(-1)} = clean ]]; then
rm -rf "$prefix"
exit
elif files=( "$prefix"/out/lib/* ) && [[ -e $files ]]; then
echo >&2 "Output product already exists: ${files[*]}. Skipping build."
exit
fi
# Prepare the output location and build configuration.
mkdir -p "$prefix/out"
prepare "$prefix" "${archs[@]}"
# Repeat the build for each individual architecture.
for arch in "${archs[@]}"; do (
# Set up a base environment for the platform.
case "$platform" in
'macos')
SDKROOT="$(xcrun --show-sdk-path --sdk macosx)"
export PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH"
export CFLAGS="-arch $arch -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -flto -g $CFLAGS"
export LDFLAGS="-arch $arch -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
;;
'ios')
if [[ $arch = *arm* ]]; then
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
export PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch $arch -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -flto -g $CFLAGS"
export LDFLAGS="-mthumb -arch $arch -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
else
SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)"
export PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH"
export CFLAGS="-arch $arch -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -flto -g $CFLAGS"
export LDFLAGS="-arch $arch -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
fi
;;
esac
target "$prefix" "$arch" "$platform"
); done
finalize "$prefix" "${archs[@]}"
}

8
lib/bin/build_libjson-c-ios 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 ios

8
lib/bin/build_libjson-c-macos 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 macos

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

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

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

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

View File

@ -1789,7 +1789,7 @@
DA0979151E9A81EE00F0BFE8 /* lib */, DA0979151E9A81EE00F0BFE8 /* lib */,
); );
name = "libsodium-ios"; name = "libsodium-ios";
path = "libsodium/libsodium-ios"; path = "../../lib/libsodium/build-ios~/out";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DA0978D91E9A81EE00F0BFE8 /* include */ = { DA0978D91E9A81EE00F0BFE8 /* include */ = {
@ -2128,7 +2128,7 @@
DAB7AE751F3D755B00C856B1 /* lib */, DAB7AE751F3D755B00C856B1 /* lib */,
); );
name = "libjson-c-ios"; name = "libjson-c-ios";
path = "libjson-c/libjson-c-ios"; path = "../../lib/libjson-c/build-ios~/out";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DAB7AE5F1F3D755B00C856B1 /* include */ = { DAB7AE5F1F3D755B00C856B1 /* include */ = {
@ -3389,7 +3389,7 @@
buildConfigurationList = DAB7AE411F3D464A00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-ios" */; buildConfigurationList = DAB7AE411F3D464A00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-ios" */;
buildPhases = ( buildPhases = (
); );
buildToolPath = "Scripts/build_libjson-c-ios"; buildToolPath = "../lib/bin/build_libjson-c-ios";
buildWorkingDirectory = ""; buildWorkingDirectory = "";
dependencies = ( dependencies = (
); );
@ -3403,7 +3403,8 @@
buildConfigurationList = DAB7AE481F3D468300C856B1 /* Build configuration list for PBXLegacyTarget "libsodium-ios" */; buildConfigurationList = DAB7AE481F3D468300C856B1 /* Build configuration list for PBXLegacyTarget "libsodium-ios" */;
buildPhases = ( buildPhases = (
); );
buildToolPath = "Scripts/build_libsodium-ios"; buildToolPath = "../lib/bin/build_libsodium-ios";
buildWorkingDirectory = "";
dependencies = ( dependencies = (
); );
name = "libsodium-ios"; name = "libsodium-ios";
@ -4360,8 +4361,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -4685,8 +4686,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -4724,8 +4725,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-ios/lib", "$(PROJECT_DIR)/../lib/libsodium/build-ios~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-ios/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-ios~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",

View File

@ -1203,14 +1203,14 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
DA0979181E9A824700F0BFE8 /* libsodium-osx */ = { DA0979181E9A824700F0BFE8 /* libsodium-macos */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DA0979191E9A824700F0BFE8 /* include */, DA0979191E9A824700F0BFE8 /* include */,
DA0979551E9A824700F0BFE8 /* lib */, DA0979551E9A824700F0BFE8 /* lib */,
); );
name = "libsodium-osx"; name = "libsodium-macos";
path = "libsodium/libsodium-osx"; path = "../../lib/libsodium/build-macos~/out";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DA0979191E9A824700F0BFE8 /* include */ = { DA0979191E9A824700F0BFE8 /* include */ = {
@ -1944,14 +1944,14 @@
path = KCOrderedAccessorFix; path = KCOrderedAccessorFix;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DAB7AE781F3D757B00C856B1 /* libjson-c-osx */ = { DAB7AE781F3D757B00C856B1 /* libjson-c-macos */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DAB7AE791F3D757B00C856B1 /* include */, DAB7AE791F3D757B00C856B1 /* include */,
DAB7AE8F1F3D757B00C856B1 /* lib */, DAB7AE8F1F3D757B00C856B1 /* lib */,
); );
name = "libjson-c-osx"; name = "libjson-c-macos";
path = "libjson-c/libjson-c-osx"; path = "../../lib/libjson-c/build-macos~/out";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
DAB7AE791F3D757B00C856B1 /* include */ = { DAB7AE791F3D757B00C856B1 /* include */ = {
@ -2011,8 +2011,8 @@
DACA22121705DDC5002C6C22 /* External */ = { DACA22121705DDC5002C6C22 /* External */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
DAB7AE781F3D757B00C856B1 /* libjson-c-osx */, DAB7AE781F3D757B00C856B1 /* libjson-c-macos */,
DA0979181E9A824700F0BFE8 /* libsodium-osx */, DA0979181E9A824700F0BFE8 /* libsodium-macos */,
DACA29751705E2BD002C6C22 /* jrswizzle */, DACA29751705E2BD002C6C22 /* jrswizzle */,
DAADCC6819FB007F00987B1D /* KCOrderedAccessorFix */, DAADCC6819FB007F00987B1D /* KCOrderedAccessorFix */,
DA3B8449190FC5A900246EEA /* Mac */, DA3B8449190FC5A900246EEA /* Mac */,
@ -2312,31 +2312,31 @@
/* End PBXHeadersBuildPhase section */ /* End PBXHeadersBuildPhase section */
/* Begin PBXLegacyTarget section */ /* Begin PBXLegacyTarget section */
DA5B0B611F3D416500B663F0 /* libsodium-osx */ = { DA5B0B611F3D416500B663F0 /* libsodium-macos */ = {
isa = PBXLegacyTarget; isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION)"; buildArgumentsString = "$(ACTION)";
buildConfigurationList = DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-osx" */; buildConfigurationList = DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-macos" */;
buildPhases = ( buildPhases = (
); );
buildToolPath = "Scripts/build_libsodium-osx"; buildToolPath = "../lib/bin/build_libsodium-macos";
buildWorkingDirectory = ""; buildWorkingDirectory = "";
dependencies = ( dependencies = (
); );
name = "libsodium-osx"; name = "libsodium-macos";
passBuildSettingsInEnvironment = 1; passBuildSettingsInEnvironment = 1;
productName = "libsodium-osx"; productName = "libsodium-osx";
}; };
DAB7AE421F3D466D00C856B1 /* libjson-c-osx */ = { DAB7AE421F3D466D00C856B1 /* libjson-c-macos */ = {
isa = PBXLegacyTarget; isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION)"; buildArgumentsString = "$(ACTION)";
buildConfigurationList = DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-osx" */; buildConfigurationList = DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-macos" */;
buildPhases = ( buildPhases = (
); );
buildToolPath = "Scripts/build_libjson-c-osx"; buildToolPath = "../lib/bin/build_libjson-c-macos";
buildWorkingDirectory = ""; buildWorkingDirectory = "";
dependencies = ( dependencies = (
); );
name = "libjson-c-osx"; name = "libjson-c-macos";
passBuildSettingsInEnvironment = 1; passBuildSettingsInEnvironment = 1;
productName = "libjson-c"; productName = "libjson-c";
}; };
@ -2553,8 +2553,8 @@
DA67743A1A474A03004F356A /* mpw-test */, DA67743A1A474A03004F356A /* mpw-test */,
DA1C7AC61F1A8FD8009A3551 /* mpw-bench */, DA1C7AC61F1A8FD8009A3551 /* mpw-bench */,
DA1C7AA61F1A8F24009A3551 /* mpw-cli */, DA1C7AA61F1A8F24009A3551 /* mpw-cli */,
DA5B0B611F3D416500B663F0 /* libsodium-osx */, DA5B0B611F3D416500B663F0 /* libsodium-macos */,
DAB7AE421F3D466D00C856B1 /* libjson-c-osx */, DAB7AE421F3D466D00C856B1 /* libjson-c-macos */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
@ -2843,32 +2843,32 @@
/* Begin PBXTargetDependency section */ /* Begin PBXTargetDependency section */
DAB7AE351F3D423600C856B1 /* PBXTargetDependency */ = { DAB7AE351F3D423600C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; target = DA5B0B611F3D416500B663F0 /* libsodium-macos */;
targetProxy = DAB7AE341F3D423600C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE341F3D423600C856B1 /* PBXContainerItemProxy */;
}; };
DAB7AE371F3D423D00C856B1 /* PBXTargetDependency */ = { DAB7AE371F3D423D00C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; target = DA5B0B611F3D416500B663F0 /* libsodium-macos */;
targetProxy = DAB7AE361F3D423D00C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE361F3D423D00C856B1 /* PBXContainerItemProxy */;
}; };
DAB7AE391F3D424200C856B1 /* PBXTargetDependency */ = { DAB7AE391F3D424200C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; target = DA5B0B611F3D416500B663F0 /* libsodium-macos */;
targetProxy = DAB7AE381F3D424200C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE381F3D424200C856B1 /* PBXContainerItemProxy */;
}; };
DAB7AE3B1F3D424700C856B1 /* PBXTargetDependency */ = { DAB7AE3B1F3D424700C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DA5B0B611F3D416500B663F0 /* libsodium-osx */; target = DA5B0B611F3D416500B663F0 /* libsodium-macos */;
targetProxy = DAB7AE3A1F3D424700C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE3A1F3D424700C856B1 /* PBXContainerItemProxy */;
}; };
DAB7AE521F3D649400C856B1 /* PBXTargetDependency */ = { DAB7AE521F3D649400C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DAB7AE421F3D466D00C856B1 /* libjson-c-osx */; target = DAB7AE421F3D466D00C856B1 /* libjson-c-macos */;
targetProxy = DAB7AE511F3D649400C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE511F3D649400C856B1 /* PBXContainerItemProxy */;
}; };
DAB7AE581F3D64A600C856B1 /* PBXTargetDependency */ = { DAB7AE581F3D64A600C856B1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency; isa = PBXTargetDependency;
target = DAB7AE421F3D466D00C856B1 /* libjson-c-osx */; target = DAB7AE421F3D466D00C856B1 /* libjson-c-macos */;
targetProxy = DAB7AE571F3D64A600C856B1 /* PBXContainerItemProxy */; targetProxy = DAB7AE571F3D64A600C856B1 /* PBXContainerItemProxy */;
}; };
DABFA072176E3FDF00E83589 /* PBXTargetDependency */ = { DABFA072176E3FDF00E83589 /* PBXTargetDependency */ = {
@ -3036,8 +3036,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3094,7 +3094,7 @@
); );
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3109,8 +3109,8 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3128,8 +3128,8 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3147,8 +3147,8 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3166,7 +3166,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3182,7 +3182,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3198,7 +3198,7 @@
CLANG_WARN_DOCUMENTATION_COMMENTS = NO; CLANG_WARN_DOCUMENTATION_COMMENTS = NO;
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3499,8 +3499,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3531,8 +3531,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
"$(PROJECT_DIR)/External/libjson-c/libjson-c-osx/lib", "$(PROJECT_DIR)/../lib/libjson-c/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3555,7 +3555,7 @@
); );
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3575,7 +3575,7 @@
); );
LIBRARY_SEARCH_PATHS = ( LIBRARY_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/External/libsodium/libsodium-osx/lib", "$(PROJECT_DIR)/../lib/libsodium/build-macos~/out/lib",
); );
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"-DMPW_SODIUM=1", "-DMPW_SODIUM=1",
@ -3734,7 +3734,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Test; defaultConfigurationName = Test;
}; };
DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-osx" */ = { DA5B0B621F3D416500B663F0 /* Build configuration list for PBXLegacyTarget "libsodium-macos" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
DA5B0B631F3D416500B663F0 /* Debug */, DA5B0B631F3D416500B663F0 /* Debug */,
@ -3784,7 +3784,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Test; defaultConfigurationName = Test;
}; };
DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-osx" */ = { DAB7AE431F3D466D00C856B1 /* Build configuration list for PBXLegacyTarget "libjson-c-macos" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
DAB7AE441F3D466D00C856B1 /* Debug */, DAB7AE441F3D466D00C856B1 /* Debug */,

View File

@ -1,91 +0,0 @@
#!/usr/bin/env bash
set -e
hash automake || { echo >&2 "Missing automake."; exit 1; }
hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; }
hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; }
cd "${BASH_SOURCE%/*}/../External/libjson-c"
[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; }
[[ -e "${prefix=$PWD/libjson-c-ios}/lib/libjson-c.a" ]] && exit
# Prepare
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /')
rm -rf "${prefix=$PWD/libjson-c-ios}"
mkdir -p "$prefix/lib" \
"${prefix_i386=$prefix/tmp/i386}" \
"${prefix_x86_64=$prefix/tmp/x86_64}" \
"${prefix_armv7=$prefix/tmp/armv7}" \
"${prefix_armv7s=$prefix/tmp/armv7s}" \
"${prefix_arm64=$prefix/tmp/arm64}"
# Targets
(
## ARCH: i386
SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH"
export CFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS"
export LDFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --host=i686-apple --disable-shared --prefix="$prefix_i386"
make -j3 install
)
(
## ARCH: x86_64
SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH"
export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS"
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --host=x86_64-apple --disable-shared --prefix="$prefix_x86_64"
make -j3 install
)
(
## ARCH: armv7
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS"
export LDFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_armv7"
make -j3 install
)
(
## ARCH: armv7s
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS"
export LDFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_armv7s"
make -j3 install
)
(
## ARCH: arm64
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g $CFLAGS"
export LDFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --prefix="$prefix_arm64"
make -j3 install
)
# Merge Binaries
mv -f -- "$prefix_arm64/include" "$prefix/"
lipo -create \
"$prefix_i386/lib/libjson-c.a" \
"$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"
# Cleanup
rm -rf -- "$prefix/tmp"
make -s really-clean

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -e
hash automake || { echo >&2 "Missing automake."; exit 1; }
hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; }
hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; }
cd "${BASH_SOURCE%/*}/../External/libjson-c"
[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; }
[[ -e "${prefix=$PWD/libjson-c-osx}/lib/libjson-c.a" ]] && exit
# Prepare
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /')
rm -rf "${prefix=$PWD/libjson-c-osx}"
mkdir -p "$prefix"
# Targets
(
## ARCH: x86_64
SDKROOT="$(xcrun --show-sdk-path --sdk macosx)"
PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH"
export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -g $CFLAGS" # -flto
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} $LDFLAGS" # -flto
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s clean
./configure --disable-shared --prefix="$prefix"
make -j3 check
make -j3 install
)
# Cleanup
make -s really-clean

View File

@ -1,91 +0,0 @@
#!/usr/bin/env bash
set -e
hash automake || { echo >&2 "Missing automake."; exit 1; }
hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; }
hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; }
cd "${BASH_SOURCE%/*}/../External/libsodium"
[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; }
[[ -e "${prefix=$PWD/libsodium-ios}/lib/libsodium.a" ]] && exit
# Prepare
autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /')
rm -rf "${prefix=$PWD/libsodium-ios}"
mkdir -p "$prefix/lib" \
"${prefix_i386=$prefix/tmp/i386}" \
"${prefix_x86_64=$prefix/tmp/x86_64}" \
"${prefix_armv7=$prefix/tmp/armv7}" \
"${prefix_armv7s=$prefix/tmp/armv7s}" \
"${prefix_arm64=$prefix/tmp/arm64}"
# Targets
(
## ARCH: i386
SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH"
export CFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
export LDFLAGS="-arch i386 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --host=i686-apple --disable-shared --enable-minimal --prefix="$prefix_i386"
make -j3 install
)
(
## ARCH: x86_64
SDKROOT="$(xcrun --show-sdk-path --sdk iphonesimulator)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphonesimulator)/usr/bin:$PATH"
export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mios-simulator-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --host=x86_64-apple --disable-shared --enable-minimal --prefix="$prefix_x86_64"
make -j3 install
)
(
## ARCH: armv7
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
export LDFLAGS="-mthumb -arch armv7 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_armv7"
make -j3 install
)
(
## ARCH: armv7s
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
export LDFLAGS="-mthumb -arch armv7s -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_armv7s"
make -j3 install
)
(
## ARCH: arm64
SDKROOT="$(xcrun --show-sdk-path --sdk iphoneos)"
PATH="$(xcrun --show-sdk-platform-path --sdk iphoneos)/usr/bin:$PATH"
export CFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -O2 -g -flto $CFLAGS"
export LDFLAGS="-mthumb -arch arm64 -isysroot $SDKROOT -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET:-8.0} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --host=x86_64-apple --target=arm-apple --disable-shared --enable-minimal --prefix="$prefix_arm64"
make -j3 install
)
# Merge Binaries
mv -f -- "$prefix_arm64/include" "$prefix/"
lipo -create \
"$prefix_i386/lib/libsodium.a" \
"$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"
# Cleanup
rm -rf -- "$prefix/tmp"
make -s distclean

View File

@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -e
hash automake || { echo >&2 "Missing automake."; exit 1; }
hash autoreconf || { echo >&2 "Missing autoconf."; exit 1; }
hash libtool || hash glibtool || { echo >&2 "Missing libtool."; exit 1; }
cd "${BASH_SOURCE%/*}/../External/libsodium"
[[ $1 = clean ]] && { [[ ! -e Makefile ]] || make -s distclean; exit; }
[[ -e "${prefix=$PWD/libsodium-osx}/lib/libsodium.a" ]] && exit
# Inspired by libsodium/dist-build/osx.sh
# Prepare
autoreconf --verbose --install --symlink 2> >(sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /')
rm -rf "${prefix=$PWD/libsodium-osx}"
mkdir -p "$prefix"
# Targets
(
## ARCH: x86_64
SDKROOT="$(xcrun --show-sdk-path --sdk macosx)"
PATH="$(xcrun --show-sdk-platform-path --sdk macosx)/usr/bin:$PATH"
export CFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -O2 -g -flto $CFLAGS"
export LDFLAGS="-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET:-10.8} -flto $LDFLAGS"
export CPPFLAGS="$CFLAGS $CPPFLAGS"
[[ -e Makefile ]] && make -s distclean
./configure --disable-shared --enable-minimal --prefix="$prefix"
make -j3 check
make -j3 install
)
# Cleanup
make -s distclean

View File

@ -1,41 +0,0 @@
#!/usr/bin/env bash
# This script should be in the 'Scripts' directory under the git repository's root.
cd "${BASH_SOURCE%/*}/.."
shopt -s extglob
## Submodules that need to be checked out.
dependencies=( External/{InAppSettingsKit,Pearl{,:External/jrswizzle,:External/uicolor-utilities},RHStatusItemView} )
## Custom migration.
# None yet.
################################################################################
isCheckedOut() {
local modulePath=$1
! git submodule status | grep -q "^-[^ ]* $modulePath"
}
# git submodule sync -- A bug causes this to init ALL external dependencies.
git submodule sync $(git submodule status | awk '/^ / { print $2 }')
# Check out our missing dependencies
for dependency in "${dependencies[@]}"; do
[[ $dependency = *:* ]] && root=${dependency%%:*} || root=.
path=${dependency#*:}
( cd "$root"; git submodule update --init "$path" )
done
# Update our modules
git submodule update
# Our modules may define a custom update script, if so, run it.
find !(Scripts)/ -name "${BASH_SOURCE##*/}" -exec {} \;
# Finally, for our modules that haven't got a custom update script, update them recursively.
git submodule update --recursive --rebase