From 1ddbeb522842009b40a9404f15a4e56ae4c6dda4 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Sat, 26 Oct 2013 01:08:15 +0200 Subject: Fixed building on MacOSX 10.9 Mavericks --- .gitignore | 3 +- CMakeLists.txt | 33 +++-- contrib/build-scripts/build-arabica-ios.sh | 171 +++++++++++++++++++++++ contrib/build-scripts/build-arabica-linux.sh | 57 ++++++++ contrib/build-scripts/build-arabica-macosx.sh | 99 +++++++++++++ contrib/build-scripts/build-arabica-windows.bat | 64 +++++++++ contrib/build-scripts/build-curl-ios.sh | 167 ++++++++++++++++++++++ contrib/build-scripts/build-glog-ios.sh | 163 +++++++++++++++++++++ contrib/build-scripts/build-glog-macosx.sh | 81 +++++++++++ contrib/build-scripts/build-glog-windows.bat | 69 +++++++++ contrib/build-scripts/build-libevent-ios.sh | 169 ++++++++++++++++++++++ contrib/build-scripts/build-libevent-linux.sh | 62 ++++++++ contrib/build-scripts/build-libevent-macosx.sh | 114 +++++++++++++++ contrib/build-scripts/build-libevent-windows.bat | 51 +++++++ contrib/build-scripts/build-swi-linux.sh | 62 ++++++++ contrib/build-scripts/build-swi-macosx.sh | 60 ++++++++ contrib/build-scripts/build-uscxml-ios.sh | 93 ++++++++++++ contrib/cmake/USCXMLMacros.cmake | 16 +++ contrib/local/compress_and_upload_deps.sh | 4 +- 19 files changed, 1526 insertions(+), 12 deletions(-) create mode 100755 contrib/build-scripts/build-arabica-ios.sh create mode 100755 contrib/build-scripts/build-arabica-linux.sh create mode 100755 contrib/build-scripts/build-arabica-macosx.sh create mode 100644 contrib/build-scripts/build-arabica-windows.bat create mode 100755 contrib/build-scripts/build-curl-ios.sh create mode 100755 contrib/build-scripts/build-glog-ios.sh create mode 100755 contrib/build-scripts/build-glog-macosx.sh create mode 100644 contrib/build-scripts/build-glog-windows.bat create mode 100755 contrib/build-scripts/build-libevent-ios.sh create mode 100755 contrib/build-scripts/build-libevent-linux.sh create mode 100755 contrib/build-scripts/build-libevent-macosx.sh create mode 100644 contrib/build-scripts/build-libevent-windows.bat create mode 100755 contrib/build-scripts/build-swi-linux.sh create mode 100755 contrib/build-scripts/build-swi-macosx.sh create mode 100755 contrib/build-scripts/build-uscxml-ios.sh diff --git a/.gitignore b/.gitignore index 0a96fe4..d861b13 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.DS_Store build/* build/ -build*/ nbproject contrib/prebuilt/darwin* contrib/prebuilt/linux* @@ -21,4 +20,4 @@ package/windows* *.class /package/* -contrib/prebuilt/include/* \ No newline at end of file +contrib/prebuilt/include/* diff --git a/CMakeLists.txt b/CMakeLists.txt index 597d12f..a48f5cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,13 @@ ENDIF() project(uscxml) +# where to find the cmake modules we distribute +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/contrib/cmake) +include("${CMAKE_MODULE_PATH}/USCXMLMacros.cmake") +include("${CMAKE_MODULE_PATH}/FunctionExists.cmake") +include("${CMAKE_MODULE_PATH}/HeaderExists.cmake") +include("${CMAKE_MODULE_PATH}/BinaryExists.cmake") + # CMake 2.8.11 reports AMD64 for Windows 64Bit, where earlier versions reported x86 # we resolve it with a 64bit check later if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") @@ -49,6 +56,18 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) # LIST(APPEND CMAKE_FIND_ROOT_PATH "/usr/lib64") endif() +if (APPLE) + # get MacOSX version + execute_process(COMMAND /usr/bin/sw_vers -productVersion + OUTPUT_VARIABLE MACOSX_VERSION + ERROR_VARIABLE MACOSX_VERSION_errors + RESULT_VARIABLE MACOSX_VERSION_result + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (MACOSX_VERSION) + THREE_PART_VERSION_TO_VARS(${MACOSX_VERSION} MACOSX_VERSION_MAJOR MACOSX_VERSION_MINOR MACOSX_VERSION_PATCH) + endif() +endif() + # We use the toolchain file from http://code.google.com/p/android-cmake/ if (CMAKE_CROSSCOMPILING AND ANDROID_ABI) set(ANDROID ON) @@ -108,7 +127,11 @@ else () # SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM "BOTH") # SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE "BOTH") # SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY "BOTH") - SET(USCXML_PREBUILT_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/contrib/prebuilt/${USCXML_PLATFORM_ID}/${CMAKE_CXX_COMPILER_ID_LC}") + if (APPLE) + SET(USCXML_PREBUILT_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/contrib/prebuilt/${USCXML_PLATFORM_ID}/${MACOSX_VERSION_MAJOR}.${MACOSX_VERSION_MINOR}/${CMAKE_CXX_COMPILER_ID_LC}") + else() + SET(USCXML_PREBUILT_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/contrib/prebuilt/${USCXML_PLATFORM_ID}/${CMAKE_CXX_COMPILER_ID_LC}") + endif() endif() SET(USCXML_LIBRARY_HOST_URL_PREFIX "http://uscxml.tk.informatik.tu-darmstadt.de/prebuilt" CACHE STRING "The root path of an URL where to look for prebuilt libraries.") @@ -257,13 +280,6 @@ endif() OPTION(DIST_PREPARE "Put libraries into the lib folder of the source tree" OFF) -# where to find the cmake modules we distribute -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/contrib/cmake) -include("${CMAKE_MODULE_PATH}/USCXMLMacros.cmake") -include("${CMAKE_MODULE_PATH}/FunctionExists.cmake") -include("${CMAKE_MODULE_PATH}/HeaderExists.cmake") -include("${CMAKE_MODULE_PATH}/BinaryExists.cmake") - # we need USCXML_CORE_LIBS here for -lgcov set(USCXML_CORE_LIBS) set(USCXML_OPT_LIBS) @@ -349,6 +365,7 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-string-plus-int") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-non-literal-null-conversion") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-null-conversion") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -read_only_relocs suppress") diff --git a/contrib/build-scripts/build-arabica-ios.sh b/contrib/build-scripts/build-arabica-ios.sh new file mode 100755 index 0000000..c88133c --- /dev/null +++ b/contrib/build-scripts/build-arabica-ios.sh @@ -0,0 +1,171 @@ +#!/bin/bash + +# +# build Arabica for iOS and iOS simulator +# + +# make sure this is not set +unset MACOSX_DEPLOYMENT_TARGET + +# be ridiculously conservative with regard to ios features +export IPHONEOS_DEPLOYMENT_TARGET="1.0" + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +SDK_VER="6.1" +#SDK_VER="5.1" +DEST_DIR="${DIR}/../prebuilt/ios/${SDK_VER}-arabica-build" + +if [ ! -f src/arabica.cpp ]; then + echo + echo "Cannot find src/arabica.cpp" + echo "Run script from within arabica directory:" + echo "arabica $ ../../${ME}" + echo + exit +fi + +mkdir -p ${DEST_DIR} &> /dev/null + +# see http://stackoverflow.com/questions/2424770/floating-point-comparison-in-shell-script +if [ $(bc <<< "$SDK_VER >= 6.1") -eq 1 ]; then + DEV_ARCHS="-arch armv7 -arch armv7s" +elif [ $(bc <<< "$SDK_VER >= 5.1") -eq 1 ]; then + DEV_ARCHS="-arch armv6 -arch armv7" +else + echo + echo "Building for SDK < 5.1 not supported" + exit +fi + +# +# Build for Device +# +if [ ! -d ${DEST_DIR}/device ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneOS${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/device &> /dev/null + + ./configure \ + CPP="cpp" \ + CXXCPP="cpp" \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-g -O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + CXXFLAGS="-g -O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + --with-libxml2=${SYSROOT}/usr \ + --with-parser=libxml2 \ + --with-tests=no \ + --with-boost=/opt/local/include \ + --host=arm-apple-darwin10 \ + --target=arm-apple-darwin10 \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} ${DEV_ARCHS}" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/device + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +# +# Simulator +# +if [ ! -d ${DEST_DIR}/simulator ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneSimulator${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/simulator &> /dev/null + + ./configure \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/llvm-g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/llvm-gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-g -O -isysroot ${SYSROOT} -arch i386" \ + CXXFLAGS="-g -O -isysroot ${SYSROOT} -arch i386" \ + --with-libxml2=${SYSROOT}/usr \ + --with-parser=libxml2 \ + --with-tests=no \ + --with-boost=/opt/local/include \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} -arch i386" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/simulator + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +echo +echo "- Creating universal binaries --------------------------------------" +echo + +LIBS=`find ${DIR}/../prebuilt/ios/*arabica-build* -name *.a` +set +e +for LIB in ${LIBS}; do + LIB_BASE=`basename $LIB .a` + ARCHS=`lipo -info $LIB` + ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'` + for ARCH in ${ARCHS}; do + mkdir -p ${DIR}/../prebuilt/ios/arch/${ARCH} > /dev/null + lipo -extract $ARCH $LIB -output ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a \ + || cp $LIB ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a + UNIQUE_LIBS=`ls ${DIR}/../prebuilt/ios/arch/${ARCH}` + done +done + +mkdir -p ${DIR}/../prebuilt/ios/lib +for LIB in ${UNIQUE_LIBS}; do + FILELIST="" + for ARCH in `ls ${DIR}/../prebuilt/ios/arch/`; do + FILELIST="${FILELIST} ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB}" + done + lipo -create ${FILELIST} -output ${DIR}/../prebuilt/ios/lib/${LIB} +done + +rm -rf ${DIR}/../prebuilt/ios/arch/ diff --git a/contrib/build-scripts/build-arabica-linux.sh b/contrib/build-scripts/build-arabica-linux.sh new file mode 100755 index 0000000..be20faf --- /dev/null +++ b/contrib/build-scripts/build-arabica-linux.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# +# build arabica for Linux +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +CPUARCH=`uname -m` +DEST_DIR="${DIR}/../prebuilt/linux-${CPUARCH}/gnu" + +if [ ! -f src/arabica.cpp ]; then + echo + echo "Cannot find src/arabica.cpp" + echo "Run script from within arabica directory:" + echo "arabica $ ../../${ME}" + echo + exit +fi + +if [ -f Makefile ]; then + make clean +fi + +./configure \ +CFLAGS="-g" \ +CXXFLAGS="-g" \ +LDFLAGS="-g" \ +--with-parser=libxml2 \ +--with-tests=no \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic \ +--prefix=${DEST_DIR} + +make +cp ./src/.libs/libarabica.a ./libarabica_d.a +make install # once for headers +rm ${DEST_DIR}/lib/libarabica* +make clean + +./configure \ +--with-parser=libxml2 \ +--with-tests=no \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic + +make +cp ./src/.libs/libarabica.a ./libarabica.a +make clean + +cp ./libarabica.a ${DEST_DIR}/lib +cp ./libarabica_d.a ${DEST_DIR}/lib \ No newline at end of file diff --git a/contrib/build-scripts/build-arabica-macosx.sh b/contrib/build-scripts/build-arabica-macosx.sh new file mode 100755 index 0000000..98a0b0e --- /dev/null +++ b/contrib/build-scripts/build-arabica-macosx.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# +# build libevent for MacOSX +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +DEST_DIR="${DIR}/../prebuilt/darwin-i386/gnu" + +if [ ! -f src/arabica.cpp ]; then + echo + echo "Cannot find src/arabica.cpp" + echo "Run script from within arabica directory:" + echo "arabica $ ../../${ME}" + echo + exit +fi + +if [ -f Makefile ]; then + make clean +fi + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +--with-libxml2=${SYSROOT}/usr \ +--with-parser=libxml2 \ +--with-tests=no \ +--with-boost=/opt/local/include \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic \ +--prefix=${DEST_DIR} + + +make +cp ./src/.libs/libarabica.a ./libarabica_d.x86_64.a +make install # once for headers +rm ${DEST_DIR}/lib/libarabica* +make clean + + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +--with-libxml2=${SYSROOT}/usr \ +--with-parser=libxml2 \ +--with-tests=no \ +--with-boost=/opt/local/include \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic + +make +cp ./src/.libs/libarabica.a ./libarabica.x86_64.a +make clean + + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +--with-libxml2=${SYSROOT}/usr \ +--with-parser=libxml2 \ +--with-tests=no \ +--with-boost=/opt/local/include \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic + +make +cp ./src/.libs/libarabica.a ./libarabica_d.i386.a +make clean + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +--with-libxml2=${SYSROOT}/usr \ +--with-parser=libxml2 \ +--with-tests=no \ +--with-boost=/opt/local/include \ +--disable-shared \ +--disable-dependency-tracking \ +--with-pic + +make +cp ./src/.libs/libarabica.a ./libarabica.i386.a +make clean + + +lipo -create ./libarabica.i386.a ./libarabica.x86_64.a -output ${DEST_DIR}/lib/libarabica.a +lipo -create ./libarabica_d.i386.a ./libarabica_d.x86_64.a -output ${DEST_DIR}/lib/libarabica_d.a diff --git a/contrib/build-scripts/build-arabica-windows.bat b/contrib/build-scripts/build-arabica-windows.bat new file mode 100644 index 0000000..2e8647c --- /dev/null +++ b/contrib/build-scripts/build-arabica-windows.bat @@ -0,0 +1,64 @@ +@ECHO off + +set ME=%0 +set DIR=%~dp0 + +if "%VSINSTALLDIR%" == "" ( + echo. + echo %VSINSTALLDIR is not defined, run from within Visual Studio Command Prompt. + echo. + goto :DONE +) + +echo %LIB% |find "LIB\amd64;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86_64/msvc" + set CPU_ARCH=x86_64 + goto :ARCH_FOUND +) + +echo %LIB% |find "LIB;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86/msvc" + set CPU_ARCH=x86 + goto :ARCH_FOUND +) + +:ARCH_FOUND + +if "%DEST_DIR%" == "" ( + echo. + echo Unknown Platform %Platform%. + echo. + goto :DONE +) + +IF NOT EXIST "src\arabica.cpp" ( + echo. + echo Cannot find src\arabica.cpp + echo Run script from within arabica directory: + echo arabica $ ..\%ME% + echo. + goto :DONE +) + +devenv /upgrade vs10/Arabica.sln + +if "%CPU_ARCH%" == "x86_64" ( + devenv /build "debug|x64" vs10/Arabica.sln /project ArabicaLib + devenv /build "release|x64" vs10/Arabica.sln /project ArabicaLib +) + +if "%CPU_ARCH%" == "x86" ( + devenv /build "debug|Win32" vs10/Arabica.sln /project ArabicaLib + devenv /build "release|Win32" vs10/Arabica.sln /project ArabicaLib +) + +copy lib\Arabica-debug.lib %DEST_DIR%\lib\Arabica_d.lib +copy lib\Arabica.lib %DEST_DIR%\lib\Arabica.lib +mkdir %DEST_DIR%\include\arabica +xcopy include\*.hpp %DEST_DIR%\include\arabica /s /e + + +:DONE +pause \ No newline at end of file diff --git a/contrib/build-scripts/build-curl-ios.sh b/contrib/build-scripts/build-curl-ios.sh new file mode 100755 index 0000000..25c3077 --- /dev/null +++ b/contrib/build-scripts/build-curl-ios.sh @@ -0,0 +1,167 @@ +#!/bin/bash + +# +# build Curl for iOS and iOS simulator +# + +# make sure this is not set +unset MACOSX_DEPLOYMENT_TARGET + +# be ridiculously conservative with regard to ios features +export IPHONEOS_DEPLOYMENT_TARGET="1.0" + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +#SDK_VER="6.1" +SDK_VER="5.1" +DEST_DIR="${DIR}/../prebuilt/ios/${SDK_VER}-curl-build" + +if [ ! -f lib/cookie.c ]; then + echo + echo "Cannot find lib/cookie.c" + echo "Run script from within curl directory:" + echo "curl $ ../../${ME}" + echo + exit +fi + +mkdir -p ${DEST_DIR} &> /dev/null + +# see http://stackoverflow.com/questions/2424770/floating-point-comparison-in-shell-script +if [ $(bc <<< "$SDK_VER >= 6.1") -eq 1 ]; then + DEV_ARCHS="-arch armv7 -arch armv7s" +elif [ $(bc <<< "$SDK_VER >= 5.1") -eq 1 ]; then + DEV_ARCHS="-arch armv6 -arch armv7" +else + echo + echo "Building for SDK < 5.1 not supported" + exit +fi + +# +# Build for Device +# +if [ ! -d ${DEST_DIR}/device ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneOS${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/device &> /dev/null + + ./configure \ + CPP="cpp" \ + CXXCPP="cpp" \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + CXXFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + --enable-ipv6 \ + --with-darwinssl \ + --host=arm-apple-darwin10 \ + --target=arm-apple-darwin10 \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} ${DEV_ARCHS}" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/device + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +# +# Simulator +# +if [ ! -d ${DEST_DIR}/simulator ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneSimulator${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/simulator &> /dev/null + + ./configure \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/llvm-g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/llvm-gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + CXXFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + --enable-ipv6 \ + --with-darwinssl \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} -arch i386" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/simulator + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +echo +echo "- Creating universal binaries --------------------------------------" +echo + +LIBS=`find ${DIR}/../prebuilt/ios/*curl-build* -name *.a` +set +e +for LIB in ${LIBS}; do + LIB_BASE=`basename $LIB .a` + ARCHS=`lipo -info $LIB` + ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'` + for ARCH in ${ARCHS}; do + mkdir -p ${DIR}/../prebuilt/ios/arch/${ARCH} > /dev/null + lipo -extract $ARCH $LIB -output ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a \ + || cp $LIB ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a + UNIQUE_LIBS=`ls ${DIR}/../prebuilt/ios/arch/${ARCH}` + done +done + +mkdir -p ${DIR}/../prebuilt/ios/lib +for LIB in ${UNIQUE_LIBS}; do + FILELIST="" + for ARCH in `ls ${DIR}/../prebuilt/ios/arch/`; do + FILELIST="${FILELIST} ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB}" + done + lipo -create ${FILELIST} -output ${DIR}/../prebuilt/ios/lib/${LIB} +done + +rm -rf ${DIR}/../prebuilt/ios/arch/ diff --git a/contrib/build-scripts/build-glog-ios.sh b/contrib/build-scripts/build-glog-ios.sh new file mode 100755 index 0000000..bb1b1fd --- /dev/null +++ b/contrib/build-scripts/build-glog-ios.sh @@ -0,0 +1,163 @@ +#!/bin/bash + +# +# build glog for iOS and iOS simulator +# + +# make sure this is not set +unset MACOSX_DEPLOYMENT_TARGET + +# be ridiculously conservative with regard to ios features +export IPHONEOS_DEPLOYMENT_TARGET="1.0" + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +#SDK_VER="6.1" +SDK_VER="5.1" +DEST_DIR="${DIR}/../prebuilt/ios/${SDK_VER}-glog-build" + +if [ ! -f src/glog/logging.h ]; then + echo + echo "Cannot find src/glog/logging.h" + echo "Run script from within glog directory:" + echo "glog $ ../../${ME}" + echo + exit +fi + +mkdir -p ${DEST_DIR} &> /dev/null + +# see http://stackoverflow.com/questions/2424770/floating-point-comparison-in-shell-script +if [ $(bc <<< "$SDK_VER >= 6.1") -eq 1 ]; then + DEV_ARCHS="-arch armv7 -arch armv7s" +elif [ $(bc <<< "$SDK_VER >= 5.1") -eq 1 ]; then + DEV_ARCHS="-arch armv6 -arch armv7" +else + echo + echo "Building for SDK < 5.1 not supported" + exit +fi + +# +# Build for Device +# +if [ ! -d ${DEST_DIR}/device ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneOS${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/device &> /dev/null + + ./configure \ + CPP="cpp" \ + CXXCPP="cpp" \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + CXXFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + --host=arm-apple-darwin10 \ + --target=arm-apple-darwin10 \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} ${DEV_ARCHS}" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/device + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +# +# Simulator +# +if [ ! -d ${DEST_DIR}/simulator ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneSimulator${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/simulator &> /dev/null + + ./configure \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/llvm-g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/llvm-gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + CXXFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} -arch i386" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/simulator + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +echo +echo "- Creating universal binaries --------------------------------------" +echo + +LIBS=`find ${DIR}/../prebuilt/ios/*glog-build* -name *.a` +set +e +for LIB in ${LIBS}; do + LIB_BASE=`basename $LIB .a` + ARCHS=`lipo -info $LIB` + ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'` + for ARCH in ${ARCHS}; do + mkdir -p ${DIR}/../prebuilt/ios/arch/${ARCH} > /dev/null + lipo -extract $ARCH $LIB -output ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a \ + || cp $LIB ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a + UNIQUE_LIBS=`ls ${DIR}/../prebuilt/ios/arch/${ARCH}` + done +done + +mkdir -p ${DIR}/../prebuilt/ios/lib +for LIB in ${UNIQUE_LIBS}; do + FILELIST="" + for ARCH in `ls ${DIR}/../prebuilt/ios/arch/`; do + FILELIST="${FILELIST} ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB}" + done + lipo -create ${FILELIST} -output ${DIR}/../prebuilt/ios/lib/${LIB} +done + +rm -rf ${DIR}/../prebuilt/ios/arch/ diff --git a/contrib/build-scripts/build-glog-macosx.sh b/contrib/build-scripts/build-glog-macosx.sh new file mode 100755 index 0000000..81437d9 --- /dev/null +++ b/contrib/build-scripts/build-glog-macosx.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +# +# build libevent for MacOSX +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +DEST_DIR="${DIR}/../prebuilt/darwin-i386/gnu" + +if [ ! -f src/glog/log_severity.h ]; then + echo + echo "Cannot find src/glog/log_severity.h" + echo "Run script from within glog directory" + echo + exit +fi + +if [ -f Makefile ]; then + make clean +fi + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +--disable-rtti \ +--enable-static \ +--with-pic \ +--prefix=${DEST_DIR} + +make +cp ./.libs/libglog.a ./libglog_d.x86_64.a +make install # once for headers +rm ${DEST_DIR}/lib/libglog* +make clean + + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +--disable-rtti \ +--enable-static \ +--with-pic + +make +cp ./.libs/libglog.a ./libglog.x86_64.a +make clean + + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +--disable-rtti \ +--enable-static \ +--with-pic + +make +cp ./.libs/libglog.a ./libglog_d.i386.a +make clean + + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +--disable-rtti \ +--enable-static \ +--with-pic + +make +cp ./.libs/libglog.a ./libglog.i386.a +make clean + +lipo -create ./libglog.i386.a ./libglog.x86_64.a -output ${DEST_DIR}/lib/libglog.a +lipo -create ./libglog_d.i386.a ./libglog_d.x86_64.a -output ${DEST_DIR}/lib/libglog_d.a diff --git a/contrib/build-scripts/build-glog-windows.bat b/contrib/build-scripts/build-glog-windows.bat new file mode 100644 index 0000000..f5b97e9 --- /dev/null +++ b/contrib/build-scripts/build-glog-windows.bat @@ -0,0 +1,69 @@ +@ECHO off + +set ME=%0 +set DIR=%~dp0 + +if "%VSINSTALLDIR%" == "" ( + echo. + echo %VSINSTALLDIR is not defined, run from within Visual Studio Command Prompt. + echo. + goto :DONE +) + +echo %LIB% |find "LIB\amd64;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86_64/msvc" + set CPU_ARCH=x86_64 + goto :ARCH_FOUND +) + +echo %LIB% |find "LIB;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86/msvc" + set CPU_ARCH=x86 + goto :ARCH_FOUND +) + +:ARCH_FOUND + +if "%DEST_DIR%" == "" ( + echo. + echo Unknown Platform %Platform%. + echo. + goto :DONE +) + +IF NOT EXIST "src\glog\log_severity.h" ( + echo. + echo Cannot find src\glog\log_severity.h + echo Run script from within glog directory: + echo glog $ ..\%ME% + echo. + goto :DONE +) + +devenv /upgrade google-glog.sln + +if "%CPU_ARCH%" == "x86_64" ( + devenv /rebuild "debug|x64" google-glog.sln /project libglog_static + devenv /rebuild "release|x64" google-glog.sln /project libglog_static +) + +if "%CPU_ARCH%" == "x86" ( +devenv /rebuild "debug|Win32" google-glog.sln /project libglog_static +devenv /rebuild "release|Win32" google-glog.sln /project libglog_static +) + + +echo. +echo If this failed, just add "typedef size_t ssize_t;" in logging.cc +echo. + +copy Debug\libglog_static.lib %DEST_DIR%\lib\libglog_static_d.lib +copy Release\libglog_static.lib %DEST_DIR%\lib\libglog_static.lib +mkdir %DEST_DIR%\include\glog +xcopy src\windows\glog %DEST_DIR%\include /s /e + + +:DONE +pause \ No newline at end of file diff --git a/contrib/build-scripts/build-libevent-ios.sh b/contrib/build-scripts/build-libevent-ios.sh new file mode 100755 index 0000000..1060f12 --- /dev/null +++ b/contrib/build-scripts/build-libevent-ios.sh @@ -0,0 +1,169 @@ +#!/bin/bash + +# +# build libevent for iOS and iOS simulator +# + +# make sure this is not set +unset MACOSX_DEPLOYMENT_TARGET + +# be ridiculously conservative with regard to ios features +export IPHONEOS_DEPLOYMENT_TARGET="1.0" + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +#SDK_VER="6.1" +SDK_VER="5.1" +DEST_DIR="${DIR}/../prebuilt/ios/${SDK_VER}-libevent-build" + +if [ ! -f event.c ]; then + echo + echo "Cannot find event.c" + echo "Run script from within libevent directory:" + echo "libevent $ ../../${ME}" + echo + exit +fi + +mkdir -p ${DEST_DIR} &> /dev/null + +# see http://stackoverflow.com/questions/2424770/floating-point-comparison-in-shell-script +if [ $(bc <<< "$SDK_VER >= 6.1") -eq 1 ]; then + DEV_ARCHS="-arch armv7 -arch armv7s" +elif [ $(bc <<< "$SDK_VER >= 5.1") -eq 1 ]; then + DEV_ARCHS="-arch armv6 -arch armv7" +else + echo + echo "Building for SDK < 5.1 not supported" + exit +fi + +# +# Build for Device +# +if [ ! -d ${DEST_DIR}/device ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneOS${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/device &> /dev/null + + ./configure \ + CPP="cpp" \ + CXXCPP="cpp" \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + CXXFLAGS="-O -isysroot ${SYSROOT} ${DEV_ARCHS}" \ + --disable-debug-mode \ + --disable-libevent-regress \ + --disable-openssl \ + --host=arm-apple-darwin10 \ + --target=arm-apple-darwin10 \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} ${DEV_ARCHS}" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/device + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +# +# Simulator +# +if [ ! -d ${DEST_DIR}/simulator ]; then + + TOOLCHAIN_ROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer" + SYSROOT="${TOOLCHAIN_ROOT}/SDKs/iPhoneSimulator${SDK_VER}.sdk" + + if [ ! -d ${SYSROOT} ]; then + echo + echo "Cannot find iOS developer tools at ${SYSROOT}." + echo + exit + fi + + if [ -f Makefile ]; then + make clean + fi + + mkdir -p ${DEST_DIR}/simulator &> /dev/null + + ./configure \ + CXX=${TOOLCHAIN_ROOT}/usr/bin/llvm-g++ \ + CC=${TOOLCHAIN_ROOT}/usr/bin/llvm-gcc \ + LD=${TOOLCHAIN_ROOT}/usr/bin/ld\ -r \ + CFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + CXXFLAGS="-O -isysroot ${SYSROOT} -arch i386" \ + --disable-debug-mode \ + --disable-libevent-regress \ + --disable-openssl \ + --disable-shared \ + --disable-dependency-tracking \ + LDFLAGS="-isysroot ${SYSROOT} -arch i386" \ + AR=${TOOLCHAIN_ROOT}/usr/bin/ar \ + AS=${TOOLCHAIN_ROOT}/usr/bin/as \ + LIBTOOL=${TOOLCHAIN_ROOT}/usr/bin/libtool \ + STRIP=${TOOLCHAIN_ROOT}/usr/bin/strip \ + RANLIB=${TOOLCHAIN_ROOT}/usr/bin/ranlib \ + --prefix=${DEST_DIR}/simulator + + make -j2 install +else + echo + echo "${DEST_DIR}/device already exists - not rebuilding." + echo +fi + +echo +echo "- Creating universal binaries --------------------------------------" +echo + +LIBS=`find ${DIR}/../prebuilt/ios/*libevent-build* -name *.a` +set +e +for LIB in ${LIBS}; do + LIB_BASE=`basename $LIB .a` + ARCHS=`lipo -info $LIB` + ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'` + for ARCH in ${ARCHS}; do + mkdir -p ${DIR}/../prebuilt/ios/arch/${ARCH} > /dev/null + lipo -extract $ARCH $LIB -output ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a \ + || cp $LIB ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB_BASE}.a + UNIQUE_LIBS=`ls ${DIR}/../prebuilt/ios/arch/${ARCH}` + done +done + +mkdir -p ${DIR}/../prebuilt/ios/lib +for LIB in ${UNIQUE_LIBS}; do + FILELIST="" + for ARCH in `ls ${DIR}/../prebuilt/ios/arch/`; do + FILELIST="${FILELIST} ${DIR}/../prebuilt/ios/arch/${ARCH}/${LIB}" + done + lipo -create ${FILELIST} -output ${DIR}/../prebuilt/ios/lib/${LIB} +done + +rm -rf ${DIR}/../prebuilt/ios/arch/ diff --git a/contrib/build-scripts/build-libevent-linux.sh b/contrib/build-scripts/build-libevent-linux.sh new file mode 100755 index 0000000..1bd2808 --- /dev/null +++ b/contrib/build-scripts/build-libevent-linux.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# +# build libevent for MacOSX +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +CPUARCH=`uname -m` +DEST_DIR="${DIR}/../prebuilt/linux-${CPUARCH}/gnu" + +if [ ! -f event.c ]; then + echo + echo "Cannot find event.c" + echo "Run script from within libevent directory" + echo + exit +fi + +rm lib*.a + +if [ -f Makefile ]; then + make clean +fi + +./configure \ +CFLAGS="-g" \ +CXXFLAGS="-g" \ +LDFLAGS="-g" \ +--enable-gcc-hardening \ +--with-pic \ +--prefix=${DEST_DIR} + +make +cp ./.libs/libevent.a ./libevent_d.a +cp ./.libs/libevent_core.a ./libevent_core_d.a +cp ./.libs/libevent_extra.a ./libevent_extra_d.a +cp ./.libs/libevent_openssl.a ./libevent_openssl_d.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads_d.a +make install # once for headers +rm ${DEST_DIR}/lib/libevent* +make clean + + +./configure \ +--enable-gcc-hardening \ +--with-pic \ +--disable-debug-mode \ +--disable-libevent-install + +make +cp ./.libs/libevent.a ./libevent.a +cp ./.libs/libevent_core.a ./libevent_core.a +cp ./.libs/libevent_extra.a ./libevent_extra.a +cp ./.libs/libevent_openssl.a ./libevent_openssl.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads.a +make clean + +cp ./*.a ${DEST_DIR}/lib diff --git a/contrib/build-scripts/build-libevent-macosx.sh b/contrib/build-scripts/build-libevent-macosx.sh new file mode 100755 index 0000000..8c00242 --- /dev/null +++ b/contrib/build-scripts/build-libevent-macosx.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# +# build libevent for MacOSX +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +DEST_DIR="${DIR}/../prebuilt/darwin-i386/gnu" + +if [ ! -f event.c ]; then + echo + echo "Cannot find event.c" + echo "Run script from within libevent directory" + echo + exit +fi + +if [ -f Makefile ]; then + make clean +fi + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch x86_64" \ +--enable-gcc-hardening \ +--with-pic \ +--prefix=${DEST_DIR} + +# not available on 10.6 +sed -iold s/define\ HAVE_ARC4RANDOM_BUF\ 1/undef\ HAVE_ARC4RANDOM_BUF/ config.h + +make +cp ./.libs/libevent.a ./libevent_d.x86_64.a +cp ./.libs/libevent_core.a ./libevent_core_d.x86_64.a +cp ./.libs/libevent_extra.a ./libevent_extra_d.x86_64.a +cp ./.libs/libevent_openssl.a ./libevent_openssl_d.x86_64.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads_d.x86_64.a +make install # once for headers +rm ${DEST_DIR}/lib/libevent* +make clean + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch x86_64" \ +--enable-gcc-hardening \ +--with-pic \ +--disable-debug-mode \ +--disable-libevent-install + +sed -iold s/define\ HAVE_ARC4RANDOM_BUF\ 1/undef\ HAVE_ARC4RANDOM_BUF/ config.h + +make +cp ./.libs/libevent.a ./libevent.x86_64.a +cp ./.libs/libevent_core.a ./libevent_core.x86_64.a +cp ./.libs/libevent_extra.a ./libevent_extra.x86_64.a +cp ./.libs/libevent_openssl.a ./libevent_openssl.x86_64.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads.x86_64.a +make clean + + +./configure \ +CFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-g -mmacosx-version-min=10.6 -arch i386" \ +--enable-gcc-hardening \ +--with-pic \ +--disable-libevent-install + +sed -iold s/define\ HAVE_ARC4RANDOM_BUF\ 1/undef\ HAVE_ARC4RANDOM_BUF/ config.h + +make +cp ./.libs/libevent.a ./libevent_d.i386.a +cp ./.libs/libevent_core.a ./libevent_core_d.i386.a +cp ./.libs/libevent_extra.a ./libevent_extra_d.i386.a +cp ./.libs/libevent_openssl.a ./libevent_openssl_d.i386.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads_d.i386.a +make clean + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch i386" \ +--enable-gcc-hardening \ +--with-pic \ +--disable-debug-mode \ +--disable-libevent-install + +sed -iold s/define\ HAVE_ARC4RANDOM_BUF\ 1/undef\ HAVE_ARC4RANDOM_BUF/ config.h + +make +cp ./.libs/libevent.a ./libevent.i386.a +cp ./.libs/libevent_core.a ./libevent_core.i386.a +cp ./.libs/libevent_extra.a ./libevent_extra.i386.a +cp ./.libs/libevent_openssl.a ./libevent_openssl.i386.a +cp ./.libs/libevent_pthreads.a ./libevent_pthreads.i386.a +make clean + +lipo -create ./libevent.i386.a ./libevent.x86_64.a -output ${DEST_DIR}/lib/libevent.a +lipo -create ./libevent_core.i386.a ./libevent_core.x86_64.a -output ${DEST_DIR}/lib/libevent_core.a +lipo -create ./libevent_extra.i386.a ./libevent_extra.x86_64.a -output ${DEST_DIR}/lib/libevent_extra.a +lipo -create ./libevent_openssl.i386.a ./libevent_openssl.x86_64.a -output ${DEST_DIR}/lib/libevent_openssl.a +lipo -create ./libevent_pthreads.i386.a ./libevent_pthreads.x86_64.a -output ${DEST_DIR}/lib/libevent_pthreads.a + +lipo -create ./libevent_d.i386.a ./libevent_d.x86_64.a -output ${DEST_DIR}/lib/libevent_d.a +lipo -create ./libevent_core_d.i386.a ./libevent_core_d.x86_64.a -output ${DEST_DIR}/lib/libevent_core_d.a +lipo -create ./libevent_extra_d.i386.a ./libevent_extra_d.x86_64.a -output ${DEST_DIR}/lib/libevent_extra_d.a +lipo -create ./libevent_openssl_d.i386.a ./libevent_openssl_d.x86_64.a -output ${DEST_DIR}/lib/libevent_openssl_d.a +lipo -create ./libevent_pthreads_d.i386.a ./libevent_pthreads_d.x86_64.a -output ${DEST_DIR}/lib/libevent_pthreads_d.a diff --git a/contrib/build-scripts/build-libevent-windows.bat b/contrib/build-scripts/build-libevent-windows.bat new file mode 100644 index 0000000..1f619b5 --- /dev/null +++ b/contrib/build-scripts/build-libevent-windows.bat @@ -0,0 +1,51 @@ +@ECHO off + +set ME=%0 +set DIR=%~dp0 + +if "%VSINSTALLDIR%" == "" ( + echo. + echo %VSINSTALLDIR is not defined, run from within Visual Studio Command Prompt. + echo. + goto :DONE +) + +echo %LIB% |find "LIB\amd64;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86_64/msvc" + goto :ARCH_FOUND +) + +echo %LIB% |find "LIB;" > nul +if %errorlevel% == 0 ( + set DEST_DIR="%DIR%..\prebuilt\windows-x86/msvc" + goto :ARCH_FOUND +) + +:ARCH_FOUND + +if "%DEST_DIR%" == "" ( + echo. + echo Unknown Platform %Platform%. + echo. + goto :DONE +) + +IF NOT EXIST "event.c" ( + echo. + echo Cannot find event.c + echo Run script from within libevent directory: + echo libevent $ ..\%ME% + echo. + goto :DONE +) + +nmake -f Makefile.nmake clean +nmake -f Makefile.nmake + +copy libevent_core.lib %DEST_DIR%\lib +copy libevent_extras.lib %DEST_DIR%\lib +copy libevent.lib %DEST_DIR%\lib + +:DONE +pause \ No newline at end of file diff --git a/contrib/build-scripts/build-swi-linux.sh b/contrib/build-scripts/build-swi-linux.sh new file mode 100755 index 0000000..7b32d4d --- /dev/null +++ b/contrib/build-scripts/build-swi-linux.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +# +# build SWI Prolog for Linux +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +CPUARCH=`uname -m` +#DEST_DIR="${DIR}/../prebuilt/linux-${CPUARCH}/gnu" +DEST_DIR="/home/sradomski/Desktop" +VERSION=`cat VERSION` + +if [ ! -f src/pl-main.c ]; then + echo + echo "Cannot find src/pl-main.c" + echo "Run script from within SWI prolog directory:" + echo "pl-devel$ ../../${ME}" + echo + exit +fi + +./prepare +cd src +if [ -f Makefile ]; then + make clean +fi + +#CPPFLAGS="-DHAVE_CURSES_H=0 -DHAVE_TGETENT=0 -DHAVE_TCSETATTR=0 -DHAVE_TERM_H=0 -DHAVE_LIBNCURSES=0" \ + +./configure \ +CFLAGS="" \ +CXXFLAGS="" \ +LDFLAGS="" \ +--disable-gmp --disable-readline \ +--prefix=${DEST_DIR} + +sed -ie 's/define HAVE_CURSES_H 1/undef HAVE_CURSES_H/' config.h +sed -ie 's/define HAVE_TGETENT 1/undef HAVE_TGETENT/' config.h +sed -ie 's/define HAVE_TCSETATTR 1/undef HAVE_TCSETATTR/' config.h +sed -ie 's/define HAVE_TERM_H 1/undef HAVE_TERM_H/' config.h +sed -ie 's/define HAVE_LIBNCURSES 1/undef HAVE_LIBNCURSES/' config.h + +make -j2 +make install +make clean + +cd ../packages/cpp +# ./configure --prefix=${DEST_DIR} +# make install + +cp SWI-cpp.h ${DEST_DIR}/lib/swipl-${VERSION}/include + +# export PATH=$PATH:${DEST_DIR}/lib/swipl-6.3.5/bin/x86_64-darwin12.2.0/ + + +rm -rf ${DEST_DIR}/bin +rm -rf ${DEST_DIR}/share +rm -rf ${DEST_DIR}/lib/pkgconfig \ No newline at end of file diff --git a/contrib/build-scripts/build-swi-macosx.sh b/contrib/build-scripts/build-swi-macosx.sh new file mode 100755 index 0000000..2bea261 --- /dev/null +++ b/contrib/build-scripts/build-swi-macosx.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# +# build SWI Prolog for MacOSX +# + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +DEST_DIR="${DIR}/../prebuilt/darwin-i386/gnu" +VERSION=`cat VERSION` + +if [ ! -f src/pl-main.c ]; then + echo + echo "Cannot find src/pl-main.c" + echo "Run script from within SWI prolog directory:" + echo "pl-devel$ ../../${ME}" + echo + exit +fi + +./prepare +cd src +if [ -f Makefile ]; then + make clean +fi + +#CPPFLAGS="-DHAVE_CURSES_H=0 -DHAVE_TGETENT=0 -DHAVE_TCSETATTR=0 -DHAVE_TERM_H=0 -DHAVE_LIBNCURSES=0" \ + +./configure \ +CFLAGS="-mmacosx-version-min=10.6 -arch x86_64 -arch i386" \ +CXXFLAGS="-mmacosx-version-min=10.6 -arch x86_64 -arch i386" \ +LDFLAGS="-mmacosx-version-min=10.6 -arch x86_64 -arch i386" \ +--disable-gmp --disable-readline \ +--prefix=${DEST_DIR} + +sed -ie 's/define HAVE_CURSES_H 1/undef HAVE_CURSES_H/' config.h +sed -ie 's/define HAVE_TGETENT 1/undef HAVE_TGETENT/' config.h +sed -ie 's/define HAVE_TCSETATTR 1/undef HAVE_TCSETATTR/' config.h +sed -ie 's/define HAVE_TERM_H 1/undef HAVE_TERM_H/' config.h +sed -ie 's/define HAVE_LIBNCURSES 1/undef HAVE_LIBNCURSES/' config.h + +make -j2 +make install +make clean + +cd ../packages/cpp +# ./configure --prefix=${DEST_DIR} +# make install + +cp SWI-cpp.h ${DEST_DIR}/lib/swipl-${VERSION}/include + +# export PATH=$PATH:${DEST_DIR}/lib/swipl-6.3.5/bin/x86_64-darwin12.2.0/ + + +rm -rf ${DEST_DIR}/bin +rm -rf ${DEST_DIR}/share +rm -rf ${DEST_DIR}/lib/pkgconfig \ No newline at end of file diff --git a/contrib/build-scripts/build-uscxml-ios.sh b/contrib/build-scripts/build-uscxml-ios.sh new file mode 100755 index 0000000..fccea19 --- /dev/null +++ b/contrib/build-scripts/build-uscxml-ios.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# +# build all of uscxml for iOS and iOS simulator +# + +# make sure this is not set +unset MACOSX_DEPLOYMENT_TARGET + +# be ridiculously conservative with regard to ios features +export IPHONEOS_DEPLOYMENT_TARGET="1.0" + +# exit on error +set -e + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" +SDK_VER="6.1" +CWD=`pwd` +BUILD_DIR="/tmp/build-uscxml-ios" + +#rm -rf ${BUILD_DIR} && mkdir -p ${BUILD_DIR} &> /dev/null + +# +# Build device with older SDK for old architectures +# +export IOS_SDK_VERSION=5.1 + +mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug &> /dev/null +cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Debug +make -j4 + +mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release &> /dev/null +cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Release +make -j4 + +# +# Build device with current SDK +# +export IOS_SDK_VERSION=6.1 + +mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug &> /dev/null +cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Debug +make -j4 + +mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug &> /dev/null +cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Debug +make -j4 + +mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release &> /dev/null +cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Release +make -j4 + +mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release &> /dev/null +cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release +cmake ${DIR}/../../ -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake -DDIST_PREPARE=ON -DCMAKE_BUILD_TYPE=Release +make -j4 + +# +# Create universal binary +# + +LIBS=`find ${DIR}/../../package/cross-compiled/ios-* -name *.a` +set +e +for LIB in ${LIBS}; do + LIB_BASE=`basename $LIB .a` + ARCHS=`lipo -info $LIB` + ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'` + for ARCH in ${ARCHS}; do + mkdir -p ${DIR}/../../package/cross-compiled/ios/arch/${ARCH} > /dev/null + lipo -extract $ARCH $LIB -output ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB_BASE}.a \ + || cp $LIB ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB_BASE}.a + UNIQUE_LIBS=`ls ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}` + done +done + +mkdir -p ${DIR}/../../package/cross-compiled/ios/lib &> /dev/null + +for LIB in ${UNIQUE_LIBS}; do + FILELIST="" + for ARCH in `ls ${DIR}/../../package/cross-compiled/ios/arch/`; do + FILELIST="${FILELIST} ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB}" + done + lipo -create ${FILELIST} -output ${DIR}/../../package/cross-compiled/ios/lib/${LIB} +done + +# rm -rf ${DIR}/../../package/cross-compiled/ios/arch +# rm -rf ${DIR}/../../package/cross-compiled/ios-*/ diff --git a/contrib/cmake/USCXMLMacros.cmake b/contrib/cmake/USCXMLMacros.cmake index d5ea05f..76e1121 100644 --- a/contrib/cmake/USCXMLMacros.cmake +++ b/contrib/cmake/USCXMLMacros.cmake @@ -57,3 +57,19 @@ function(INSTALL_EXECUTABLE) PERMISSIONS WORLD_EXECUTE OWNER_EXECUTE GROUP_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ) endfunction() +# see http://www.cmake.org/Wiki/CMakeCompareVersionStrings +SET(THREE_PART_VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+") + +# Breaks up a string in the form n1.n2.n3 into three parts and stores +# them in major, minor, and patch. version should be a value, not a +# variable, while major, minor and patch should be variables. +MACRO(THREE_PART_VERSION_TO_VARS version major minor patch) + IF(${version} MATCHES ${THREE_PART_VERSION_REGEX}) + STRING(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" ${major} "${version}") + STRING(REGEX REPLACE "^[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" ${minor} "${version}") + STRING(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" ${patch} "${version}") + ELSE(${version} MATCHES ${THREE_PART_VERSION_REGEX}) + MESSAGE("MACRO(THREE_PART_VERSION_TO_VARS ${version} ${major} ${minor} ${patch}") + MESSAGE(FATAL_ERROR "Problem parsing version string, I can't parse it properly.") + ENDIF(${version} MATCHES ${THREE_PART_VERSION_REGEX}) +ENDMACRO(THREE_PART_VERSION_TO_VARS) diff --git a/contrib/local/compress_and_upload_deps.sh b/contrib/local/compress_and_upload_deps.sh index a9d3936..d9ac787 100755 --- a/contrib/local/compress_and_upload_deps.sh +++ b/contrib/local/compress_and_upload_deps.sh @@ -31,12 +31,12 @@ cd ../prebuilt ssh ${USCXML_PREBUILT_HOST} mkdir -p ${USCXML_PREBUILT_PATH}/${VERSION} PLATFORMS=`find . -maxdepth 1 -type d -regex ./[^\.].*` -#PLATFORMS="windows-x86_64" +PLATFORMS="darwin-i386" for FILE in ${PLATFORMS}; do PLATFORM=`basename $FILE` if [ "$PLATFORM" != "include" ]; then echo $FILE - tar cvzf uscxml-prebuilt-${PLATFORM}.tgz ${FILE} + tar cvzf uscxml-prebuilt-${PLATFORM}.tgz --exclude='VERSION.txt' ${FILE} scp uscxml-prebuilt-${PLATFORM}.tgz ${USCXML_PREBUILT_HOST}:${USCXML_PREBUILT_PATH}/${VERSION} rm uscxml-prebuilt-${PLATFORM}.tgz else -- cgit v0.12