mkports

recipes for building multiple softwares with mk(1)
git clone git://z3bra.org/mkports
Log | Files | Refs

commit 8902100346d5553b15c4e8164e399926d2e12ba6
parent 97bbf28ff4ebe499b84d9ed774cc8edfaba32c17
Author: z3bra <willyatmailoodotorg>
Date:   Fri Jan 15 22:27:49 2016

Make default.mk more generic

Diffstat:
 config.mk  |  2 +-
 default.mk | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mk.build   | 37 -------------------------------------
 mkfile     |  7 +++++++
 4 files changed, 65 insertions(+), 38 deletions(-)

diff --git a/config.mk b/config.mk @@ -1,4 +1,4 @@ -CROSS = /opt/cross/gcc-x86_64 +CROSS = /opt/cross/x86_64 PATH = ${CROSS}/bin:${PATH} TOOLCHAIN_TRIPLET = x86_64-linux-musl diff --git a/default.mk b/default.mk @@ -0,0 +1,57 @@ +# create a pack from an chroot install (see the "install" target) +$pkg\:$ver.tar.bz2:Q: install + cd $pkg-$ver/.rootfs + tar -c `ls` | bzip2 -c > ../../$pkg:$ver.tar.bz2 + +# recipe trying to follow the most common pattern in software +# building +# If it doesn't work, simply override it on a per pack basis +build:QV: fetch patch + cd $pkg-$ver + test -f configure && ./configure $CONFIGURE + make CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" + +# install the pack to a .rootfs directory +# this is where the "pack" target will chdir to create the pack +install:QV: build + mkdir -p $pkg-$ver/.rootfs + cd $pkg-$ver + make PREFIX= DESTDIR=$(pwd)/.rootfs install + +# patch your software using everything in ./patches +patch:QV: fetch + if [ -d ./patches ]; then + cd $pkg-$ver + cat ../patches/*.diff | patch -Np1 + fi + +# fetch the source +fetch:QV: fetch-git fetch-archive + +# if $git is set, clone the repo, and checkout $ver +fetch-git:QV: + if [ -n "$git" ]; then + test -d $pkg-$ver && rm -r $pkg-$ver + git clone $git $pkg-$ver + cd $pkg-$ver; git checkout $ver + fi + +# if $url is set, download/extract the archive, and move its +# content to a directory named $pkg-$ver +fetch-archive:QV: + if [ -n "$url" ]; then + out=$(curl -LOw %{filename_effective} $url) + src=$(tar -xvf $out|sed -n 1p|tr -d /) + if [ "$src" != "$pkg-$ver" ]; then + mv "$src" "$pkg-$ver" + fi + fi + +# delete everything but the pack +clean:V: + rm -rf $pkg-$ver + rm -f $pkg-$ver.* + +# remove the pack +distclean:V: clean + rm -f $pkg:$ver.tar.bz2 diff --git a/mk.build b/mk.build @@ -1,37 +0,0 @@ -all:QV: $pkg:$ver.tar.bz2 - -$pkg\:$ver.tar.bz2: build - cd $pkg-$ver/rootfs - tar -c `ls` | bzip2 -c > ../../$pkg:$ver.tar.bz2 - -build:QV: fetch - mkdir -p $pkg-$ver/rootfs - cd $pkg-$ver - test -f configure && ./configure $CONFIGURE - make CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" - make PREFIX= DESTDIR=`pwd`/rootfs install - -fetch:QV: fetch-git fetch-archive - -fetch-git:QV: - if [ "$git" != "" ]; then - test -d $pkg-$ver && rm -r $pkg-$ver - git clone $git $pkg-$ver - (cd $pkg-$ver; git checkout $ver) - fi - -fetch-archive:QV: - if [ "$url" != "" ]; then - echo downloading `basename $url` - out=$(curl -sLOw %{filename_effective} $url) - src=$(tar -xvf $out|sed -n 1p|tr -d /) - test "$src" != "$pkg-$ver" && mv "$src" "$pkg-$ver" || true - fi - -clean:V: - rm -rf $pkg-$ver - rm -f $pkg-$ver.* - - -distclean:V: clean - rm -f $pkg:$ver.tar.bz2 diff --git a/mkfile b/mkfile @@ -0,0 +1,7 @@ +%:QV: + cd $stem; mk; mk clean + +clean:QV: + for p in ${ALL}; do (cd $p; mk clean); done +distclean:QV: + for p in ${ALL}; do (cd $p; mk distclean); done