Last active
December 10, 2018 23:13
-
-
Save mantognini/05460d9b6a8a272ed188 to your computer and use it in GitHub Desktop.
Build ogg, vorbis, vorbisfile, vorbisenc, flac and OpenAL frameworks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
## | |
## build ogg, vorbis, vorbisfile, vorbisenc and flac frameworks | |
## | |
rm -fr build_deps | |
mkdir -p build_deps | |
cd build_deps | |
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz | |
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.xz | |
wget https://svn.xiph.org/releases/flac/flac-1.3.0.tar.xz | |
for archive in *.tar.xz | |
tar -xf $archive | |
end | |
set INSTALL_ROOT (pwd)/install/root | |
mkdir -p $INSTALL_ROOT | |
### OGG | |
pushd libogg* | |
mkdir -p build/1.3.2/i386/root | |
mkdir -p build/1.3.2/x86_64/root | |
mkdir -p build/1.3.2/universal | |
set BASE (pwd)/build/1.3.2/ | |
set PREFIX_32 $BASE/i386/root/ | |
set PREFIX_64 $BASE/x86_64/root/ | |
set SDK_1070 /Developer/SDKs/MacOSX10.7.sdk/ | |
./configure --prefix="$PREFIX_32" --enable-shared=yes --enable-static=no CFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
./configure --prefix="$PREFIX_64" --enable-shared=yes --enable-static=no CFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
cd build/1.3.2/universal | |
cp ../i386/root/lib/libogg.0.dylib libogg.0.dylib.i386 | |
cp ../x86_64/root/lib/libogg.0.dylib libogg.0.dylib.x86_64 | |
lipo libogg.0.dylib.i386 libogg.0.dylib.x86_64 -create -output libogg.0.dylib | |
cp -R ../i386/root/ $INSTALL_ROOT | |
cp libogg.0.dylib $INSTALL_ROOT/lib | |
rm $INSTALL_ROOT/lib/libogg.la | |
file $INSTALL_ROOT/lib/* | |
popd | |
### VORBIS | |
pushd libvorbis* | |
mkdir -p build/1.3.4/i386/root | |
mkdir -p build/1.3.4/x86_64/root | |
mkdir -p build/1.3.4/universal | |
set OGG_ROOT $INSTALL_ROOT | |
set BASE (pwd)/build/1.3.4/ | |
set PREFIX_32 $BASE/i386/root/ | |
set PREFIX_64 $BASE/x86_64/root/ | |
set SDK_1070 /Developer/SDKs/MacOSX10.7.sdk/ | |
./configure --prefix="$PREFIX_32" --enable-shared=yes --enable-static=no --with-ogg="$OGG_ROOT" CFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
./configure --prefix="$PREFIX_64" --enable-shared=yes --enable-static=no --with-ogg="$OGG_ROOT" CFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
cd build/1.3.4/universal | |
cp ../i386/root/lib/libvorbis.0.dylib libvorbis.0.dylib.i386 | |
cp ../x86_64/root/lib/libvorbis.0.dylib libvorbis.0.dylib.x86_64 | |
cp ../i386/root/lib/libvorbisfile.3.dylib libvorbisfile.3.dylib.i386 | |
cp ../x86_64/root/lib/libvorbisfile.3.dylib libvorbisfile.3.dylib.x86_64 | |
cp ../i386/root/lib/libvorbisenc.2.dylib libvorbisenc.2.dylib.i386 | |
cp ../x86_64/root/lib/libvorbisenc.2.dylib libvorbisenc.2.dylib.x86_64 | |
lipo libvorbis.0.dylib.i386 libvorbis.0.dylib.x86_64 -create -output libvorbis.0.dylib | |
lipo libvorbisfile.3.dylib.i386 libvorbisfile.3.dylib.x86_64 -create -output libvorbisfile.3.dylib | |
lipo libvorbisenc.2.dylib.i386 libvorbisenc.2.dylib.x86_64 -create -output libvorbisenc.2.dylib | |
cp -R ../i386/root/ $INSTALL_ROOT | |
cp *.dylib $INSTALL_ROOT/lib | |
rm $INSTALL_ROOT/lib/*.la | |
file $INSTALL_ROOT/lib/* | |
popd | |
### FLAC | |
pushd flac* | |
mkdir -p build/1.3.0/i386/root | |
mkdir -p build/1.3.0/x86_64/root | |
mkdir -p build/1.3.0/universal | |
set OGG_ROOT $INSTALL_ROOT | |
set BASE (pwd)/build/1.3.0/ | |
set PREFIX_32 $BASE/i386/root/ | |
set PREFIX_64 $BASE/x86_64/root/ | |
set SDK_1070 /Developer/SDKs/MacOSX10.7.sdk/ | |
./configure --prefix="$PREFIX_32" --enable-shared=yes --enable-static=no --disable-cpplibs --with-ogg="$OGG_ROOT" CFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch i386 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
./configure --prefix="$PREFIX_64" --enable-shared=yes --enable-static=no --disable-cpplibs --with-ogg="$OGG_ROOT" CFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" LDFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" CPPFLAGS="-arch x86_64 --sysroot=$SDK_1070 -mmacosx-version-min=10.7" | |
make clean | |
make | |
make install | |
cd build/1.3.0/universal/ | |
cp ../i386/root/lib/libFLAC.8.dylib libFLAC.8.dylib.i386 | |
cp ../x86_64/root/lib/libFLAC.8.dylib libFLAC.8.dylib.x86_64 | |
lipo *.dylib.* -create -output libFLAC.8.dylib | |
cp -R ../i386/root/ $INSTALL_ROOT | |
cp *dylib $INSTALL_ROOT/lib | |
rm $INSTALL_ROOT/lib/*.la | |
file $INSTALL_ROOT/lib/* | |
popd | |
### FRAMEWORKS | |
mkdir frameworks | |
for lib in FLAC ogg vorbis vorbisfile vorbisenc | |
cp $INSTALL_ROOT/lib/lib$lib.dylib frameworks/$lib.dylib | |
end | |
pushd frameworks | |
echo '<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDevelopmentRegion</key> | |
<string>English</string> | |
<key>CFBundleExecutable</key> | |
<string>@@LIB@@</string> | |
<key>CFBundleIdentifier</key> | |
<string>org.sfml-dev.@@LIB@@</string> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundlePackageType</key> | |
<string>FMWK</string> | |
<key>CFBundleSignature</key> | |
<string>????</string> | |
<key>CFBundleVersion</key> | |
<string>1.0</string> | |
</dict> | |
</plist>' > Info.plist.in | |
function rpath | |
echo "@rpath/../Frameworks/$argv.framework/Versions/A/$argv" | |
end | |
for f in *.dylib | |
set lib (basename $f .dylib) | |
rm -fr "$lib.framework" | |
mkdir -p "$lib.framework/Versions/A/Resources/" | |
cp "$f" "$lib.framework/Versions/A/$lib" | |
sed -e "s#@@LIB@@#$lib#" "Info.plist.in" > "$lib.framework/Versions/A/Resources/Info.plist" | |
pushd "$lib.framework/Versions" | |
ln -s "A" "Current" | |
cd .. | |
ln -s "Versions/Current/Resources" "Resources" | |
ln -s "Versions/Current/$lib" | |
popd | |
end | |
for f in *.framework | |
set lib (echo $f | sed -e 's#\(.*\)\.framework#\1#') | |
install_name_tool -id (rpath "$lib") "$lib.framework/Versions/A/$lib" | |
end | |
for f in {FLAC,vorbis,vorbisfile,vorbisenc}.framework | |
set lib (echo $f | sed -e 's#\(.*\)\.framework#\1#') | |
set old (otool -L "$f/$lib" | grep "ogg" | awk '{ print $1 }') | |
set new (rpath "ogg") | |
install_name_tool -change "$old" "$new" "$f/$lib" | |
end | |
for f in {vorbisfile,vorbisenc}.framework | |
set lib (echo $f | sed -e 's#\(.*\)\.framework#\1#') | |
set old (otool -L "$f/$lib" | grep "libvorbis.0.dylib" | awk '{ print $1 }') | |
set new (rpath "vorbis") | |
install_name_tool -change "$old" "$new" "$f/$lib" | |
end | |
for f in *.framework | |
set lib (echo $f | sed -e 's#\(.*\)\.framework#\1#') | |
echo "Printing otool -L for $lib.framework" | |
otool -L "$f/$lib" | |
echo | |
echo | |
end | |
rm Info.plist.in *.dylib | |
echo Frameworks are in (pwd) | |
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
## | |
## build ogg, vorbis, vorbisfile, vorbisenc and flac frameworks | |
## | |
set OUTPUT (pwd)/trace.log | |
rm -f $OUTPUT | |
function assert | |
if test $argv[1] -ne 0 | |
echo "ERROR, see $OUTPUT for more details" | |
exit 1 | |
end | |
end | |
rm -rf tmp | |
mkdir tmp | |
pushd tmp | |
### Initial setup | |
set URLS http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.xz https://svn.xiph.org/releases/flac/flac-1.3.0.tar.xz | |
echo -n "DOWNLOADING LIBRARIES..." | |
for url in $URLS | |
wget --quiet $url >> $OUTPUT ^&1 | |
assert $status | |
end | |
echo "[DONE]" | |
for ARCHIVE in *.tar.xz | |
tar -xf $ARCHIVE | |
assert $status | |
end | |
set PREFIX_BASE (pwd)/root | |
function makeIt | |
make clean >> $OUTPUT ^&1 | |
assert $status | |
make >> $OUTPUT ^&1 | |
assert $status | |
make install >> $OUTPUT ^&1 | |
assert $status | |
end | |
function buildThem # arch, ios_min_version, ios_sdk_path[, host] | |
set ARCH $argv[1] | |
set IOS_MIN_VER $argv[2] | |
set IOS_SDK_PATH $argv[3] | |
if test (count $argv) -ge 4 | |
set HOST $argv[4] | |
else | |
set HOST | |
end | |
set IOS_SDK --sysroot=$IOS_SDK_PATH -isystem $IOS_SDK_PATH/usr/include | |
mkdir -p $PREFIX_BASE/$ARCH | |
set PREFIX $PREFIX_BASE/$ARCH | |
set FLAGS -arch $ARCH $IOS_MIN_VER $IOS_SDK | |
### OGG | |
pushd libogg* | |
echo -n "BUILDING ogg for $ARCH..." | |
./configure --prefix="$PREFIX" $HOST --enable-shared=yes --enable-static=yes CFLAGS="$FLAGS" CPPFLAGS="$FLAGS" >> $OUTPUT ^&1 | |
assert $status | |
makeIt | |
echo "[DONE]" | |
popd | |
### VORBIS | |
pushd libvorbis* | |
echo -n "BUILDING libvorbis for $ARCH..." | |
./configure --prefix="$PREFIX" $HOST --enable-shared=yes --enable-static=yes --with-ogg="$PREFIX" CFLAGS="$FLAGS" CPPFLAGS="$FLAGS" >> $OUTPUT ^&1 | |
assert $status | |
makeIt | |
echo "[DONE]" | |
popd | |
### FLAC | |
pushd flac* | |
echo -n "BUILDING flac for $ARCH..." | |
./configure --prefix="$PREFIX" $HOST --enable-shared=yes --enable-static=yes --with-ogg="$PREFIX" --disable-cpplibs CFLAGS="$FLAGS -DGWINSZ_IN_SYS_IOCTL" CPPFLAGS="$FLAGS" >> $OUTPUT ^&1 | |
assert $status | |
makeIt | |
echo "[DONE]" | |
popd | |
end | |
set SDK_SIMULATOR "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk" | |
set SDK_DEVICE "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk" | |
set ARCHS_SIMULATOR i386 x86_64 | |
set ARCHS_DEVICE armv7 armv7s arm64 | |
set ARCHS $ARCHS_SIMULATOR $ARCHS_DEVICE | |
for ARCH in $ARCHS_SIMULATOR | |
buildThem $ARCH "-mios-simulator-version-min=4.3" $SDK_SIMULATOR | |
end | |
for ARCH in $ARCHS_DEVICE | |
buildThem $ARCH "-miphoneos-version-min=4.3" $SDK_DEVICE "--host=arm-apple-darwin" | |
end | |
mkdir universal | |
cp -R root/i386/* universal | |
rm -fR universal/lib/* universal/bin | |
for LIB in libFLAC libogg libvorbis libvorbisenc libvorbisfile | |
echo -n "GENERATING $LIB" | |
for EXT in a dylib | |
lipo root/{$ARCHS}/lib/$LIB.$EXT -create -output universal/lib/$LIB.$EXT | |
assert $status | |
end | |
echo "[DONE]" | |
end | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
## | |
## build OpenAL framework | |
## | |
set SDK_1070 /Developer/SDKs/MacOSX10.7.sdk/ | |
rm -fr build_deps | |
mkdir -p build_deps | |
pushd build_deps | |
wget "https://github.com/kcat/openal-soft/archive/openal-soft-1.17.2.tar.gz" | |
for archive in *.tar.gz | |
tar -xf "$archive" | |
end | |
mkdir output | |
set OUTPUT (pwd)/output | |
cd openal-soft-openal-soft-*/ | |
mkdir build | |
mkdir install | |
cd build | |
cmake .. \ | |
-DCMAKE_OSX_ARCHITECTURES="i386;x86_64" \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET="10.7" -DCMAKE_OSX_SYSROOT="$SDK_1070" \ | |
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \ | |
-DCMAKE_INSTALL_PREFIX=(pwd)"/../install" \ | |
-DALSOFT_UTILS=OFF \ | |
-DALSOFT_EXAMPLES=OFF \ | |
-DALSOFT_CONFIG=OFF \ | |
-DALSOFT_HRTF_DEFS=OFF | |
make install -j8 | |
cd ../install/lib/ | |
mkdir -p "$OUTPUT/OpenAL.framework/Versions/A/Resources/" | |
echo '<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDevelopmentRegion</key> | |
<string>English</string> | |
<key>CFBundleExecutable</key> | |
<string>OpenAL</string> | |
<key>CFBundleIdentifier</key> | |
<string>org.sfml-dev.OpenAL</string> | |
<key>CFBundleInfoDictionaryVersion</key> | |
<string>6.0</string> | |
<key>CFBundlePackageType</key> | |
<string>FMWK</string> | |
<key>CFBundleSignature</key> | |
<string>????</string> | |
<key>CFBundleVersion</key> | |
<string>1.0</string> | |
<key>CFBundleSupportedPlatforms</key> | |
<array> | |
<string>MacOSX</string> | |
</array> | |
</dict> | |
</plist>' > "$OUTPUT/OpenAL.framework/Versions/A/Resources/Info.plist" | |
cp "libopenal.dylib" "$OUTPUT/OpenAL.framework/Versions/A/OpenAL" | |
install_name_tool -id "@rpath/../Frameworks/OpenAL.framework/Versions/A/OpenAL" "$OUTPUT/OpenAL.framework/Versions/A/OpenAL" | |
pushd "$OUTPUT/OpenAL.framework/Versions" | |
ln -s "A" "Current" | |
cd .. | |
ln -s "Versions/Current/Resources" "Resources" | |
ln -s "Versions/Current/OpenAL" "OpenAL" | |
popd | |
popd | |
echo "Have a look in $OUTPUT" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment