Skip to content

Commit

Permalink
added minizip, icu and pion libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
mevansam committed Mar 14, 2012
1 parent dccdf35 commit d7dae4f
Show file tree
Hide file tree
Showing 8 changed files with 318 additions and 0 deletions.
12 changes: 12 additions & 0 deletions build-droid/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ fi
export ZLIB_VERSION="1.2.6"
export MINIZIP_VERSION="101h"

# Project version to use to build icu (changing this may break the build)
export ICU_VERSION=4.8.1.1

# Project version to use to build c-ares (changing this may break the build)
export CARES_VERSION="1.7.5"

Expand Down Expand Up @@ -55,6 +58,9 @@ export SOCI_VERSION="3.1.0"
# Project version to use to build boost C++ libraries
export BOOST_VERSION=1.48.0

# Project version to use to build pion (changing this may break the build)
export PION_VERSION=4.0.11

# Create dist folder
BUILDDIR=$(dirname $0)

Expand Down Expand Up @@ -126,6 +132,9 @@ do
# Build minizip
${TOPDIR}/build-droid/build-minizip.sh > "${LOGPATH}-minizip.log"

# Build icu
${TOPDIR}/build-droid/build-icu.sh > "${LOGPATH}-icu.log"

# Build c-ares
${TOPDIR}/build-droid/build-cares.sh > "${LOGPATH}-cares.log"

Expand Down Expand Up @@ -165,6 +174,9 @@ do
# Build BOOST
${TOPDIR}/build-droid/build-boost.sh > "${LOGPATH}-boost.log"

# Build PION
${TOPDIR}/build-droid/build-pion.sh > "${LOGPATH}-pion.log"

# Remove junk
rm -rf "${ROOTDIR}/bin"
rm -rf "${ROOTDIR}/certs"
Expand Down
114 changes: 114 additions & 0 deletions build-droid/build-icu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/bin/bash
set -e

# Copyright (c) 2010, Pierre-Olivier Latour
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * The name of Pierre-Olivier Latour may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Download source
if [ ! -e "icu4c-${ICU_VERSION//./_}-src.tgz" ]
then
curl $PROXY -O "http://download.icu-project.org/files/icu4c/4.8.1.1/icu4c-${ICU_VERSION//./_}-src.tgz"
fi

# Extract source
rm -rf "icu"
tar zxvf "icu4c-${ICU_VERSION//./_}-src.tgz"

# Build

HOSTBUILD=${TMPDIR}/icu/hostbuild

mkdir -p "icu/hostbuild"
pushd "icu/hostbuild"
../source/configure --prefix="${HOSTBUILD}"
make
popd

pushd "icu/source"

tar zxvf "${TOPDIR}/build-droid/droid-icu-patch.tar.gz"

# Apply patches to icu
PATCHES_DIR=${TMPDIR}/icu/source/droid-icu-patch
if [ ! -d "$PATCHES_DIR" ] ; then
echo "ERROR: Could not locate droid build patch files."
exit 1
fi

PATCHES=`(cd $PATCHES_DIR && find . -name "*.patch" | sort) 2> /dev/null`
if [ -z "$PATCHES" ] ; then
echo "No patches files in $PATCHES_DIR"
else
PATCHES=`echo $PATCHES | sed -e s%^\./%%g`
SRC_DIR=${TMPDIR}/icu/source
for PATCH in $PATCHES; do
PATCHDIR=`dirname $PATCH`
PATCHNAME=`basename $PATCH`
echo "Applying $PATCHNAME into $SRC_DIR/$PATCHDIR"
patch -p1 < $PATCHES_DIR/$PATCH
if [ $? != 0 ] ; then
dump "ERROR: Patch failure !! Please check your patches directory! Try to perform a clean build using --clean"
exit 1
fi
done
fi

DROID_GCC_LIBS=${TMPDIR}/droidtoolchains/${PLATFORM}/lib/gcc/arm-linux-androideabi/4.4.3

export CC=${DROIDTOOLS}-gcc
export LD=${DROIDTOOLS}-ld
export CPP=${DROIDTOOLS}-cpp
export CXX=${DROIDTOOLS}-g++
export AR=${DROIDTOOLS}-ar
export AS=${DROIDTOOLS}-as
export NM=${DROIDTOOLS}-nm
export STRIP=${DROIDTOOLS}-strip
export CXXCPP=${DROIDTOOLS}-cpp
export RANLIB=${DROIDTOOLS}-ranlib

export LDFLAGS="-Os -fPIC -nostdlib -Wl,--entry=main,-rpath-link=${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${DROID_GCC_LIBS} -L${ROOTDIR}/lib -lc -lgcc"
export CFLAGS="-Os -pipe -isysroot ${SYSROOT} -I${ROOTDIR}/include -D__STDC_INT64__ -DU_HAVE_NAMESPACE=1"
export CXXFLAGS="-Os -pipe -isysroot ${SYSROOT} -I${ROOTDIR}/include -D__STDC_INT64__ -DU_HAVE_NAMESPACE=1"

if [ "${PLATFORM}" == "arm-linux-androideabi" ]
then
./configure --host=arm-eabi-linux --prefix=${ROOTDIR} --with-cross-build="${HOSTBUILD}" --enable-extras=no --enable-strict=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --with-data-packaging=archive
else
./configure --host=i386-linux --prefix=${ROOTDIR} --with-cross-build="${HOSTBUILD}" --enable-extras=no --enable-strict=no --enable-tests=no --enable-samples=no --enable-dyload=no --enable-tools=no --with-data-packaging=archive
fi

# Fix libtool to not create versioned shared libraries
#mv "libtool" "libtool~"
#sed "s/library_names_spec=\".*\"/library_names_spec=\"~##~libname~##~{shared_ext}\"/" libtool~ > libtool~1
#sed "s/soname_spec=\".*\"/soname_spec=\"~##~{libname}~##~{shared_ext}\"/" libtool~1 > libtool~2
#sed "s/~##~/\\\\$/g" libtool~2 > libtool
#chmod u+x libtool

make
make install
popd

# Clean up
rm -rf "icu"
97 changes: 97 additions & 0 deletions build-droid/build-pion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -e

# Copyright (c) 2010, Pierre-Olivier Latour
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * The name of Pierre-Olivier Latour may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Download source
if [ ! -e "pion-net-${PION_VERSION}.tar.gz" ]
then
curl $PROXY -O "http://pion.org/files/pion-net-${PION_VERSION}.tar.gz"
fi

# Extract source
rm -fr "pion-net-${PION_VERSION}"
tar zxvf "pion-net-${PION_VERSION}.tar.gz"

# Build
pushd "pion-net-${PION_VERSION}"

tar zxvf "${TOPDIR}/build-droid/droid-pion-patch.tar.gz"

# Apply patches to icu
PATCHES_DIR=${TMPDIR}/pion-net-${PION_VERSION}/droid-pion-patch
if [ ! -d "$PATCHES_DIR" ] ; then
echo "ERROR: Could not locate droid build patch files."
exit 1
fi

PATCHES=`(cd $PATCHES_DIR && find . -name "*.patch" | sort) 2> /dev/null`
if [ -z "$PATCHES" ] ; then
echo "No patches files in $PATCHES_DIR"
else
PATCHES=`echo $PATCHES | sed -e s%^\./%%g`
SRC_DIR=${TMPDIR}/icu/source
for PATCH in $PATCHES; do
PATCHDIR=`dirname $PATCH`
PATCHNAME=`basename $PATCH`
echo "Applying $PATCHNAME into $SRC_DIR/$PATCHDIR"
patch -p1 < $PATCHES_DIR/$PATCH
if [ $? != 0 ] ; then
dump "ERROR: Patch failure !! Please check your patches directory! Try to perform a clean build using --clean"
exit 1
fi
done
fi

export CC=${DROIDTOOLS}-gcc
export LD=${DROIDTOOLS}-ld
export CPP=${DROIDTOOLS}-cpp
export CXX=${DROIDTOOLS}-g++
export AR=${DROIDTOOLS}-ar
export AS=${DROIDTOOLS}-as
export NM=${DROIDTOOLS}-nm
export STRIP=${DROIDTOOLS}-strip
export CXXCPP=${DROIDTOOLS}-cpp
export RANLIB=${DROIDTOOLS}-ranlib

export LDFLAGS="-Os -fPIC -shared -L${SYSROOT}/usr/lib"
export CPPFLAGS="-Os --sysroot ${SYSROOT} -Wno-variadic-macros -fexceptions -frtti -fpic -ffunction-sections -funwind-tables -march=armv5te -mtune=xscale -msoft-float -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -DANDROID -D__ANDROID__ -DNDEBUG -D__arm__ -D_REENTRANT -D_GLIBCXX__PTHREADS -I${ROOTDIR}/include"

./configure --host=${ARCH}-android-linux --target=${PLATFORM} --enable-static --disable-shared --prefix=${ROOTDIR} --with-boost=${ROOTDIR} --with-zlib=${ROOTDIR} --with-bzlib=${ROOTDIR} --with-openssl=${ROOTDIR} --disable-logging --disable-tests --disable-doxygen-doc

# Fix libtool to not create versioned shared libraries
#mv "libtool" "libtool~"
#sed "s/library_names_spec=\".*\"/library_names_spec=\"~##~libname~##~{shared_ext}\"/" libtool~ > libtool~1
#sed "s/soname_spec=\".*\"/soname_spec=\"~##~{libname}~##~{shared_ext}\"/" libtool~1 > libtool~2
#sed "s/~##~/\\\\$/g" libtool~2 > libtool
#chmod u+x libtool

make
make install
popd

# Clean up
rm -rf "pion-net-${PION_VERSION}"
Binary file modified build-droid/droid-boost-patch.tar.gz
Binary file not shown.
Binary file added build-droid/droid-icu-patch.tar.gz
Binary file not shown.
Binary file added build-droid/droid-pion-patch.tar.gz
Binary file not shown.
31 changes: 31 additions & 0 deletions build-ios/Makefile.minizip
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
INCLUDEDIRS =

OBJS = unzip.o zip.o ioapi.o

libminizip.so : ${OBJS}
${CC} ${LDFLAGS} -o $@ $?

libminizip.a : ${OBJS}
${AR} rv $@ $?
${RANLIB} $@

ioapi.o : ioapi.c
${CC} -c $? ${CFLAGS} ${INCLUDEDIRS}

zip.o : zip.c
${CC} -c $? ${CFLAGS} ${INCLUDEDIRS}

unzip.o : unzip.c
${CC} -c $? ${CFLAGS} ${INCLUDEDIRS}

install : libminizip.a libminizip.so
if ( test ! -d ${PREFIX}/lib ) ; then mkdir -p ${PREFIX}/lib ; fi
if ( test ! -d ${PREFIX}/include/zip ) ; then mkdir -p ${PREFIX}/include/zip ; fi
mv -f libminizip.a ${PREFIX}/lib
mv -f libminizip.so ${PREFIX}/lib
cp -f *.h ${PREFIX}/include/zip
rm *.o

clean :
rm *.o
rm -f libminizip.so
64 changes: 64 additions & 0 deletions build-ios/build-minizip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
set -e

# Copyright (c) 2011, Mevan Samaratunga
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * The name of Mevan Samaratunga may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Download source
if [ ! -e "unzip${MINIZIP_VERSION}.zip" ]
then
curl $PROXY -O "http://www.winimage.com/zLibDll/unzip${MINIZIP_VERSION}.zip"
fi

# Extract source
rm -rf "unzip${MINIZIP_VERSION}"

mkdir "unzip${MINIZIP_VERSION}"
pushd "unzip${MINIZIP_VERSION}"
unzip "../unzip${MINIZIP_VERSION}.zip"

# Copy customized make files
cp -f ${TOPDIR}/build-droid/Makefile.minizip .

# Build
export CC=${DROIDTOOLS}-gcc
export LD=${DROIDTOOLS}-ld
export CPP=${DROIDTOOLS}-cpp
export CXX=${DROIDTOOLS}-g++
export AR=${DROIDTOOLS}-ar
export AS=${DROIDTOOLS}-as
export NM=${DROIDTOOLS}-nm
export STRIP=${DROIDTOOLS}-strip
export CXXCPP=${DROIDTOOLS}-cpp
export RANLIB=${DROIDTOOLS}-ranlib
export LDFLAGS="-Os -fpic -nostdlib -lc -shared -Wl,-rpath-link=${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib -L${ROOTDIR}/lib -lz"
export CFLAGS="-Os -pipe -isysroot ${SYSROOT} -I${ROOTDIR}/include -Dunix"
export CXXFLAGS="-Os -pipe -isysroot ${SYSROOT} -I${ROOTDIR}/include"

make -f Makefile.minizip install CC="${CC}" CFLAGS="${CFLAGS}" RANLIB="${RANLIB}" LDFLAGS="${LDFLAGS}" PREFIX="${ROOTDIR}"
popd

# Clean up
rm -rf unzip${MINIZIP_VERSION}

0 comments on commit d7dae4f

Please sign in to comment.