You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.0 KiB
Bash

#!/bin/bash
##
# buildForMac <configure-options>
# example: contrib/buildForMac --disable-shared
#
# On Lion:
# contrib/buildForMac --with-zlib=/usr/lib
# 11 == `uname -a | cut '-d ' -f 3 | cut '-d.' -f 1`
LION=""
(echo $OSTYPE | grep 11) > /dev/null
if [ $? == 0 ]; then
LION="--with-zlib=/usr/lib"
fi
# b=`basename "${PWD}"`
if [ ! -d contrib ]; then
echo "you are in the wrong directory - please run $0 in the main directory (which includes contrib and src)"
exit 1
fi
TARGET="MACOSX_DEPLOYMENT_TARGET=10.5"
version=`grep EXIV2_LTVERSION config/config.mk | cut "-d " -f 3 | cut -d: -f 1`
lib=libexiv2.$version.dylib
echo
echo -----------------------------
echo version = $version
echo lib = $lib
echo -----------------------------
echo
app=exiv2
LIB=./src/.libs/$lib
APP=./src/.libs/$app
for option in "$@" ; do
if [ "$option" == --disable-shared ]; then
lib=libexiv2.a
LIB=./src/.libs/$lib
APP=./src/$app
fi
done
props() {
ls -alt $*
lipo -info $*
otool -L $*
echo ----------------------
}
build() {
make clean
./configure CFLAGS="$arch" CXXFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" $TARGET $LION "$@"
make CFLAGS="$arch" CXXFLAGS="$arch" LDFLAGS="$arch -L${PWD}/xmpsdk/src" OBJCFLAGS="$arch" OBJCXXFLAGS="$arch" $TARGET
if [ "$?" != "0" ]; then
echo build failed
exit
fi
props $APP
props $LIB
}
for arch in '-arch i386' '-arch x86_64' ; do
if [ "$arch" == "-arch i386" ]; then
build "$@"
rm -rf app.i386 lib.i386
cp $APP app.i386
cp $LIB lib.i386
elif [ "$arch" == "-arch x86_64" ]; then
build "$@"
rm -rf app.x86_64 lib.x86_64
cp $APP app.x86_64
cp $LIB lib.x86_64
fi
done
LIB=./src/.libs/$lib
APP=./src/.libs/$app
env $TARGET lipo -arch i386 lib.i386 -arch x86_64 lib.x86_64 -create -output $LIB
env $TARGET lipo -arch i386 app.i386 -arch x86_64 app.x86_64 -create -output $APP
props $LIB
props $APP
# That's all Folks!
##