mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-01 11:52:47 +00:00
automatically build multiversal interfaces
This commit is contained in:
parent
720d353686
commit
1f59b5f87f
@ -332,7 +332,11 @@ export PATH=$PREFIX/bin:$PATH
|
|||||||
|
|
||||||
##################### Set up Interfaces & Libraries
|
##################### Set up Interfaces & Libraries
|
||||||
|
|
||||||
|
(cd "${SRC}/multiversal" && ruby make-multiverse.rb -G CIncludes -o "${PREFIX}/multiversal")
|
||||||
|
mkdir -p "${PREFIX}/multiversal/libppc"
|
||||||
|
cp "${SRC}/ImportLibraries"/*.a "${PREFIX}/multiversal/libppc/"
|
||||||
setUpInterfacesAndLibraries
|
setUpInterfacesAndLibraries
|
||||||
|
linkInterfacesAndLibraries universal
|
||||||
|
|
||||||
##################### Build target libraries and samples
|
##################### Build target libraries and samples
|
||||||
|
|
||||||
|
@ -137,86 +137,104 @@ function locateAndCheckInterfacesAndLibraries()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove old symlinks in $PREFIX/*-apple-macos/include/
|
|
||||||
# and link files from $PREFIX/CIncludes
|
function linkThings()
|
||||||
function linkHeaders()
|
{
|
||||||
|
FROM="$1"
|
||||||
|
TO="$2"
|
||||||
|
PATTERN="$3"
|
||||||
|
|
||||||
|
mkdir -p "$TO"
|
||||||
|
(cd "$TO" && find "$FROM" -name "$PATTERN" -exec ln -s {} . \;)
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeConflictingHeaders()
|
||||||
{
|
{
|
||||||
# On case-insensitive file systems, there will be some conflicts with
|
# On case-insensitive file systems, there will be some conflicts with
|
||||||
# newlib. For now, universal interfaces get the right of way.
|
# newlib. For now, universal interfaces get the right of way.
|
||||||
rm -f "$1/Threads.h" # thread.h: does not currently work anyways
|
rm -f "$2/Threads.h" # thread.h: does not currently work anyways
|
||||||
rm -f "$1/Memory.h" # memory.h: non-standard aliasof string.h
|
rm -f "$2/Memory.h" # memory.h: non-standard aliasof string.h
|
||||||
rm -f "$1/Strings.h" # strings.h: traditional bsd string functions
|
rm -f "$2/Strings.h" # strings.h: traditional bsd string functions
|
||||||
|
|
||||||
(cd "$1" && find "../../CIncludes" -name '*.h' -exec ln -s {} . \;)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlinkHeaders()
|
|
||||||
|
function unlinkThings()
|
||||||
{
|
{
|
||||||
for file in "$1/"*; do
|
for file in "$1/"*; do
|
||||||
if [[ `readlink "$file"` == ../../CIncludes/* ]]; then
|
if [[ `readlink "$file"` == $2/* ]]; then
|
||||||
rm "$file"
|
rm "$file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUpInterfacesAndLibraries()
|
function linkInterfacesAndLibraries()
|
||||||
{
|
{
|
||||||
echo "Preparing CIncludes..."
|
linkThings "../$1/RIncludes" "$PREFIX/RIncludes" "*.r"
|
||||||
rm -rf "$PREFIX/CIncludes"
|
|
||||||
mkdir "$PREFIX/CIncludes"
|
|
||||||
sh "$SRC/prepare-headers.sh" "$CINCLUDES" "$PREFIX/CIncludes"
|
|
||||||
|
|
||||||
echo "Preparing RIncludes..."
|
|
||||||
mkdir -p "$PREFIX/RIncludes"
|
|
||||||
find "$PREFIX/RIncludes" ! -name 'Retro*.r' -type f -exec rm -f {} \;
|
|
||||||
sh "$SRC/prepare-rincludes.sh" "$RINCLUDES" "$PREFIX/RIncludes"
|
|
||||||
|
|
||||||
echo "Creating Symlinks for CIncludes and RIncludes..."
|
|
||||||
|
|
||||||
if [ $BUILD_68K != false ]; then
|
if [ $BUILD_68K != false ]; then
|
||||||
ln -sf ../RIncludes $PREFIX/m68k-apple-macos/RIncludes
|
ln -sf ../RIncludes "$PREFIX/m68k-apple-macos/RIncludes"
|
||||||
linkHeaders $PREFIX/m68k-apple-macos/include
|
removeConflictingHeaders "$PREFIX/m68k-apple-macos/include"
|
||||||
|
linkThings "../../$1/CIncludes" "$PREFIX/m68k-apple-macos/include" "*.h"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $BUILD_PPC != false ]; then
|
if [ $BUILD_PPC != false ]; then
|
||||||
ln -sf ../RIncludes $PREFIX/powerpc-apple-macos/RIncludes
|
ln -sf ../RIncludes "$PREFIX/powerpc-apple-macos/RIncludes"
|
||||||
linkHeaders $PREFIX/powerpc-apple-macos/include
|
linkThings "../../$1/CIncludes" "$PREFIX/powerpc-apple-macos/include" "*.h"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILE_LIST="$PREFIX/apple-libraries.txt"
|
linkThings "../../$1/lib68k" "$PREFIX/m68k-apple-macos/lib" "*.a"
|
||||||
rm -f "$FILE_LIST"
|
linkThings "../../$1/libppc" "$PREFIX/powerpc-apple-macos/lib" "*.a"
|
||||||
touch "$FILE_LIST"
|
}
|
||||||
|
|
||||||
|
function unlinkInterfacesAndLibraries()
|
||||||
|
{
|
||||||
|
unlinkThings "$PREFIX/RIncludes" "../*/RIncludes"
|
||||||
|
unlinkThings "$PREFIX/m68k-apple-macos/include" "../../*/CIncludes"
|
||||||
|
unlinkThings "$PREFIX/powerpc-apple-macos/include" "../../*/CIncludes"
|
||||||
|
unlinkThings "$PREFIX/m68k-apple-macos/lib" "../../*/lib68k"
|
||||||
|
unlinkThings "$PREFIX/powerpc-apple-macos/lib" "../../*/libppc"
|
||||||
|
rm -f "$PREFIX/m68k-apple-macos/RIncludes"
|
||||||
|
rm -f "$PREFIX/powerpc-apple-macos/RIncludes"
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUpInterfacesAndLibraries()
|
||||||
|
{
|
||||||
|
rm -rf "$PREFIX/universal"
|
||||||
|
mkdir "$PREFIX/universal"
|
||||||
|
|
||||||
|
echo "Preparing CIncludes..."
|
||||||
|
mkdir "$PREFIX/universal/CIncludes"
|
||||||
|
sh "$SRC/prepare-headers.sh" "$CINCLUDES" "$PREFIX/universal/CIncludes"
|
||||||
|
|
||||||
|
echo "Preparing RIncludes..."
|
||||||
|
mkdir "$PREFIX/universal/RIncludes"
|
||||||
|
sh "$SRC/prepare-rincludes.sh" "$RINCLUDES" "$PREFIX/universal/RIncludes"
|
||||||
|
|
||||||
if [ $BUILD_68K != false ]; then
|
if [ $BUILD_68K != false ]; then
|
||||||
echo "Converting 68K static libraries..."
|
echo "Converting 68K static libraries..."
|
||||||
|
mkdir -p "$PREFIX/universal/lib68k"
|
||||||
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
|
||||||
asm="$PREFIX/m68k-apple-macos/lib/$libname.s"
|
asm="$PREFIX/universal/lib68k/$libname.s"
|
||||||
obj="$PREFIX/m68k-apple-macos/lib/$libname.o"
|
obj="$PREFIX/universal/lib68k/$libname.o"
|
||||||
lib="$PREFIX/m68k-apple-macos/lib/lib${libname}.a"
|
lib="$PREFIX/universal/lib68k/lib${libname}.a"
|
||||||
|
|
||||||
rm -f $lib
|
rm -f $lib
|
||||||
|
|
||||||
if ConvertObj "$macobj" > "$asm"; then
|
if ConvertObj "$macobj" > "$asm"; then
|
||||||
m68k-apple-macos-as "$asm" -o "$obj"
|
m68k-apple-macos-as "$asm" -o "$obj"
|
||||||
m68k-apple-macos-ar cqs "$lib" "$obj"
|
m68k-apple-macos-ar cqs "$lib" "$obj"
|
||||||
echo "m68k-apple-macos/lib/$libname.o" >> "$FILE_LIST"
|
|
||||||
echo "m68k-apple-macos/lib/lib${libname}.a" >> "$FILE_LIST"
|
|
||||||
fi
|
fi
|
||||||
rm -f "$asm"
|
rm -f "$asm"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for lib in "${M68KLIBRARIES}/"lib*.a; do
|
|
||||||
libname=`basename "$lib"`
|
|
||||||
cp $lib "$PREFIX/m68k-apple-macos/lib/"
|
|
||||||
echo "m68k-apple-macos/lib/${libname}" >> "$FILE_LIST"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $BUILD_PPC != false ]; then
|
if [ $BUILD_PPC != false ]; then
|
||||||
|
mkdir -p "$PREFIX/universal/libppc"
|
||||||
case `ResInfo -n "$INTERFACELIB" > /dev/null || echo 0` in
|
case `ResInfo -n "$INTERFACELIB" > /dev/null || echo 0` in
|
||||||
0)
|
0)
|
||||||
if [ -n "$INTERFACELIB" ]; then
|
if [ -n "$INTERFACELIB" ]; then
|
||||||
@ -224,7 +242,7 @@ function setUpInterfacesAndLibraries()
|
|||||||
echo " Falling back to included import libraries."
|
echo " Falling back to included import libraries."
|
||||||
fi
|
fi
|
||||||
echo "Copying readymade PowerPC import libraries..."
|
echo "Copying readymade PowerPC import libraries..."
|
||||||
cp $SRC/ImportLibraries/*.a $PREFIX/powerpc-apple-macos/lib/
|
cp $PREFIX/multiversal/libppc/*.a $PREFIX/universal/libppc/
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Building PowerPC import libraries..."
|
echo "Building PowerPC import libraries..."
|
||||||
@ -232,8 +250,7 @@ function setUpInterfacesAndLibraries()
|
|||||||
libname=`basename "$shlib"`
|
libname=`basename "$shlib"`
|
||||||
implib=lib${libname}.a
|
implib=lib${libname}.a
|
||||||
printf " %30s => %-30s\n" ${libname} ${implib}
|
printf " %30s => %-30s\n" ${libname} ${implib}
|
||||||
MakeImport "$shlib" "$PREFIX/powerpc-apple-macos/lib/$implib" \
|
MakeImport "$shlib" "$PREFIX/universal/libppc/$implib" || true
|
||||||
&& echo "powerpc-apple-macos/lib/$implib" >> "$FILE_LIST"
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -243,14 +260,12 @@ function setUpInterfacesAndLibraries()
|
|||||||
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/universal/libppc/"
|
||||||
basename=`basename "${obj%.o}"`
|
basename=`basename "${obj%.o}"`
|
||||||
# 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.a
|
lib="$PREFIX"/universal/libppc/lib$basename.a
|
||||||
rm -f "$lib"
|
rm -f "$lib"
|
||||||
powerpc-apple-macos-ar cqs "$lib" "$obj"
|
powerpc-apple-macos-ar cqs "$lib" "$obj"
|
||||||
echo "powerpc-apple-macos/lib/$basename.o" >> "$FILE_LIST"
|
|
||||||
echo "powerpc-apple-macos/lib/lib$basename.a" >> "$FILE_LIST"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -259,20 +274,8 @@ function setUpInterfacesAndLibraries()
|
|||||||
|
|
||||||
function removeInterfacesAndLibraries()
|
function removeInterfacesAndLibraries()
|
||||||
{
|
{
|
||||||
FILE_LIST="$PREFIX/apple-libraries.txt"
|
unlinkInterfacesAndLibraries
|
||||||
if [ -r "$FILE_LIST" ]; then
|
rm -rf "$PREFIX/universal"
|
||||||
echo "Removing currently installed Apple Interfaces and Libraries..."
|
|
||||||
for file in `cat "$FILE_LIST"`; do
|
|
||||||
rm -f "$PREFIX/$file"
|
|
||||||
done
|
|
||||||
unlinkHeaders "$PREFIX/m68k-apple-macos/include"
|
|
||||||
unlinkHeaders "$PREFIX/powerpc-apple-macos/include"
|
|
||||||
rm -f "$PREFIX/m68k-apple-macos/RIncludes"
|
|
||||||
rm -f "$PREFIX/powerpc-apple-macos/RIncludes"
|
|
||||||
rm -rf "$PREFIX/CIncludes"
|
|
||||||
find "$PREFIX/RIncludes" ! -name 'Retro*.r' -type f -exec rm -f {} \;
|
|
||||||
rm -f "$FILE_LIST"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (return 0 2>/dev/null); then
|
if (return 0 2>/dev/null); then
|
||||||
@ -297,9 +300,18 @@ else
|
|||||||
|
|
||||||
if [ "${INTERFACES_DIR}" = "--remove" ]; then
|
if [ "${INTERFACES_DIR}" = "--remove" ]; then
|
||||||
removeInterfacesAndLibraries
|
removeInterfacesAndLibraries
|
||||||
|
elif [ "${INTERFACES_DIR}" = "--unlink" ]; then
|
||||||
|
unlinkInterfacesAndLibraries
|
||||||
|
elif [ "${INTERFACES_DIR}" = "--multiversal" ]; then
|
||||||
|
unlinkInterfacesAndLibraries
|
||||||
|
linkInterfacesAndLibraries "multiversal"
|
||||||
|
elif [ "${INTERFACES_DIR}" = "--universal" ]; then
|
||||||
|
unlinkInterfacesAndLibraries
|
||||||
|
linkInterfacesAndLibraries "universal"
|
||||||
else
|
else
|
||||||
locateAndCheckInterfacesAndLibraries
|
locateAndCheckInterfacesAndLibraries
|
||||||
removeInterfacesAndLibraries
|
removeInterfacesAndLibraries
|
||||||
setUpInterfacesAndLibraries
|
setUpInterfacesAndLibraries
|
||||||
|
linkInterfacesAndLibraries "universal"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit f2e36c1b9c1122a3489107355b5ab57b06e813b7
|
Subproject commit 4484dc64227508484043151a2dee89a24c58bb98
|
Loading…
Reference in New Issue
Block a user