mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-31 11:22:07 +00:00
devbuild: new helper script, fix makefile
This script helps developers who works on the alpine subprojects (i.e apk-tools, alpine-baselayout etc) to build a development alpine iso. a new alpine iso using the un-committed local sub
This commit is contained in:
parent
4a54e80e3b
commit
5baad961c6
16
Makefile
16
Makefile
@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
PACKAGE=abuild
|
PACKAGE=abuild
|
||||||
VERSION:=$(shell awk -F= '$$1 == "abuild_ver" {print $$2}' abuild)
|
VERSION:=$(shell awk -F= '$$1 == "abuild_ver" {print $$2}' abuild)
|
||||||
DISTFILES=Makefile abuild abuild.conf APKBUILD.proto buildrepo
|
USR_BIN_FILES=abuild devbuild mkalpine buildrepo
|
||||||
|
DISTFILES=$(USR_BIN_FILES) Makefile abuild.conf APKBUILD.proto
|
||||||
|
|
||||||
|
|
||||||
prefix ?= /usr
|
prefix ?= /usr
|
||||||
sysconfdir ?= /etc
|
sysconfdir ?= /etc
|
||||||
@ -14,23 +16,25 @@ help:
|
|||||||
@echo "usage: make install [ DESTDIR=<path> ]"
|
@echo "usage: make install [ DESTDIR=<path> ]"
|
||||||
@echo " make dist"
|
@echo " make dist"
|
||||||
|
|
||||||
install: abuild abuild.conf APKBUILD.proto functions.sh
|
install: $(USR_BIN_FILES) abuild.conf APKBUILD.proto functions.sh
|
||||||
mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
|
mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
|
||||||
$(DESTDIR)/$(datadir)
|
$(DESTDIR)/$(datadir)
|
||||||
cp abuild buildrepo $(DESTDIR)/$(prefix)/bin/
|
for i in $(USR_BIN_FILES); do\
|
||||||
|
install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
|
||||||
|
done
|
||||||
if [ -z "$(DESTDIR)" ] && [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
|
if [ -z "$(DESTDIR)" ] && [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
|
||||||
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
|
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
|
||||||
fi
|
fi
|
||||||
cp APKBUILD.proto $(DESTDIR)/$(prefix)/share/abuild
|
cp APKBUILD.proto $(DESTDIR)/$(prefix)/share/abuild
|
||||||
cp functions.sh $(DESTDIR)/$(datadir)/
|
cp functions.sh $(DESTDIR)/$(datadir)/
|
||||||
|
|
||||||
dist: $(P).tar.gz
|
dist: $(P).tar.bz2
|
||||||
|
|
||||||
$(P).tar.gz: $(DISTFILES)
|
$(P).tar.bz2: $(DISTFILES)
|
||||||
rm -rf $(P)
|
rm -rf $(P)
|
||||||
mkdir -p $(P)
|
mkdir -p $(P)
|
||||||
cp $(DISTFILES) $(P)/
|
cp $(DISTFILES) $(P)/
|
||||||
tar -czf $@ $(P)
|
tar -cjf $@ $(P)
|
||||||
rm -rf $(P)
|
rm -rf $(P)
|
||||||
|
|
||||||
.PHONY: install dist
|
.PHONY: install dist
|
||||||
|
61
devbuild
Executable file
61
devbuild
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This scripts will:
|
||||||
|
# 1. create a dist package for current subproject
|
||||||
|
# 2. update the APKBUILD and build the package
|
||||||
|
# 3. build the alpine iso
|
||||||
|
#
|
||||||
|
# The following is assumed from the subproject:
|
||||||
|
# * that PACKAGE and VERSION is set in Makefile or defined in a local
|
||||||
|
# devbuild.conf file
|
||||||
|
# * that 'make dist' will generate a valid dist package
|
||||||
|
#
|
||||||
|
|
||||||
|
program=${0##*/}
|
||||||
|
|
||||||
|
# rebuild env. Those values can be overridden in either
|
||||||
|
# /etc/devbuild.conf or $HOME/.devbuild.conf
|
||||||
|
DISTFILES=/var/cache/distfiles
|
||||||
|
APORTS_DIR=$HOME/aports
|
||||||
|
ALPINE_DIR=$HOME/abuild
|
||||||
|
|
||||||
|
# for the local project. Those values can be overridden by
|
||||||
|
# a devbuild.conf in the subprojects subdir
|
||||||
|
PACKAGE=$(grep '^PACKAGE' Makefile | sed 's/.*=[[:blank:]]*//')
|
||||||
|
VERSION=$(grep '^VERSION' Makefile | sed 's/.*=[[:blank:]]*//')
|
||||||
|
SUFFIX=.tar.bz2
|
||||||
|
REPO=core
|
||||||
|
|
||||||
|
# let user override the above defaults
|
||||||
|
for i in /etc/$program.conf $HOME/.$program.conf ./$program.conf; do
|
||||||
|
if [ -f $i ]; then
|
||||||
|
. $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# generate a new dist package
|
||||||
|
tarball=${PACKAGE}-${VERSION}${SUFFIX}
|
||||||
|
make dist || exit 1
|
||||||
|
cp $tarball "$DISTFILES/" || exit 1
|
||||||
|
|
||||||
|
# update the APKBUILD, in a subshell
|
||||||
|
(
|
||||||
|
cd $APORTS_DIR/$REPO/$PACKAGE || exit 1
|
||||||
|
. ./APKBUILD
|
||||||
|
if [ "$pkgver" = "$VERSION" ]; then
|
||||||
|
pkgrel=$(( $pkgrel + 1 ))
|
||||||
|
else
|
||||||
|
pkgrel="0"
|
||||||
|
fi
|
||||||
|
sed -i -e " s/^pkgver=.*/pkgver=$VERSION/;
|
||||||
|
s/^pkgrel=.*/pkgrel=$pkgrel/;
|
||||||
|
/^md5sums=\"/,/\"\$/d" APKBUILD || exit 1
|
||||||
|
export SRCDEST="$DISTFILES"
|
||||||
|
abuild checksum >>APKBUILD
|
||||||
|
abuild
|
||||||
|
abuild cleanoldpkg
|
||||||
|
) || exit 1
|
||||||
|
|
||||||
|
# rebuild the iso
|
||||||
|
cd "$ALPINE_DIR" && fakeroot ./mkalpine
|
||||||
|
|
Loading…
Reference in New Issue
Block a user