Skip to content

Commit

Permalink
android: Add liblz4 to build
Browse files Browse the repository at this point in the history
Includes a hack to make sure it's statically linked into
libopenconnect.so.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
  • Loading branch information
cernekee committed Feb 8, 2015
1 parent 7b4052e commit 4888fa2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
38 changes: 35 additions & 3 deletions android/Makefile
Expand Up @@ -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))

Expand Down Expand Up @@ -347,6 +348,36 @@ OATH_DEPS := $(OC_SYSROOT)/lib/liboath.la
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
Expand All @@ -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=/ \
Expand Down
11 changes: 10 additions & 1 deletion android/fetch.sh
Expand Up @@ -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
Expand All @@ -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

}
Expand Down

0 comments on commit 4888fa2

Please sign in to comment.