Skip to content

Commit fd321db

Browse files
authored
Build libcurl with nghttp2 (#5)
1 parent e6db935 commit fd321db

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

libcurl.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ fi
1616

1717
cd libcurl-src
1818

19-
CFLAGS="-I$ANDR_ROOT/deps/openssl-src/include -L$ANDR_ROOT/deps/openssl-src $CFLAGS" \
19+
INCLUDE_DIRS="-I$ANDR_ROOT/output/openssl/include -I$ANDR_ROOT/output/nghttp2/include"
20+
LIBRARY_DIRS="-L$ANDR_ROOT/output/openssl/lib/$TARGET_ABI -L$ANDR_ROOT/output/nghttp2/lib/$TARGET_ABI"
21+
22+
CFLAGS="$INCLUDE_DIRS $LIBRARY_DIRS $CFLAGS" \
2023
./configure --host=$TARGET \
2124
--with-openssl \
25+
--with-nghttp2 \
2226
--prefix=/ --disable-shared --enable-static \
2327
--disable-debug --disable-verbose --disable-versioned-symbols \
2428
--disable-dependency-tracking --disable-libcurl-option \

nghttp2.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash -e
2+
3+
NGHTTP2_VERSION=1.68.0
4+
5+
. ./sdk.sh
6+
7+
mkdir -p output/nghttp2/lib/$TARGET_ABI
8+
mkdir -p deps; cd deps
9+
10+
if [ ! -d nghttp2-src ]; then
11+
if [ ! -f "release-$NGHTTP2_VERSION.tar.gz" ]; then
12+
wget -O nghttp2-v$NGHTTP2_VERSION.tar.gz https://github.com/nghttp2/nghttp2/archive/v$NGHTTP2_VERSION.tar.gz
13+
fi
14+
tar -xzf nghttp2-v$NGHTTP2_VERSION.tar.gz
15+
mv nghttp2-$NGHTTP2_VERSION nghttp2-src
16+
fi
17+
18+
cd nghttp2-src
19+
20+
mkdir -p build; cd build
21+
22+
cmake .. -DANDROID_STL="c++_static" \
23+
-DANDROID_NATIVE_API_LEVEL="$NATIVE_API_LEVEL" \
24+
-DANDROID_ABI="$ANDROID_ABI" \
25+
-DANDROID_PLATFORM="$API" \
26+
-DCMAKE_BUILD_TYPE=Release \
27+
-DCMAKE_C_FLAGS="$CFLAGS" \
28+
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
29+
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
30+
-DBUILD_SHARED_LIBS=0 \
31+
-DBUILD_STATIC_LIBS=1 \
32+
-DENABLE_APP=0 \
33+
-DENABLE_HPACK_TOOLS=0 \
34+
-DENABLE_EXAMPLES=0 \
35+
-DENABLE_FAILMALLOC=0 \
36+
-DENABLE_LIB_ONLY=1 \
37+
-DENABLE_DOC=0 \
38+
-DBUILD_TESTING=0
39+
40+
cmake --build . -j
41+
42+
# update `include` folder
43+
rm -rf ../../../output/nghttp2/include/
44+
mkdir -p ../../../output/nghttp2/include/nghttp2
45+
cp -r ../lib/includes/nghttp2/*.h ../../../output/nghttp2/include/nghttp2
46+
cp -r lib/includes/nghttp2/*.h ../../../output/nghttp2/include/nghttp2
47+
# update lib
48+
rm -rf ../../../output/nghttp2/lib/$TARGET_ABI/libnghttp2.a
49+
cp -r lib/libnghttp2.a ../../../output/nghttp2/lib/$TARGET_ABI/libnghttp2.a
50+
51+
echo "nghttp2 build successful"

0 commit comments

Comments
 (0)