[PATCH 2/6] android: Add liblz4 to build
Kevin Cernekee
cernekee at gmail.com
Sun Feb 8 14:20:37 PST 2015
Includes a hack to make sure it's statically linked into
libopenconnect.so.
Signed-off-by: Kevin Cernekee <cernekee at gmail.com>
---
android/Makefile | 38 +++++++++++++++++++++++++++++++++++---
android/fetch.sh | 11 ++++++++++-
2 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/android/Makefile b/android/Makefile
index 3c56b74b80be..79887a8ae0b9 100644
--- a/android/Makefile
+++ b/android/Makefile
@@ -55,9 +55,10 @@ CONFIGURE_ARGS := --host=$(TRIPLET) --prefix=$(OC_SYSROOT) \
SOURCE_LIST = $(LIBXML2_SRC)/configure $(GMP_SRC)/configure \
$(NETTLE_SRC)/configure $(GNUTLS_SRC)/configure \
- $(STOKEN_SRC)/configure $(OATH_SRC)/configure
+ $(STOKEN_SRC)/configure $(OATH_SRC)/configure \
+ $(LZ4_DIR)/Makefile
-PKG_LIST := LIBXML2 OPENSSL GMP NETTLE GNUTLS STOKEN OATH
+PKG_LIST := LIBXML2 OPENSSL GMP NETTLE GNUTLS STOKEN OATH LZ4
MIRROR_TEST_TARGETS := $(addprefix mirror-test-,$(PKG_LIST))
@@ -349,6 +350,36 @@ oath: $(OATH_DEPS)
#####################################################################
#
+# Build liblz4
+#
+LZ4_VER := r127
+LZ4_TAR := lz4-$(LZ4_VER).tar.gz
+LZ4_SHA1 := 1aa7d4bb62eb79f88b33f86f9890dc9f96797af5
+LZ4_DIR := $(TRIPLET)/lz4-$(LZ4_VER)
+
+$(LZ4_TAR):
+ $(FETCH) $@ $(LZ4_SHA1)
+
+$(LZ4_DIR)/Makefile: $(LZ4_TAR)
+ mkdir -p $(TRIPLET)
+ tar xzf $< -C $(TRIPLET)
+ touch $@
+
+$(OC_SYSROOT)/lib/liblz4.a: $(TOOLCHAIN_BUILT) $(LZ4_DIR)/Makefile
+ $(MAKE) -C $(LZ4_DIR)/lib \
+ CC="$(TRIPLET)-gcc $(EXTRA_CFLAGS)" \
+ AR="$(TRIPLET)-ar" \
+ LIBDIR=$(OC_SYSROOT)/lib \
+ INCLUDEDIR=$(OC_SYSROOT)/include \
+ install
+ rm -f $(OC_SYSROOT)/lib/liblz4.so*
+
+LZ4_DEPS := $(OC_SYSROOT)/lib/liblz4.a
+
+lz4: $(LZ4_DEPS)
+
+#####################################################################
+#
# Build OpenConnect for Android
#
OPENCONNECT_SRC := ..
@@ -357,7 +388,8 @@ OPENCONNECT_BUILD := $(TRIPLET)/openconnect
$(OPENCONNECT_SRC)/configure:
cd $(OPENCONNECT_SRC) && ./autogen.sh
-$(OPENCONNECT_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(GNUTLS_DEPS) $(LIBXML_DEPS) $(STOKEN_DEPS) $(OATH_DEPS) $(OPENCONNECT_SRC)/configure
+$(OPENCONNECT_BUILD)/Makefile: $(TOOLCHAIN_BUILT) $(GNUTLS_DEPS) $(LIBXML_DEPS) \
+ $(STOKEN_DEPS) $(OATH_DEPS) $(LZ4_DEPS) $(OPENCONNECT_SRC)/configure
mkdir -p $(OPENCONNECT_BUILD)
cd $(OPENCONNECT_BUILD) && ../../../configure \
--host=$(TRIPLET) --prefix=/ \
diff --git a/android/fetch.sh b/android/fetch.sh
index 8cf79b1408de..5337aa4b76a6 100755
--- a/android/fetch.sh
+++ b/android/fetch.sh
@@ -48,6 +48,8 @@ oath_toolkit_MIRROR_0=http://download.savannah.gnu.org/releases/oath-toolkit
oath_toolkit_MIRROR_1=http://packetstorm.wowhacker.com/UNIX/utilities
oath_toolkit_MIRROR_2=ftp://ftp.netbsd.org/pub/pkgsrc/distfiles
+lz4_MIRROR_0=https://github.com/Cyan4973/lz4/archive
+
MAX_TRIES=5
function make_url
@@ -71,7 +73,14 @@ function make_url
return
fi
- echo "${mirror_base}/${tarball}${mirror_suffix}"
+ if [[ "${mirror_base}" = *//github.com*/archive* ]]; then
+ # typical format: https://github.com/USER/PKG/archive/TAG.tar.gz
+ echo "${mirror_base}/${tarball#*-}"
+ else
+ # typical format: http://.../PKG-TAG.tar.gz
+ echo "${mirror_base}/${tarball}${mirror_suffix}"
+ fi
+
return
}
--
2.2.2
More information about the openconnect-devel
mailing list