From f1e261f8683e9a986381226a242d6945b67284b4 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 29 Mar 2017 12:10:41 -0700 Subject: [PATCH 1/5] Support downloading tar archive, instead of git repo --- cook.sh | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/cook.sh b/cook.sh index 6736008f..68520818 100755 --- a/cook.sh +++ b/cook.sh @@ -48,19 +48,41 @@ function op { op $1 unfetch ;; fetch) - if [ ! -d build ] + if [ -z "$GIT" ] then - git clone --recursive "$GIT" build + if [ ! -f "$(basename "$SRC")" ] + then + wget "$SRC" + fi + + rm -rf build + tar xvf "$(basename "$SRC")" + mv "$DIR" build + else + if [ ! -d build ] + then + git clone --recursive "$GIT" build + fi + + pushd build > /dev/null + git pull + git submodule sync + git submodule update --init --recursive + popd > /dev/null + fi + + if [ -f "patch" ] + then + patch -p1 -d build < patch fi - pushd build > /dev/null - git pull - git submodule sync - git submodule update --init --recursive - popd > /dev/null ;; unfetch) rm -rfv build + if [ ! -z "$SRC" ] + then + rm -f "$(basename "$SRC")" + fi ;; version) pushd build > /dev/null From edf6930cb55dd3586576586b5f53c510429203a7 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 29 Mar 2017 12:11:09 -0700 Subject: [PATCH 2/5] Recipe for Lua --- recipes/lua/patch | 15 +++++++++++++++ recipes/lua/recipe.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 recipes/lua/patch create mode 100644 recipes/lua/recipe.sh diff --git a/recipes/lua/patch b/recipes/lua/patch new file mode 100644 index 00000000..7c69ec7e --- /dev/null +++ b/recipes/lua/patch @@ -0,0 +1,15 @@ +diff -rupN lua/src/Makefile lua-redox/src/Makefile +--- lua/src/Makefile 2015-05-27 04:10:11.000000000 -0700 ++++ lua-redox/src/Makefile 2016-07-27 18:08:54.167232304 -0700 +@@ -4,9 +4,9 @@ + # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= + + # Your platform. See PLATS for possible values. +-PLAT= none ++PLAT= posix + +-CC= gcc -std=gnu99 ++CC:= $(CC) -std=gnu99 + CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) + LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) + LIBS= -lm $(SYSLIBS) $(MYLIBS) diff --git a/recipes/lua/recipe.sh b/recipes/lua/recipe.sh new file mode 100644 index 00000000..0e0a2b33 --- /dev/null +++ b/recipes/lua/recipe.sh @@ -0,0 +1,34 @@ +VERSION=5.3.1 +SRC=http://www.lua.org/ftp/lua-$VERSION.tar.gz +DIR=lua-$VERSION + +function recipe_version { + echo "$VERSION" + return 1 +} + +function recipe_update { + echo "skipping update" + return 1 +} + +function recipe_build { + make generic + return 1 +} + +function recipe_test { + echo "skipping test" + return 1 +} + +function recipe_clean { + make clean + return 1 +} + +function recipe_stage { + mkdir -pv "$1/bin" + cp src/lua src/luac "$1/bin" + return 1 +} From 2758c9e03cef3594120879475eff770daeebc42c Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 29 Mar 2017 13:38:32 -0700 Subject: [PATCH 3/5] Build Lua without patch --- recipes/lua/patch | 15 --------------- recipes/lua/recipe.sh | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 recipes/lua/patch diff --git a/recipes/lua/patch b/recipes/lua/patch deleted file mode 100644 index 7c69ec7e..00000000 --- a/recipes/lua/patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -rupN lua/src/Makefile lua-redox/src/Makefile ---- lua/src/Makefile 2015-05-27 04:10:11.000000000 -0700 -+++ lua-redox/src/Makefile 2016-07-27 18:08:54.167232304 -0700 -@@ -4,9 +4,9 @@ - # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - - # Your platform. See PLATS for possible values. --PLAT= none -+PLAT= posix - --CC= gcc -std=gnu99 -+CC:= $(CC) -std=gnu99 - CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) - LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) - LIBS= -lm $(SYSLIBS) $(MYLIBS) diff --git a/recipes/lua/recipe.sh b/recipes/lua/recipe.sh index 0e0a2b33..bdac657d 100644 --- a/recipes/lua/recipe.sh +++ b/recipes/lua/recipe.sh @@ -13,7 +13,7 @@ function recipe_update { } function recipe_build { - make generic + make generic CC="$CC -std=gnu99" return 1 } From 9865c1571276d6b914e9feb328d7d80ab843c33d Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 29 Mar 2017 16:28:46 -0700 Subject: [PATCH 4/5] Instead of single "patch" file, support "*.patch" --- cook.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cook.sh b/cook.sh index 68520818..3ecfa4ae 100755 --- a/cook.sh +++ b/cook.sh @@ -13,6 +13,7 @@ export BINDIR=bin export CARGOFLAGS= set -e +shopt -s nullglob function usage { echo "cook.sh $1 " >&2 @@ -71,10 +72,10 @@ function op { popd > /dev/null fi - if [ -f "patch" ] - then - patch -p1 -d build < patch - fi + for patch in *.patch + do + patch -p1 -d build < "$patch" + done ;; unfetch) From 81422ff2821b595b2bc79e1f65f2fbb36319ba91 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 29 Mar 2017 19:09:38 -0600 Subject: [PATCH 5/5] Cleanup tar file method --- .gitignore | 2 ++ cook.sh | 39 +++++++++++++++++++++------------------ recipes/lua/recipe.sh | 3 +-- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index bade6d8b..94e928d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ build repo +source +source.tar stage stage.tar diff --git a/cook.sh b/cook.sh index 3ecfa4ae..9a20c173 100755 --- a/cook.sh +++ b/cook.sh @@ -13,7 +13,6 @@ export BINDIR=bin export CARGOFLAGS= set -e -shopt -s nullglob function usage { echo "cook.sh $1 " >&2 @@ -49,40 +48,44 @@ function op { op $1 unfetch ;; fetch) - if [ -z "$GIT" ] + if [ -n "$TAR" ] then - if [ ! -f "$(basename "$SRC")" ] + if [ ! -f source.tar ] then - wget "$SRC" + wget "$TAR" -O source.tar + fi + + if [ ! -d source ] + then + mkdir source + tar xvf source.tar -C source --strip-components 1 fi rm -rf build - tar xvf "$(basename "$SRC")" - mv "$DIR" build - else - if [ ! -d build ] + cp -r source build + elif [ -n "$GIT" ] + then + if [ ! -d source ] then - git clone --recursive "$GIT" build + git clone --recursive "$GIT" source fi - pushd build > /dev/null + pushd source > /dev/null git pull git submodule sync git submodule update --init --recursive popd > /dev/null - fi - for patch in *.patch - do - patch -p1 -d build < "$patch" - done + rm -rf build + cp -r source build + fi ;; unfetch) - rm -rfv build - if [ ! -z "$SRC" ] + rm -rfv build source + if [ -n "$TAR" ] then - rm -f "$(basename "$SRC")" + rm -f source.tar fi ;; version) diff --git a/recipes/lua/recipe.sh b/recipes/lua/recipe.sh index bdac657d..453c9e04 100644 --- a/recipes/lua/recipe.sh +++ b/recipes/lua/recipe.sh @@ -1,6 +1,5 @@ VERSION=5.3.1 -SRC=http://www.lua.org/ftp/lua-$VERSION.tar.gz -DIR=lua-$VERSION +TAR=http://www.lua.org/ftp/lua-$VERSION.tar.gz function recipe_version { echo "$VERSION"