tChange tarball name and add some more checks - mkports - recipes for building multiple softwares with mk(1)
 (HTM) git clone git://z3bra.org/mkports
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 4b28c313ecaf6ab6f76bd246352cf9e486c2306e
 (DIR) parent 5ca21b71ef836aa3594292fc6254d4bb4bf5f7c2
 (HTM) Author: z3bra <willyatmailoodotorg>
       Date:   Sun, 17 Jan 2016 16:48:26 +0100
       
       Change tarball name and add some more checks
       
       Diffstat:
         M default.mk                          |      36 +++++++++++++++++--------------
         M mkfile                              |       2 ++
       
       2 files changed, 22 insertions(+), 16 deletions(-)
       ---
 (DIR) diff --git a/default.mk b/default.mk
       t@@ -1,28 +1,32 @@
        destdir = ${PWD}/$pkg-$ver/.rootfs
        
        # create a pack from an chroot install (see the "install" target)
       -$pkg\:$ver.tar.bz2:Q: install
       +$pkg\#$ver.tar.bz2:Q: $destdir
                cd $destdir
       -        tar -c `ls` | bzip2 -c > ../../$pkg:$ver.tar.bz2
       +        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"
       +        if [ ! -d $destdir ]; then
       +                cd $pkg-$ver
       +                test -f configure && ./configure $CONFIGURE
       +                make CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
       +        fi
        
        # install the pack to a .rootfs directory
        # this is where the "pack" target will chdir to create the pack
       -install:QV: build
       -        mkdir -p $destdir
       -        cd $pkg-$ver
       -        make PREFIX= DESTDIR=$destdir install
       +$destdir:QV: build
       +        if [ ! -d $destdir ]; then
       +                mkdir -p $destdir
       +                cd $pkg-$ver
       +                make PREFIX= DESTDIR=$destdir install
       +        fi
        
        # patch your software using everything in ./patches
        patch:QV: fetch
       -        if [ -d ./patches ]; then
       +        if [ ! -d $destdir ] && [ -d ./patches ]; then
                        cd $pkg-$ver
                        cat ../patches/*.diff | patch -Np1
                fi
       t@@ -33,9 +37,10 @@ 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
       +                test -d $pkg-$ver || git clone $git $pkg-$ver
       +                cd $pkg-$ver
       +                git reset --hard
       +                git checkout $ver
                fi
        
        # if $url is set, download/extract the archive, and move its
       t@@ -43,9 +48,8 @@ fetch-git:QV:
        fetch-archive:QV:
                if [ -n "$url" ]; then
                        out=$(basename $url)
       -                 if [ ! -f $out ]; then
       -                        out=$(curl -LOw %{filename_effective} $url)
       -                fi
       +                test -f $out || out=$(curl -LOw %{filename_effective} $url)
       +                rm -rf $pkg-$ver
                        src=$(tar -xvf $out|sed -n 1p|cut -f1 -d/)
                        if [ "$src" != "$pkg-$ver" ]; then
                                pwd
 (DIR) diff --git a/mkfile b/mkfile
       t@@ -1,3 +1,5 @@
       +ALL = binutils dash mksh musl pm sbase ubase
       +
        %:QV:
                cd $stem; mk; mk clean