From cc4cc145f3a4a153939c4385078925a347052610 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Thu, 14 Jan 2016 20:37:02 +0100 Subject: [PATCH] make: add deploy target for deb,rpm,pkgin(bsd) and osxpkg (darwin). no windows installer yet --- Makefile | 5 ++++- dist.mak | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 47e8c7ae..88f94e82 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # posix (linux, bsd, osx, solaris) + mingw with gcc/clang only .SUFFIXES: .y .c .i .o .opic .textile .html .PHONY: all default bins libs pn static usage config clean doc rebuild check test bench tarball dist \ - examples release install grammar doxygen website testable + examples release deploy install grammar doxygen website testable .NOTPARALLEL: test SRC = core/asm.c core/ast.c core/compile.c core/contrib.c core/gc.c core/internal.c core/lick.c core/mt19937ar.c core/number.c core/objmodel.c core/primitive.c core/string.c core/syntax.c core/table.c core/vm.c @@ -423,6 +423,9 @@ tarball: release: dist +$(MAKE) -f dist.mak $@ PREFIX="${PREFIX}" +deploy: release + +$(MAKE) -f dist.mak $@ PREFIX="${PREFIX}" + %.html: %.textile @${ECHO} DOC $@ @${ECHO} "" > $@ diff --git a/dist.mak b/dist.mak index ef967c1f..3f55b6ae 100644 --- a/dist.mak +++ b/dist.mak @@ -16,6 +16,7 @@ PLATFORM = $(shell ./tools/config.sh "${CC}" target) RELEASE ?= ${VERSION}.${REVISION} PKG = potion-${RELEASE} PKGBIN = ${PKG}-${PLATFORM} +PKG_DESC = "potion language" ifeq (${WIN32},1) BINDIST = pkg/${PKGBIN}.zip else @@ -26,6 +27,31 @@ dist: bin-dist src-dist release: dist +# sudo gem install fpm +# pkgin is for BSD, with pkg_create +# TODO: need a simple one-line windows cmd-line installer from the zip + +define EXPAND_DEPLOY +ifneq ($$(WIN32),1) +deploy: release + rm -rf dist + mkdir dist + tar xfz pkg/${PKGBIN}.tar.gz -C dist/ + tar xfz pkg/${PKGBIN}-devel.tar.gz -C dist/ +ifeq ($$(DLL),.so) + fpm -s dir -t deb -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC) + fpm -s dir -t rpm -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC) + -fpm -s dir -t pkgin -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC) +endif +ifeq ($$(DLL),.dylib) + fpm -s dir -t osxpkg -C dist -p pkg --name potion --version $(VERSION) --description $(PKG_DESC) +endif + rm -rf dist +endif +endef + +$(eval $(call EXPAND_DEPLOY)) + install: bin-dist ${SUDO} tar xfz pkg/${PKGBIN}.tar.gz -C $(PREFIX)/ @@ -127,4 +153,4 @@ GTAGS: ${SRC} core/*.h mv ${PKG}/ref doc/ rm -rf ${PKG} -.PHONY: dist release install tarball src-dist bin-dist +.PHONY: dist release deploy install tarball src-dist bin-dist