Skip to content

Commit c966f9c

Browse files
author
Arun Veluri
committed
Added some modified scripts that worked, and also the libXML one
1 parent 11b90af commit c966f9c

File tree

7 files changed

+583
-0
lines changed

7 files changed

+583
-0
lines changed

tools/worked_tested/_shared.sh

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
3+
TOOLS_ROOT=`pwd`
4+
5+
#
6+
# Warning !!! Android Build !!!
7+
#
8+
# Default to API 21 for it is the minimum requirement for 64 bit archs.
9+
# IF you need to build for min api level 16, you need to modify it to 14 and will not build for 64 bit archs.
10+
# api level 16 build is better because api level 21 and higher may have problem like
11+
#
12+
# https://github.com/openssl/openssl/issues/988
13+
# http://stackoverflow.com/questions/37122126/whats-the-exact-significance-of-android-ndk-platform-version-compared-to-api-le
14+
#
15+
# So if you not need 64 bit arch api level 16 is better
16+
#
17+
# But but but cURL could not build by android-20 and earlier :-(
18+
# So you can build openssl with android-16 then build cURL with android-21
19+
#
20+
#if [ "${1}" == "cURL" ]; then
21+
#ANDROID_API=${ANDROID_API:-21}
22+
#else
23+
#ANDROID_API=${ANDROID_API:-16}
24+
#fi
25+
#ARCHS=("android" "android-armeabi" "android-x86" "android-mips")
26+
#ABIS=("armeabi" "armeabi-v7a" "x86" "mips")
27+
ANDROID_API=${ANDROID_API:-21}
28+
ARCHS=("android" "android-armeabi" "android64-aarch64" "android-x86" "android64" "android-mips" "android-mips64")
29+
ABIS=("armeabi" "armeabi-v7a" "arm64-v8a" "x86" "x86_64" "mips" "mips64")
30+
NDK=${ANDROID_NDK}
31+
32+
configure() {
33+
ARCH=$1; OUT=$2; CLANG=${3:-""};
34+
35+
TOOLCHAIN_ROOT=${TOOLS_ROOT}/${OUT}-android-toolchain
36+
37+
if [ "$ARCH" == "android" ]; then
38+
export ARCH_FLAGS="-mthumb"
39+
export ARCH_LINK=""
40+
export TOOL="arm-linux-androideabi"
41+
NDK_FLAGS="--arch=arm"
42+
elif [ "$ARCH" == "android-armeabi" ]; then
43+
export ARCH_FLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -mfpu=neon"
44+
export ARCH_LINK="-march=armv7-a -Wl,--fix-cortex-a8"
45+
export TOOL="arm-linux-androideabi"
46+
NDK_FLAGS="--arch=arm"
47+
elif [ "$ARCH" == "android64-aarch64" ]; then
48+
export ARCH_FLAGS=""
49+
export ARCH_LINK=""
50+
export TOOL="aarch64-linux-android"
51+
NDK_FLAGS="--arch=arm64"
52+
elif [ "$ARCH" == "android-x86" ]; then
53+
export ARCH_FLAGS="-march=i686 -mtune=intel -msse3 -mfpmath=sse -m32"
54+
export ARCH_LINK=""
55+
export TOOL="i686-linux-android"
56+
NDK_FLAGS="--arch=x86"
57+
elif [ "$ARCH" == "android64" ]; then
58+
export ARCH_FLAGS="-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
59+
export ARCH_LINK=""
60+
export TOOL="x86_64-linux-android"
61+
NDK_FLAGS="--arch=x86_64"
62+
elif [ "$ARCH" == "android-mips" ]; then
63+
export ARCH_FLAGS=""
64+
export ARCH_LINK=""
65+
export TOOL="mipsel-linux-android"
66+
NDK_FLAGS="--arch=mips"
67+
elif [ "$ARCH" == "android-mips64" ]; then
68+
export ARCH="linux64-mips64"
69+
export ARCH_FLAGS=""
70+
export ARCH_LINK=""
71+
export TOOL="mips64el-linux-android"
72+
NDK_FLAGS="--arch=mips64"
73+
fi;
74+
75+
[ -d ${TOOLCHAIN_ROOT} ] || python $NDK/build/tools/make_standalone_toolchain.py \
76+
--api ${ANDROID_API} \
77+
--stl libc++ \
78+
--install-dir=${TOOLCHAIN_ROOT} \
79+
$NDK_FLAGS
80+
81+
export TOOLCHAIN_PATH=${TOOLCHAIN_ROOT}/bin
82+
export NDK_TOOLCHAIN_BASENAME=${TOOLCHAIN_PATH}/${TOOL}
83+
export SYSROOT=${TOOLCHAIN_ROOT}/sysroot
84+
export CROSS_SYSROOT=$SYSROOT
85+
if [ -z "${CLANG}" ]; then
86+
export CC=${NDK_TOOLCHAIN_BASENAME}-gcc
87+
export CXX=${NDK_TOOLCHAIN_BASENAME}-g++
88+
else
89+
export CC=${NDK_TOOLCHAIN_BASENAME}-clang
90+
export CXX=${NDK_TOOLCHAIN_BASENAME}-clang++
91+
fi;
92+
export LINK=${CXX}
93+
export LD=${NDK_TOOLCHAIN_BASENAME}-ld
94+
export AR=${NDK_TOOLCHAIN_BASENAME}-ar
95+
export RANLIB=${NDK_TOOLCHAIN_BASENAME}-ranlib
96+
export STRIP=${NDK_TOOLCHAIN_BASENAME}-strip
97+
export CPPFLAGS=${CPPFLAGS:-""}
98+
export LIBS=${LIBS:-""}
99+
export CFLAGS="${ARCH_FLAGS} -fpic -ffunction-sections -funwind-tables -fstack-protector -fno-strict-aliasing -finline-limit=64"
100+
export CXXFLAGS="${CFLAGS} -std=c++11 -frtti -fexceptions"
101+
export LDFLAGS="${ARCH_LINK}"
102+
echo "**********************************************"
103+
echo "use ANDROID_API=${ANDROID_API}"
104+
echo "use NDK=${NDK}"
105+
echo "export ARCH=${ARCH}"
106+
echo "export NDK_TOOLCHAIN_BASENAME=${NDK_TOOLCHAIN_BASENAME}"
107+
echo "export SYSROOT=${SYSROOT}"
108+
echo "export CC=${CC}"
109+
echo "export CXX=${CXX}"
110+
echo "export LINK=${LINK}"
111+
echo "export LD=${LD}"
112+
echo "export AR=${AR}"
113+
echo "export RANLIB=${RANLIB}"
114+
echo "export STRIP=${STRIP}"
115+
echo "export CPPFLAGS=${CPPFLAGS}"
116+
echo "export CFLAGS=${CFLAGS}"
117+
echo "export CXXFLAGS=${CXXFLAGS}"
118+
echo "export LDFLAGS=${LDFLAGS}"
119+
echo "export LIBS=${LIBS}"
120+
echo "**********************************************"
121+
}

tools/worked_tested/arm64_command

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sh ./build-xml4android.sh android64-aarch64
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2016 leenjewel
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -u
18+
19+
source ./_shared.sh cURL
20+
21+
# Setup architectures, library name and other vars + cleanup from previous runs
22+
TOOLS_ROOT=`pwd`
23+
#LIB_NAME="curl-7.54.1"
24+
LIB_NAME="curl-7.49.1"
25+
LIB_DEST_DIR=${TOOLS_ROOT}/libs
26+
[ -f ${LIB_NAME}.tar.gz ] || wget https://curl.haxx.se/download/${LIB_NAME}.tar.gz
27+
# Unarchive library, then configure and make for specified architectures
28+
configure_make() {
29+
ARCH=$1; ABI=$2;
30+
[ -d "${LIB_NAME}" ] && rm -rf "${LIB_NAME}"
31+
tar xfz "${LIB_NAME}.tar.gz"
32+
pushd "${LIB_NAME}";
33+
34+
configure $*
35+
# fix me
36+
cp ${TOOLS_ROOT}/../output/android/openssl-${ABI}/lib/libssl.a ${SYSROOT}/usr/lib
37+
cp ${TOOLS_ROOT}/../output/android/openssl-${ABI}/lib/libcrypto.a ${SYSROOT}/usr/lib
38+
cp -r ${TOOLS_ROOT}/../output/android/openssl-${ABI}/include/openssl ${SYSROOT}/usr/include
39+
40+
mkdir -p ${LIB_DEST_DIR}/${ABI}
41+
./configure --prefix=${LIB_DEST_DIR}/${ABI} \
42+
--with-sysroot=${SYSROOT} \
43+
--host=${TOOL} \
44+
--with-ssl=/usr \
45+
--enable-ipv6 \
46+
--enable-static \
47+
--enable-threaded-resolver \
48+
--disable-dict \
49+
--disable-gopher \
50+
--disable-ldap --disable-ldaps \
51+
--disable-manual \
52+
--disable-pop3 --disable-smtp --disable-imap \
53+
--disable-rtsp \
54+
--disable-shared \
55+
--disable-smb \
56+
--disable-telnet \
57+
--disable-verbose
58+
PATH=$TOOLCHAIN_PATH:$PATH
59+
make clean
60+
if make -j4
61+
then
62+
make install
63+
64+
OUTPUT_ROOT=${TOOLS_ROOT}/../output/android/curl-${ABI}
65+
[ -d ${OUTPUT_ROOT}/include ] || mkdir -p ${OUTPUT_ROOT}/include
66+
cp -r ${LIB_DEST_DIR}/${ABI}/include/curl ${OUTPUT_ROOT}/include
67+
68+
[ -d ${OUTPUT_ROOT}/lib ] || mkdir -p ${OUTPUT_ROOT}/lib
69+
cp ${LIB_DEST_DIR}/${ABI}/lib/libcurl.a ${OUTPUT_ROOT}/lib
70+
fi;
71+
popd;
72+
}
73+
74+
for ((i=0; i < ${#ARCHS[@]}; i++))
75+
do
76+
if [[ $# -eq 0 ]] || [[ "$1" == "${ARCHS[i]}" ]]; then
77+
[[ ${ANDROID_API} < 21 ]] && ( echo "${ABIS[i]}" | grep 64 > /dev/null ) && continue;
78+
configure_make "${ARCHS[i]}" "${ABIS[i]}"
79+
fi
80+
done

tools/worked_tested/build-curl4ios.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/bin/bash
2+
#
3+
# Copyright 2016 leenjewel
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -u
18+
19+
SOURCE="$0"
20+
while [ -h "$SOURCE" ]; do
21+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
22+
SOURCE="$(readlink "$SOURCE")"
23+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
24+
done
25+
pwd_path="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
26+
27+
28+
# Setup architectures, library name and other vars + cleanup from previous runs
29+
ARCHS=("arm64" "armv7s" "armv7" "i386" "x86_64")
30+
SDKS=("iphoneos" "iphoneos" "iphoneos" "iphonesimulator" "iphonesimulator")
31+
PLATFORMS=("iPhoneOS" "iPhoneOS" "iPhoneOS" "iPhoneSimulator" "iPhoneSimulator")
32+
LIB_NAME="curl-7.53.1"
33+
DEVELOPER=`xcode-select -print-path`
34+
TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
35+
# If you can't compile with this version, please modify the version to it which on your mac.
36+
SDK_VERSION=""10.3""
37+
IPHONEOS_DEPLOYMENT_TARGET="6.0"
38+
LIB_DEST_DIR="${pwd_path}/../output/ios/curl-universal"
39+
HEADER_DEST_DIR="include"
40+
rm -rf "${HEADER_DEST_DIR}" "${LIB_DEST_DIR}" "${LIB_NAME}"
41+
42+
# Unarchive library, then configure and make for specified architectures
43+
configure_make()
44+
{
45+
ARCH=$1; SDK=$2; PLATFORM=$3;
46+
47+
export PATH="${TOOLCHAIN}/usr/bin:${PATH}"
48+
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
49+
export CROSS_SDK="${PLATFORM}${SDK_VERSION}.sdk"
50+
export SYSROOT="${CROSS_TOP}/SDKs/${CROSS_SDK}"
51+
export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SYSROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
52+
export LDFLAGS="-arch ${ARCH} -isysroot ${SYSROOT}"
53+
54+
if [ -d "${LIB_NAME}" ]; then
55+
rm -fr "${LIB_NAME}"
56+
fi
57+
58+
tar xfz "${LIB_NAME}.tar.gz"
59+
pushd .; cd "${LIB_NAME}";
60+
61+
PREFIX_DIR="${pwd_path}/../output/ios/curl-${ARCH}"
62+
if [ -d "${PREFIX_DIR}" ]; then
63+
rm -fr "${PREFIX_DIR}"
64+
fi
65+
mkdir -p "${PREFIX_DIR}"
66+
67+
if [ "${ARCH}" == "arm64" ]; then
68+
HOST="--host=arm-apple-darwin"
69+
else
70+
HOST="--host=${ARCH}-apple-darwin"
71+
fi
72+
./configure --prefix=${PREFIX_DIR} \
73+
--with-sysroot=${CROSS_TOP}/SDKs/${CROSS_SDK} \
74+
${HOST} \
75+
--with-darwinssl \
76+
--enable-static \
77+
--disable-shared \
78+
--disable-verbose \
79+
--enable-threaded-resolver \
80+
--enable-ipv6
81+
make clean
82+
if make -j8
83+
then
84+
if [[ -d "curl-${ARCH}" ]]; then
85+
rm -fr "curl-${ARCH}"
86+
fi
87+
mkdir -p "curl-${ARCH}"
88+
make install
89+
popd; rm -fr ${LIB_NAME}
90+
fi
91+
}
92+
for ((i=0; i < ${#ARCHS[@]}; i++))
93+
do
94+
if [[ $# -eq 0 || "$1" == "${ARCHS[i]}" ]]; then
95+
configure_make "${ARCHS[i]}" "${SDKS[i]}" "${PLATFORMS[i]}"
96+
fi
97+
done
98+
99+
# Combine libraries for different architectures into one
100+
# Use .a files from the temp directory by providing relative paths
101+
create_lib()
102+
{
103+
LIB_SRC=$1; LIB_DST=$2;
104+
LIB_PATHS=( "${ARCHS[@]/#/${pwd_path}/../output/ios/curl-}" )
105+
LIB_PATHS=( "${LIB_PATHS[@]/%//${LIB_SRC}}" )
106+
lipo ${LIB_PATHS[@]} -create -output "${LIB_DST}"
107+
}
108+
mkdir "${LIB_DEST_DIR}";
109+
create_lib "lib/libcurl.a" "${LIB_DEST_DIR}/libcurl.a"
110+

0 commit comments

Comments
 (0)