2
0

Fix ./build's targets interpretation & other improvements.

This commit is contained in:
Maarten Billemont 2017-09-01 11:16:09 -04:00
parent 9a5e9ced31
commit 060ce61030
7 changed files with 15 additions and 18 deletions

View File

@ -2,7 +2,7 @@
set -e set -e
cd "${BASH_SOURCE%/*}/../External/libjson-c" cd "${BASH_SOURCE%/*}/../External/libjson-c"
[[ -d libjson-c-ios ]] && exit [[ -e "${prefix=$PWD/libjson-c-ios}/lib/libjson-c.a" ]] && exit
# Prepare # Prepare
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /' autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
@ -72,6 +72,7 @@ mkdir -p "$prefix/lib" \
) )
# Merge Binaries # Merge Binaries
mv -f -- "$prefix_arm64/include" "$prefix/"
lipo -create \ lipo -create \
"$prefix_i386/lib/libjson-c.a" \ "$prefix_i386/lib/libjson-c.a" \
"$prefix_x86_64/lib/libjson-c.a" \ "$prefix_x86_64/lib/libjson-c.a" \
@ -79,7 +80,6 @@ lipo -create \
"$prefix_armv7s/lib/libjson-c.a" \ "$prefix_armv7s/lib/libjson-c.a" \
"$prefix_arm64/lib/libjson-c.a" \ "$prefix_arm64/lib/libjson-c.a" \
-output "$prefix/lib/libjson-c.a" -output "$prefix/lib/libjson-c.a"
mv -f -- "$prefix_arm64/include" "$prefix/"
# Cleanup # Cleanup
rm -rf -- "$prefix/tmp" rm -rf -- "$prefix/tmp"

View File

@ -2,7 +2,7 @@
set -e set -e
cd "${BASH_SOURCE%/*}/../External/libjson-c" cd "${BASH_SOURCE%/*}/../External/libjson-c"
[[ -d libjson-c-osx ]] && exit [[ -e "${prefix=$PWD/libjson-c-osx}/lib/libjson-c.a" ]] && exit
# Prepare # Prepare
autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /' autoreconf -Iautoconf-archive/m4 --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'

View File

@ -2,7 +2,7 @@
set -e set -e
cd "${BASH_SOURCE%/*}/../External/libsodium" cd "${BASH_SOURCE%/*}/../External/libsodium"
[[ -d libsodium-ios ]] && exit [[ -e "${prefix=$PWD/libsodium-ios}/lib/libsodium.a" ]] && exit
# Prepare # Prepare
autoreconf --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /' autoreconf --verbose --install --symlink 2>&1 | sed 's/^\([^:]*\):[0-9]\{1,\}: /\1: /'
@ -72,6 +72,7 @@ mkdir -p "$prefix/lib" \
) )
# Merge Binaries # Merge Binaries
mv -f -- "$prefix_arm64/include" "$prefix/"
lipo -create \ lipo -create \
"$prefix_i386/lib/libsodium.a" \ "$prefix_i386/lib/libsodium.a" \
"$prefix_x86_64/lib/libsodium.a" \ "$prefix_x86_64/lib/libsodium.a" \
@ -79,7 +80,6 @@ lipo -create \
"$prefix_armv7s/lib/libsodium.a" \ "$prefix_armv7s/lib/libsodium.a" \
"$prefix_arm64/lib/libsodium.a" \ "$prefix_arm64/lib/libsodium.a" \
-output "$prefix/lib/libsodium.a" -output "$prefix/lib/libsodium.a"
mv -f -- "$prefix_arm64/include" "$prefix/"
# Cleanup # Cleanup
rm -rf -- "$prefix/tmp" rm -rf -- "$prefix/tmp"

View File

@ -2,7 +2,7 @@
set -e set -e
cd "${BASH_SOURCE%/*}/../External/libsodium" cd "${BASH_SOURCE%/*}/../External/libsodium"
[[ -d libsodium-osx ]] && exit [[ -e "${prefix=$PWD/libsodium-osx}/lib/libsodium.a" ]] && exit
# Inspired by libsodium/dist-build/osx.sh # Inspired by libsodium/dist-build/osx.sh
# Prepare # Prepare

View File

@ -197,7 +197,9 @@ use_mpw_xml() {
### BUILD TARGETS ### BUILD TARGETS
for target in "${targets_all[@]}"; do for target in "${targets_all[@]}"; do
if [[ ${targets:-$targets_default} == 'all' || " $target " = *" ${targets:-$targets_default} "* ]]; then echo "target: $target in ' $targets '."
if [[ ${targets:-$targets_default} == 'all' || " ${targets:-$targets_default} " = *" $target "* ]]; then
echo echo
echo "Building target: $target..." echo "Building target: $target..."
( "$target" "$@" ) ( "$target" "$@" )

View File

@ -213,7 +213,7 @@ bool mpw_mkdirs(const char *filePath) {
} }
/** Read until EOF from the given file descriptor. /** Read until EOF from the given file descriptor.
* @return A newly allocated string or NULL the read buffer couldn't be allocated. */ * @return A newly allocated string or NULL if the read buffer couldn't be allocated or an error occurred. */
char *mpw_read_fd(int fd) { char *mpw_read_fd(int fd) {
char *buf = NULL; char *buf = NULL;
@ -222,13 +222,13 @@ char *mpw_read_fd(int fd) {
while ((mpw_realloc( &buf, &bufSize, blockSize )) && while ((mpw_realloc( &buf, &bufSize, blockSize )) &&
((readSize = read( fd, buf + bufOffset, blockSize )) > 0)); ((readSize = read( fd, buf + bufOffset, blockSize )) > 0));
if (readSize == ERR) if (readSize == ERR)
dbg( "While reading: %s\n", strerror( errno ) ); mpw_free( &buf, bufSize );
return buf; return buf;
} }
/** Read the file contents of a given file. /** Read the file contents of a given file.
* @return A newly allocated string or NULL the read buffer couldn't be allocated. */ * @return A newly allocated string or NULL if the read buffer couldn't be allocated. */
char *mpw_read_file(FILE *file) { char *mpw_read_file(FILE *file) {
if (!file) if (!file)

View File

@ -203,14 +203,9 @@ int main(const int argc, char *const argv[]) {
return EX_DATAERR; return EX_DATAERR;
} }
if ((!masterPassword || !strlen( masterPassword )) && masterPasswordFDArg) { if ((!masterPassword || !strlen( masterPassword )) && masterPasswordFDArg) {
FILE *masterPasswordFile = fdopen( atoi( masterPasswordFDArg ), "r" ); masterPassword = mpw_read_fd( atoi( masterPasswordFDArg ) );
if (!masterPasswordFile) if (!masterPassword && errno)
wrn( "Error opening master password FD %s: %s\n", masterPasswordFDArg, strerror( errno ) ); wrn( "Error reading master password from FD %s: %s\n", masterPasswordFDArg, strerror( errno ) );
else {
masterPassword = mpw_read_file( masterPasswordFile );
if (ferror( masterPasswordFile ))
wrn( "Error reading master password from %s: %d\n", masterPasswordFDArg, ferror( masterPasswordFile ) );
}
} }
if ((!masterPassword || !strlen( masterPassword )) && masterPasswordArg) if ((!masterPassword || !strlen( masterPassword )) && masterPasswordArg)
masterPassword = strdup( masterPasswordArg ); masterPassword = strdup( masterPasswordArg );