From ed021630df742435f7b8b0b3d21e74d9bab6e182 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sat, 11 Jun 2016 01:17:00 +0200 Subject: [PATCH] Fixes for building on a mac --- build-package.sh | 2 +- packages/busybox/build.sh | 3 ++- packages/gifsicle/build.sh | 1 + packages/libluajit/Makefile.patch | 21 +++++++++++++++------ packages/ncurses/build.sh | 2 +- scripts/setup-mac.sh | 25 +++++++++++++++++++++++++ 6 files changed, 45 insertions(+), 9 deletions(-) create mode 100755 scripts/setup-mac.sh diff --git a/build-package.sh b/build-package.sh index 6ab780cc1..c1289ef38 100755 --- a/build-package.sh +++ b/build-package.sh @@ -103,7 +103,7 @@ export PATH=$PATH:$TERMUX_STANDALONE_TOOLCHAIN/bin # Make $TERMUX_TAR and $TERMUX_TOUCH point at gnu versions: export TERMUX_TAR="tar" -test `uname` = "Darwin" && TERMUX_TAR=gnutar +test `uname` = "Darwin" && TERMUX_TAR=gtar export TERMUX_TOUCH="touch" test `uname` = "Darwin" && TERMUX_TOUCH=gtouch diff --git a/packages/busybox/build.sh b/packages/busybox/build.sh index 678508400..684c7d801 100755 --- a/packages/busybox/build.sh +++ b/packages/busybox/build.sh @@ -8,7 +8,8 @@ TERMUX_PKG_BUILD_IN_SRC=yes # We replace env in the old coreutils package: TERMUX_PKG_CONFLICTS="coreutils (<< 8.25-4)" -# NOTE: sed on mac does not work for building busybox, install gsed and symlink sed => gsed +# NOTE: sed on mac does not work for building busybox, install gnu-sed with +# homebrew using the --with-default-names option. CFLAGS+=" -llog -DTERMUX_EXPOSE_MEMPCPY=1" # Android system liblog.so for syslog diff --git a/packages/gifsicle/build.sh b/packages/gifsicle/build.sh index d113484b4..78ff9d513 100644 --- a/packages/gifsicle/build.sh +++ b/packages/gifsicle/build.sh @@ -2,3 +2,4 @@ TERMUX_PKG_HOMEPAGE=http://www.lcdf.org/gifsicle/ TERMUX_PKG_DESCRIPTION="Tool for creating, editing, and getting information about GIF images and animations" TERMUX_PKG_VERSION=1.88 TERMUX_PKG_SRCURL=http://www.lcdf.org/gifsicle/gifsicle-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-gifview" diff --git a/packages/libluajit/Makefile.patch b/packages/libluajit/Makefile.patch index 59f960495..451da0221 100644 --- a/packages/libluajit/Makefile.patch +++ b/packages/libluajit/Makefile.patch @@ -1,9 +1,7 @@ -Link the luajit executable to the shared libraries. - -diff -u -r ../LuaJIT-2.0.3/src/Makefile ./src/Makefile ---- ../LuaJIT-2.0.3/src/Makefile 2014-03-12 13:10:00.000000000 +0100 -+++ ./src/Makefile 2014-07-09 02:39:15.344355861 +0200 -@@ -72,14 +72,14 @@ +diff -u -r ../LuaJIT-2.1.0-beta2/src/Makefile ./src/Makefile +--- ../LuaJIT-2.1.0-beta2/src/Makefile 2016-03-03 12:40:00.000000000 +0100 ++++ ./src/Makefile 2016-06-11 00:59:21.000000000 +0200 +@@ -71,14 +71,14 @@ # as dynamic mode. # # Mixed mode creates a static + dynamic library and a statically linked luajit. @@ -20,3 +18,14 @@ diff -u -r ../LuaJIT-2.0.3/src/Makefile ./src/Makefile # ############################################################################## +@@ -166,10 +166,6 @@ + HOST_SYS= Windows + HOST_MSYS= cygwin + endif +- # Use Clang for OSX host. +- ifeq (Darwin,$(HOST_SYS)) +- DEFAULT_CC= clang +- endif + endif + + ############################################################################## diff --git a/packages/ncurses/build.sh b/packages/ncurses/build.sh index e18f9076d..647789aba 100755 --- a/packages/ncurses/build.sh +++ b/packages/ncurses/build.sh @@ -38,7 +38,7 @@ termux_step_post_make_install () { cd $TERMUX_PREFIX/share/terminfo for l in *; do if [ ${#l} -eq 2 ]; then - char=`echo 0x$l | awk '{printf "%c\n", $1}'` + char=`echo 0x$l | /usr/bin/awk '{printf "%c\n", $1}'` rm -Rf $char mv $l $char fi diff --git a/scripts/setup-mac.sh b/scripts/setup-mac.sh new file mode 100755 index 000000000..6ce6cb893 --- /dev/null +++ b/scripts/setup-mac.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e -u + +command -v brew >/dev/null 2>&1 || { + echo >&2 "Install homebrew first: http://brew.sh" + exit 1 +} + +PACKAGES="" +PACKAGES="$PACKAGES bison" +PACKAGES="$PACKAGES cmake" +PACKAGES="$PACKAGES coreutils" +PACKAGES="$PACKAGES gawk" +PACKAGES="$PACKAGES gnu-sed --with-default-names" # For busybox build. +PACKAGES="$PACKAGES gnu-tar" +PACKAGES="$PACKAGES lzip" +PACKAGES="$PACKAGES pkgconfig" +PACKAGES="$PACKAGES python3" +brew install $PACKAGES + +# bison is keg-only, but we need updated 'bison' in path: +brew link bison --force + +sudo mkdir -p /data/data/com.termux/files/usr +sudo chown -R `whoami` /data