use .in files for scripts
This commit is contained in:
parent
4aee935d8c
commit
3d79fb7036
47
Makefile
47
Makefile
@ -1,18 +1,50 @@
|
|||||||
|
|
||||||
PACKAGE=abuild
|
PACKAGE := abuild
|
||||||
VERSION:=$(shell awk -F= '$$1 == "abuild_ver" {print $$2}' abuild)
|
VERSION := 1.14
|
||||||
USR_BIN_FILES=abuild devbuild mkalpine buildrepo
|
|
||||||
SAMPLES=sample.APKBUILD sample.initd sample.confd sample.pre-install \
|
|
||||||
sample.post-install
|
|
||||||
DISTFILES=$(USR_BIN_FILES) $(SAMPLES) Makefile abuild.conf initramfs-init \
|
|
||||||
|
|
||||||
|
|
||||||
prefix ?= /usr
|
prefix ?= /usr
|
||||||
sysconfdir ?= /etc
|
sysconfdir ?= /etc
|
||||||
datadir ?= $(prefix)/share/$(PACKAGE)
|
datadir ?= $(prefix)/share/$(PACKAGE)
|
||||||
|
|
||||||
|
USR_BIN_FILES := abuild devbuild mkalpine buildrepo
|
||||||
|
SAMPLES := sample.APKBUILD sample.initd sample.confd \
|
||||||
|
sample.pre-install sample.post-install
|
||||||
|
|
||||||
|
SCRIPTS := $(USR_BIN_FILES)
|
||||||
|
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
|
||||||
|
|
||||||
|
DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf
|
||||||
|
|
||||||
|
GIT_REV := $(shell test -d .git && git describe || echo exported)
|
||||||
|
ifneq ($(GIT_REV), exported)
|
||||||
|
FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
|
||||||
|
FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
|
||||||
|
else
|
||||||
|
FULL_VERSION := $(VERSION)
|
||||||
|
endif
|
||||||
|
|
||||||
|
SED := sed
|
||||||
|
TAR := tar
|
||||||
|
|
||||||
|
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
|
||||||
|
-e 's:@prefix@:$(prefix):g' \
|
||||||
|
-e 's:@sysconfdir@:$(sysconfdir):g' \
|
||||||
|
-e 's:@datadir@:$(datadir):g'
|
||||||
|
|
||||||
|
.SUFFIXES: .sh.in .in
|
||||||
|
.sh.in.sh:
|
||||||
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
|
.in:
|
||||||
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
P=$(PACKAGE)-$(VERSION)
|
P=$(PACKAGE)-$(VERSION)
|
||||||
|
|
||||||
|
all: $(SCRIPTS)
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "$(P) makefile"
|
@echo "$(P) makefile"
|
||||||
@echo "usage: make install [ DESTDIR=<path> ]"
|
@echo "usage: make install [ DESTDIR=<path> ]"
|
||||||
@ -29,7 +61,6 @@ install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
|
|||||||
fi
|
fi
|
||||||
cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild
|
cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild
|
||||||
cp functions.sh $(DESTDIR)/$(datadir)/
|
cp functions.sh $(DESTDIR)/$(datadir)/
|
||||||
cp initramfs-init $(DESTDIR)/$(datadir)/
|
|
||||||
|
|
||||||
dist: $(P).tar.bz2
|
dist: $(P).tar.bz2
|
||||||
|
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
# Depends on: busybox utilities, fakeroot,
|
# Depends on: busybox utilities, fakeroot,
|
||||||
#
|
#
|
||||||
|
|
||||||
abuild_ver=1.14
|
abuild_ver=@VERSION@
|
||||||
|
sysconfdir=@sysconfdir@
|
||||||
|
|
||||||
startdir="$PWD"
|
startdir="$PWD"
|
||||||
srcdir=${srcdir:-"$startdir/src"}
|
srcdir=${srcdir:-"$startdir/src"}
|
||||||
@ -27,23 +28,45 @@ SUDO=${SUDO:-"sudo"}
|
|||||||
default_cmds="sanitycheck builddeps clean fetch unpack rootpkg"
|
default_cmds="sanitycheck builddeps clean fetch unpack rootpkg"
|
||||||
|
|
||||||
# read config
|
# read config
|
||||||
ABUILD_CONF=${ABUILD_CONF:-"/etc/abuild.conf"}
|
ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
|
||||||
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
|
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
|
||||||
|
|
||||||
# source functions
|
# source functions
|
||||||
datadir=/usr/share/abuild
|
datadir=/usr/share/abuild
|
||||||
|
|
||||||
# if abuild was not run from PATH, then look for func lib at same location
|
#colors
|
||||||
if [ -z "$FUNCLIB" ]; then
|
if [ -n "$USE_COLORS" ]; then
|
||||||
FUNCLIB="${0##/*}/functions.sh"
|
NORMAL="\033[1;0m"
|
||||||
[ -f "$FUNCLIB" ] || FUNCLIB=$datadir/functions.sh
|
STRONG="\033[1;1m"
|
||||||
|
RED="\033[1;31m"
|
||||||
|
GREEN="\033[1;32m"
|
||||||
|
YELLOW="\033[1;33m"
|
||||||
|
BLUE="\033[1;34m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -f "$FUNCLIB" ]; then
|
|
||||||
echo "$FUNCLIB: not found" >&2
|
# functions
|
||||||
exit 1
|
msg() {
|
||||||
fi
|
local prompt="$GREEN>>>${NORMAL}"
|
||||||
. "$FUNCLIB"
|
local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
|
||||||
|
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||||
|
[ -z "$quiet" ] && printf "${prompt} ${name}${fake}: $@\n" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
warning() {
|
||||||
|
local prompt="${YELLOW}>>> WARNING:${NORMAL}"
|
||||||
|
local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
|
||||||
|
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||||
|
printf "${prompt} ${name}${fake}: $@\n" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
local prompt="${RED}>>> ERROR:${NORMAL}"
|
||||||
|
local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
|
||||||
|
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||||
|
printf "${prompt} ${name}${fake}: $@\n" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
set_xterm_title() {
|
set_xterm_title() {
|
||||||
if [ "$TERM" = xterm ]; then
|
if [ "$TERM" = xterm ]; then
|
||||||
@ -190,11 +213,7 @@ unpack() {
|
|||||||
clean() {
|
clean() {
|
||||||
msg "Cleaning temporary build dirs..."
|
msg "Cleaning temporary build dirs..."
|
||||||
rm -rf "$srcdir"
|
rm -rf "$srcdir"
|
||||||
rm -rf "$pkgdir"
|
rm -rf "$pkgdirbase"
|
||||||
local i
|
|
||||||
for i in $subpackages; do
|
|
||||||
rm -rf "$pkgdir-$(get_split_func $i)"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# cleanup fetched sources
|
# cleanup fetched sources
|
Loading…
x
Reference in New Issue
Block a user