make interfaces-and-libraries.sh work with spaces in source path name

Now that it's a separate script, people might invoke it with more varied paths.
This commit is contained in:
Wolfgang Thaller 2019-08-17 21:35:52 +02:00
parent f564cc05bb
commit e6ba1bf012
3 changed files with 36 additions and 35 deletions

View File

@ -171,7 +171,7 @@ function setUpInterfacesAndLibraries()
if [ $BUILD_68K != false ]; then if [ $BUILD_68K != false ]; then
echo "Converting 68K static libraries..." echo "Converting 68K static libraries..."
for macobj in "${M68KLIBRARIES}/"*.o; do for macobj in "${M68KLIBRARIES}/"*.o; do
if [ -r $macobj ]; then if [ -r "$macobj" ]; then
libname=`basename "$macobj"` libname=`basename "$macobj"`
libname=${libname%.o} libname=${libname%.o}
printf " %30s => %-30s\n" ${libname}.o lib${libname}.a printf " %30s => %-30s\n" ${libname}.o lib${libname}.a
@ -203,17 +203,17 @@ function setUpInterfacesAndLibraries()
;; ;;
esac esac
if [ -d ${PPCLIBRARIES} ]; then if [ -d "${PPCLIBRARIES}" ]; then
echo "Copying static PPC libraries" echo "Copying static PPC libraries"
for obj in ${PPCLIBRARIES}/OpenT*.o ${PPCLIBRARIES}/CarbonAccessors.o ${PPCLIBRARIES}/CursorDevicesGlue.o; do for obj in "${PPCLIBRARIES}/OpenT*.o" "${PPCLIBRARIES}/CarbonAccessors.o" "${PPCLIBRARIES}/CursorDevicesGlue.o"; do
if [ -r $obj ]; then if [ -r "$obj" ]; then
# copy the library: # copy the library:
cp $obj $PREFIX/powerpc-apple-macos/lib/ cp "$obj" "$PREFIX/powerpc-apple-macos/lib/"
# and wrap it in a .a archive for convenience # and wrap it in a .a archive for convenience
lib=$PREFIX/powerpc-apple-macos/lib/lib`basename "${obj%.o}"`.a lib="$PREFIX"/powerpc-apple-macos/lib/lib`basename "${obj%.o}"`.a
rm -f $lib rm -f "$lib"
$PREFIX/bin/powerpc-apple-macos-ar cqs $lib $obj powerpc-apple-macos-ar cqs "$lib" "$obj"
fi fi
done done
fi fi
@ -228,12 +228,13 @@ if [ "$0" = "$BASH_SOURCE" ]; then
exit 1 exit 1
fi fi
PREFIX=$1 PREFIX="$1"
INTERFACES_DIR=$2 INTERFACES_DIR="$2"
BUILD_68K=${3:-true} BUILD_68K=${3:-true}
BUILD_PPC=${4:-true} BUILD_PPC=${4:-true}
BUILD_CARBON=${5:-true} BUILD_CARBON=${5:-true}
SRC=$(cd `dirname $0` && pwd -P) SRC=$(cd `dirname $0` && pwd -P)
export PATH="$PREFIX/bin:$PATH"
locateAndCheckInterfacesAndLibraries locateAndCheckInterfacesAndLibraries
setUpInterfacesAndLibraries setUpInterfacesAndLibraries

View File

@ -1,10 +1,10 @@
IN=$1 IN="$1"
OUT=$2 OUT="$2"
# Make Mac OS X's tr and sed not complain that the files are not UTF-8 # Make Mac OS X's tr and sed not complain that the files are not UTF-8
export LC_ALL=C export LC_ALL=C
for file in $(cd $IN; ls *.h); do for file in $(cd "$IN"; ls *.h); do
# Filter by file names. # Filter by file names.
# Some CIncludes packages include the MPW standard library. # Some CIncludes packages include the MPW standard library.
# Header files from that standard library would overwrite # Header files from that standard library would overwrite
@ -52,12 +52,12 @@ for file in $(cd $IN; ls *.h); do
esac esac
if [ $USE = true ]; then if [ $USE = true ]; then
sed 's/\r$//' < $IN/$file | tr '\r' '\n' > $OUT/$file sed 's/\r$//' < "$IN/$file" | tr '\r' '\n' > "$OUT/$file"
fi fi
done done
############################# ConditionalMacros.h ############################# ############################# ConditionalMacros.h #############################
cat > $OUT/ConditionalMacros.h <<END_MARKER cat > "$OUT/ConditionalMacros.h" <<END_MARKER
#ifndef __CONDITIONALMACROS__WRAP__ #ifndef __CONDITIONALMACROS__WRAP__
#define __CONDITIONALMACROS__WRAP__ #define __CONDITIONALMACROS__WRAP__
@ -84,18 +84,18 @@ cat > $OUT/ConditionalMacros.h <<END_MARKER
#define __DEBUGGING__ /* HACK: Disable Debugging.h because its vdprintf conflicts with stdio.h */ #define __DEBUGGING__ /* HACK: Disable Debugging.h because its vdprintf conflicts with stdio.h */
END_MARKER END_MARKER
sed 's/\r$//' < $IN/ConditionalMacros.h | tr '\r' '\n' | sed 's/__GNUC__/__GNUC_DISABLED__/g' >> $OUT/ConditionalMacros.h sed 's/\r$//' < "$IN/ConditionalMacros.h" | tr '\r' '\n' | sed 's/__GNUC__/__GNUC_DISABLED__/g' >> "$OUT/ConditionalMacros.h"
cat >> $OUT/ConditionalMacros.h <<END_MARKER cat >> "$OUT/ConditionalMacros.h" <<END_MARKER
#endif /* __CONDITIONALMACROS__WRAP__ */ #endif /* __CONDITIONALMACROS__WRAP__ */
END_MARKER END_MARKER
############################# fp.h ############################# ############################# fp.h #############################
if [ -r $IN/fp.h ]; then if [ -r "$IN/fp.h" ]; then
cat > $OUT/fp.h <<END_MARKER cat > "$OUT/fp.h" <<END_MARKER
#ifndef __FP__WRAP__ #ifndef __FP__WRAP__
#define __FP__WRAP__ #define __FP__WRAP__
@ -123,11 +123,11 @@ END_MARKER
fi fi
############################# MixedMode.h ############################# ############################# MixedMode.h #############################
sed 's/\r$//' < $IN/MixedMode.h | tr '\r' '\n' | sed 's/Opaque\#\#name\#\#\*/Opaque\#\#name \*/g' > $OUT/MixedMode.h sed 's/\r$//' < "$IN/MixedMode.h" | tr '\r' '\n' | sed 's/Opaque\#\#name\#\#\*/Opaque\#\#name \*/g' > "$OUT/MixedMode.h"
############################# CGBase.h ############################# ############################# CGBase.h #############################
if [ -r $IN/CGBase.h ]; then if [ -r "$IN/CGBase.h" ]; then
cat > $OUT/CGBase.h <<END_MARKER cat > "$OUT/CGBase.h" <<END_MARKER
#ifndef __CGBASE__WRAP__ #ifndef __CGBASE__WRAP__
#define __CGBASE__WRAP__ #define __CGBASE__WRAP__
@ -144,9 +144,9 @@ cat > $OUT/CGBase.h <<END_MARKER
END_MARKER END_MARKER
sed 's/\r$//' < $IN/CGBase.h | tr '\r' '\n' >> $OUT/CGBase.h sed 's/\r$//' < "$IN/CGBase.h" | tr '\r' '\n' >> "$OUT/CGBase.h"
cat >> $OUT/CGBase.h <<END_MARKER cat >> "$OUT/CGBase.h" <<END_MARKER
#undef u_int32_t __cgbase_incompatible_u_int32_t #undef u_int32_t __cgbase_incompatible_u_int32_t
@ -158,16 +158,16 @@ END_MARKER
fi fi
for f in Types.h Memory.h Windows.h Errors.h; do for f in Types.h Memory.h Windows.h Errors.h; do
if [ ! -r $IN/$f ]; then if [ ! -r "$IN/$f" ]; then
echo "#include \"Mac$f\"" > $OUT/$f echo "#include \"Mac$f\"" > "$OUT/$f"
elif [ ! -r $IN/Mac$f ]; then elif [ ! -r "$IN/Mac$f" ]; then
echo "#include \"$f\"" > $OUT/Mac$f echo "#include \"$f\"" > "$OUT/Mac$f"
fi fi
done done
if [ -d $IN/CoreFoundation ]; then if [ -d "$IN/CoreFoundation" ]; then
mkdir -p $OUT/CoreFoundation mkdir -p "$OUT/CoreFoundation"
for file in $(cd $IN; ls CoreFoundation/*.h); do for file in $(cd "$IN"; ls CoreFoundation/*.h); do
sed 's/\r$//' < $IN/$file | tr '\r' '\n' > $OUT/$file sed 's/\r$//' < "$IN/$file" | tr '\r' '\n' > "$OUT/$file"
done done
fi fi

View File

@ -1,11 +1,11 @@
IN=$1 IN="$1"
OUT=$2 OUT="$2"
# Make Mac OS X's tr and sed not complain that the files are not UTF-8 # Make Mac OS X's tr and sed not complain that the files are not UTF-8
export LC_ALL=C export LC_ALL=C
# cp $IN/[A-Z]*.r $OUT/ # cp $IN/[A-Z]*.r $OUT/
for file in $(cd $IN; ls [A-Z]*.r); do for file in $(cd "$IN"; ls [A-Z]*.r); do
tr '\r' '\n' < $IN/$file > $OUT/$file tr '\r' '\n' < $IN/$file > $OUT/$file
done done