diff --git a/build.sh.generic b/build.sh.generic new file mode 100644 index 0000000..73ddce7 --- /dev/null +++ b/build.sh.generic @@ -0,0 +1,91 @@ +#!/bin/bash +# +# This is a generic build.sh script +# It can be used nearly unmodified with many packages +# +# The concept of "method" registering and the logic that implements it was shamelessly +# stolen from jhlj's Compile.sh script :) +# +# Check the following 4 variables before running the script +topdir= +version= +pkgver= +source[0]= +# If there are no patches, simply comment this +patch[0]= + +# Source function library +. ${HOME}/buildpkg/scripts/buildpkg.functions + +# Define script functions and register them +reg prep +prep() +{ + generic_prep +} + +reg build +build() +{ + generic_build +} + +reg install +install() +{ + generic_install +} + +reg pack +pack() +{ + generic_pack +} + + +################################################### +# No need to look below here +################################################### +METHODS="" +reg() { + METHODS="$METHODS $1" +} + +reg all +all() +{ + for METHOD in $METHODS + do + case $METHOD in + all*) ;; + *) $METHOD + ;; + esac + done + +} + +reg +usage() { + echo Usage $0 "{"$(echo $METHODS | tr " " "|")"}" + exit 1 +} + +OK=0 +for METHOD in $* +do + METHOD=" $METHOD *" + if [ "${METHODS%$METHOD}" == "$METHODS" ] ; then + usage + fi + OK=1 +done + +if [ $OK = 0 ] ; then + usage; +fi + +for METHOD in $* +do + ( $METHOD ) +done