#!/bin/sh# directories
SOURCE="../vhall_x264"
FAT="x264-iOS"
SCRATCH="scratch-x264"# must be an absolute path
THIN=`pwd`/"thin-x264"# the one included in x264 does not work; specify full path to working one
GAS_PREPROCESSOR=/usr/local/bin/gas-preprocessor.pl
CONFIGURE_FLAGS="--enable-static --enable-pic --disable-cli"#
ARCHS="arm64 armv7 x86_64"
COMPILE="y"
LIPO="y"
DEPLOYMENT_TARGET="7.0"if["$*"]
then
if["$*" = "lipo"]
then
# skip compile
COMPILE=
else
ARCHS="$*"if[ $# -eq 1 ]
then
# skip lipo
LIPO=
fi
fi
fi
if["$COMPILE"]
then
if[! `which gas-preprocessor.pl` ]
then
echo'gas-preprocessor.pl not found. Trying to install...'(curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \
-o /usr/local/bin/gas-preprocessor.pl \
&& chmod +x /usr/local/bin/gas-preprocessor.pl) \
||exit 1
fi
CWD=`pwd`
for ARCH in $ARCHSdoecho"building $ARCH..."
mkdir -p "$SCRATCH/$ARCH"
cd "$SCRATCH/$ARCH"
CFLAGS="-arch $ARCH"
ASFLAGS=
if["$ARCH" = "i386"-o "$ARCH" = "x86_64"]
then
PLATFORM="iPhoneSimulator"
CPU=
if["$ARCH" = "x86_64"]
then
CFLAGS="$CFLAGS -mios-simulator-version-min=$DEPLOYMENT_TARGET"
HOST=
else#
CFLAGS="$CFLAGS -mios-simulator-version-min=$DEPLOYMENT_TARGET"
HOST="--host=i386-apple-darwin"
fi
else
PLATFORM="iPhoneOS"if[$ARCH = "armv7s"]
then
CPU="--cpu=swift"else
CPU=
fi
if[$ARCH = "arm64"]
then
HOST="--host=aarch64-apple-darwin"else
HOST="--host=arm-apple-darwin"
fi
CFLAGS="$CFLAGS -fembed-bitcode -mios-version-min=$DEPLOYMENT_TARGET"
ASFLAGS="$CFLAGS"
fi
XCRUN_SDK=`echo$PLATFORM| tr '[:upper:]''[:lower:]'`
CC="xcrun -sdk $XCRUN_SDK clang -Wno-error=unused-command-line-argument-hard-error-in-future -arch $ARCH"
CXXFLAGS="$CFLAGS"
LDFLAGS="$CFLAGS"
CC=$CC$CWD/$SOURCE/configure \
$CONFIGURE_FLAGS \
$HOST \
$CPU \
--extra-cflags="$CFLAGS" \
--extra-asflags="$ASFLAGS" \
--extra-ldflags="$LDFLAGS" \
--prefix="$THIN/$ARCH"||exit 1
mkdir extras
ln -s $GAS_PREPROCESSOR extras
make -j3 install ||exit 1
cd $CWD
done
fi
if["$LIPO"]
then
echo"building fat binaries..."
mkdir -p $FAT/lib
set-$ARCHS
CWD=`pwd`
cd $THIN/$1/lib
for LIB in *.a
do
cd $CWDecho lipo -create `find $THIN-name $LIB` -output $FAT/lib/$LIB 1>&2
lipo -create `find $THIN-name $LIB` -output $FAT/lib/$LIB
done
cd $CWDcp-rf $THIN/$1/include $FATrm-rf $SCRATCHrm-rf $THINecho"build x264 ios finish."
fi
build x264 macos
#!/bin/sh# directories
SOURCE="../vhall_x264"
FAT="x264-OSX"
SCRATCH="scratch-x264-OSX"# must be an absolute path
THIN=`pwd`/"thin-x264-OSX"# the one included in x264 does not work; specify full path to working one
GAS_PREPROCESSOR=/usr/local/bin/gas-preprocessor.pl
CONFIGURE_FLAGS="--enable-static --enable-pic --disable-cli"#
ARCHS="x86_64 i386"
COMPILE="y"
LIPO="y"
DEPLOYMENT_TARGET="10.7"if["$*"]
then
if["$*" = "lipo"]
then
# skip compile
COMPILE=
else
ARCHS="$*"if[ $# -eq 1 ]
then
# skip lipo
LIPO=
fi
fi
fi
if["$COMPILE"]
then
if[! `which gas-preprocessor.pl` ]
then
echo'gas-preprocessor.pl not found. Trying to install...'(curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \
-o /usr/local/bin/gas-preprocessor.pl \
&& chmod +x /usr/local/bin/gas-preprocessor.pl) \
||exit 1
fi
CWD=`pwd`
for ARCH in $ARCHSdoecho"building $ARCH..."
mkdir -p "$SCRATCH/$ARCH"
cd "$SCRATCH/$ARCH"
CFLAGS="-arch $ARCH"
ASFLAGS=
if["$ARCH" = "i386"-o "$ARCH" = "x86_64"]
then
PLATFORM="MacOSX"
CPU=
if["$ARCH" = "x86_64"]
then
CFLAGS="$CFLAGS -mmacosx-version-min=$DEPLOYMENT_TARGET"
HOST=
else
CFLAGS="$CFLAGS -mmacosx-version-min=$DEPLOYMENT_TARGET"
HOST="--host=i386-apple-darwin"
fi
fi
XCRUN_SDK=`echo$PLATFORM| tr '[:upper:]''[:lower:]'`
CC="xcrun -sdk $XCRUN_SDK clang -Wno-error=unused-command-line-argument-hard-error-in-future -arch $ARCH"
CXXFLAGS="$CFLAGS"
LDFLAGS="$CFLAGS"
CC=$CC$CWD/$SOURCE/configure \
$CONFIGURE_FLAGS \
$HOST \
$CPU \
--extra-cflags="$CFLAGS" \
--extra-asflags="$ASFLAGS" \
--extra-ldflags="$LDFLAGS" \
--prefix="$THIN/$ARCH"||exit 1
mkdir extras
ln -s $GAS_PREPROCESSOR extras
make -j3 install ||exit 1
cd $CWD
done
fi
if["$LIPO"]
then
echo"building fat binaries..."
mkdir -p $FAT/lib
set-$ARCHS
CWD=`pwd`
cd $THIN/$1/lib
for LIB in *.a
do
cd $CWDecho lipo -create `find $THIN-name $LIB` -output $FAT/lib/$LIB 1>&2
lipo -create `find $THIN-name $LIB` -output $FAT/lib/$LIB
done
cd $CWDcp-rf $THIN/$1/include $FATrm-rf $SCRATCHrm-rf $THINecho"build x264 osx finish."
fi