Skip to content

Instantly share code, notes, and snippets.

@rsky
Last active December 12, 2015 08:39
Show Gist options
  • Save rsky/4745953 to your computer and use it in GitHub Desktop.
Save rsky/4745953 to your computer and use it in GitHub Desktop.
PHPをiOS向けにビルドするシェルスクリプト
#!/bin/sh
PLATFORM_DIR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform"
SDK_DIR="$PLATFORM_DIR/Developer/SDKs/iPhoneOS6.1.sdk"
test -f Makefile && make distclean
if [ ! -f Zend/_Offsetof.h ]; then
cat > Zend/_Offsetof.h <<EOF
#ifndef _Offsetof
#include <stddef.h>
#define _Offsetof(p_type,field) offsetof(p_type,field)
#endif
EOF
echo >> Zend/zend.h
echo '#include "_Offsetof.h"' >> Zend/zend.h
fi
CC="/usr/bin/clang" \
CXX="/usr/bin/clang++" \
CPP="/usr/bin/cpp" \
CFLAGS="-miphoneos-version-min=5.0 -arch armv7 -isysroot $SDK_DIR" \
CPPFLAGS="-I$SDK_DIR/usr/include" \
LDFLAGS="-L$SDK_DIR/usr/lib" \
LIBS="-lresolv" \
./configure \
--host=arm-apple-darwin --build=arm-apple-darwin10 \
--disable-all --enable-embed=static \
&& make \
&& cp -v libs/libphp5.a /tmp/libphp5-armv7.a
#!/bin/sh
PLATFORM_DIR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform"
SDK_DIR="$PLATFORM_DIR/Developer/SDKs/iPhoneOS6.1.sdk"
test -f Makefile && make distclean
if [ ! -f Zend/_Offsetof.h ]; then
cat > Zend/_Offsetof.h <<EOF
#ifndef _Offsetof
#include <stddef.h>
#define _Offsetof(p_type,field) offsetof(p_type,field)
#endif
EOF
echo >> Zend/zend.h
echo '#include "_Offsetof.h"' >> Zend/zend.h
fi
CC="/usr/bin/clang" \
CXX="/usr/bin/clang++" \
CPP="/usr/bin/cpp" \
CFLAGS="-miphoneos-version-min=5.0 -arch armv7s -isysroot $SDK_DIR" \
CPPFLAGS="-I$SDK_DIR/usr/include" \
LDFLAGS="-L$SDK_DIR/usr/lib" \
LIBS="-lresolv" \
./configure \
--host=arm-apple-darwin --build=arm-apple-darwin10 \
--disable-all --enable-embed=static \
&& make \
&& cp -v libs/libphp5.a /tmp/libphp5-armv7s.a
#!/bin/sh
PLATFORM_DIR="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform"
SDK_DIR="$PLATFORM_DIR/Developer/SDKs/iPhoneSimulator5.0.sdk"
test -f Makefile && make distclean
if [ ! -f Zend/_Offsetof.h ]; then
cat > Zend/_Offsetof.h <<EOF
#ifndef _Offsetof
#include <stddef.h>
#define _Offsetof(p_type,field) offsetof(p_type,field)
#endif
EOF
echo >> Zend/zend.h
echo '#include "_Offsetof.h"' >> Zend/zend.h
fi
CC="/usr/bin/clang" \
CXX="/usr/bin/clang++" \
CPP="/usr/bin/cpp" \
CFLAGS="-miphoneos-version-min=5.0 -arch i386 -isysroot $SDK_DIR" \
CPPFLAGS="-I$SDK_DIR/usr/include" \
LDFLAGS="-L$SDK_DIR/usr/lib" \
LIBS="-lresolv" \
./configure \
--host=i686-apple-darwin --build=i686-apple-darwin11 \
--disable-all --enable-embed=static \
&& make \
&& cp -v libs/libphp5.a /tmp/libphp5-i386.a
#!/bin/sh
LIPO="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo"
$LIPO -create libphp5-*.a -output libphp5.a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment