]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
mkbuild-0.9.3
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Thu, 14 Jun 2007 17:30:30 +0000 (17:30 +0000)
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Thu, 14 Jun 2007 17:30:30 +0000 (17:30 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@387 04377dda-e619-0410-9926-eae83683ac58

branches/0.6/mkbuild/generic.mkSlackBuild.new
branches/0.6/mkbuild/sample-Pyrex.mkbuild
branches/0.6/src/mkbuild

index 4813471237c0acddc0b37f4b8605f5d743764459..c2177f9df8792908fdabe502ba23a313b42e376e 100644 (file)
@@ -94,8 +94,7 @@ mkdir -p "$REPOS" || exit $ERROR_MKDIR
 
 <download_source> off
 # Dowload source if necessary
-EXTENSION="[[EXTENSION]]"
-SRC="[[CONSTRUCTION SOURCE NAME STRING]]"
+SRC="[[SOURCE NAME CONSTRUCTION STRING]]"
 URL="[[DOWNLOAD FOLDER URL]]/$SRC"
 
 if [ ! -s "$SRC_DIR/$SRC" ] || ! [[DECOMPRESSOR]] [[DECOMPRESSOR TEST FLAG]] "$SRC_DIR/$SRC" 2> /dev/null; then
index e3a3a1da3733e7cb94c436ee20af52191662c037..0686d690cdffe595a564502da5744e70c412e979 100644 (file)
@@ -2,10 +2,10 @@
 # Personal variables
 #--------------------
 # Author name
-AUTHOR="Rudson R. Alves"
+[[SLACKBUILD AUTHOR]]="Rudson R. Alves"
 
 # Initials author name
-AUTHOR_INITIALS="rra"
+[[SLACKBUILD AUTHOR INITIALS]]="rra"
 
 #------------------------
 # Construction Variables
@@ -13,70 +13,70 @@ AUTHOR_INITIALS="rra"
 #
 # Source base name. if different from package name. Null ("") to default value.
 # Auto-set, get SRC_NAME from URL: http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
-SRC_NAME="Pyrex"
+[[SOURCE NAME]]="Pyrex"
 
 # Package name. Null ("") to auto-set
 # Auto-set, get PKG_NAME from URL downcase(SRC_NAME): http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
-PKG_NAME=""
+[[PACKAGE NAME]]=""
 
 #
 # Source Name construction string
 # Default value is: $SRC_NAME-$VERSION.tar.$EXTENSION
-#CONST_STRING="SOURCE NAME CONSTRUCTION STRING"
-CONST_STRING="$SRC_NAME-$VERSION.tar.$EXTENSION"
+#[[SOURCE NAME CONSTRUCTION STRING]]="SOURCE NAME CONSTRUCTION STRING"
+[[SOURCE NAME CONSTRUCTION STRING]]="$SRC_NAME-$VERSION.tar.$EXTENSION"
 
 #
 # Complete URL address or URL base address ( without $SRC_NAME-$VERSION... )
-#URL="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.5.1a.tar.gz"
-URL="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/"
+#[[DOWNLOAD FOLDER URL]]="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.5.1a.tar.gz"
+[[DOWNLOAD FOLDER URL]]="http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/"
 
 #
 # Package version.  Null ("") to auto-set.
 # Auto-set, get VERSION from URL: http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
-VERSION="0.9.5.1a"
+[[VERSION]]="0.9.5.1a"
 
 #
 # Package extension. Null ("") to auto-set
 # Auto-set, get EXTENSION from URL: http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
-EXTENSION="gz"
+[[EXTENSION]]="gz"
 
 #
 # Dependency list input
 # Enter string: "dependency_1 [condiction_1] [versio_1]: dependency_2 [condiction_2] [versio_2]"
 # Example:
-SLACK_REQUIRED="dep1 >= 1.1.1: dep2 >= 2.2.2:dep3:dep4:dep5 = 1.0"
-# SLACK_REQUIRED=""
+[[SLACK REQUIRED]]="dep1 >= 1.1.1: dep2 >= 2.2.2:dep3:dep4:dep5 = 1.0"
+#[[SLACK_REQUIRED]]=""
 
 #
 # Decompress program
 # gz, tgz, bz2, set null ("") to auto-set
 # Auto-set, get DECOMPRESSOR from URL EXTENSION: http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
-DECOMPRESSOR=""
+[[DECOMPRESSOR]]=""
 
 #
 # Decompress check flag
 # gz, tgz, bz2, set null ("") to auto-set
-DECOMPRESSOR_TEST_FLAG=""
+[[DECOMPRESSOR TEST FLAG]]=""
 
 #
 # Documentation files. Null ("") to auto-set commom doc-files:
 # NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*
-DOCFILES=""
+[[DOCUMENTATION FILES]]=""
 
 #
 # ./configure options
-OPTIONS=""
+[[OTHER CONFIGURE ARGS]]=""
 
 #
 # PREFIX. Default /usr
-PREFIX="/usr"
+[[PREFIX]]="/usr"
 
 #
 # Number of jobs
-NUMJOBS="-j7"
+[[NUMBER OF JOBS]]="-j7"
 
 #---------------------
-# News changes
+# Others changes
 #---------------------
 #[[PATCH FILES]]=""
 [[MD5SUM CODE]]="5a1bb7c76162a987a1d5040ea2d1f670"
@@ -89,7 +89,7 @@ NUMJOBS="-j7"
 # SlackBuild Sections
 #---------------------
 # SlackBuild model
-MODEL="generic.mkSlackBuild"
+[[SLACKBUILD MODEL]]="generic.mkSlackBuild"
 #
 # Default enable sections:
 #      head, set_variables, slkflags, start_structure, untar_source,
@@ -146,7 +146,7 @@ pyrex:
 cd "$TMP"
 
 # Uncompress e untar source
-gunzip | tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR
+gunzip "$SRC_DIR/$SRC" | tar --no-same-owner --no-same-permissions -xvf || exit $ERROR_TAR
 
 # Change to source dir
 cd "$PKG_SRC"
index 0139c03d953079c46de9c25d6db51410b96f62fd..7d85d3412cef44fe222367b1a0d0a866d607458e 100755 (executable)
@@ -9,8 +9,8 @@
 # SlackBuilds são scripts utilizados no Slackware para gerar
 # pacotes tgz.
 #
-# Version 0.9.2
-PROG_VERSION=0.9.2
+# Version 0.9.3
+PROG_VERSION=0.9.3
 
 #--------------------------------------------------------------------
 # Functions
@@ -96,7 +96,7 @@ function mkbuild_error {
             echo "File $2 not found!"
         ;;
         "$ERROR_CONSTRUCTION")
-            echo "Construction error in $2 variable1."
+            echo "Construction error in $2 variable."
         ;;
         "$ERROR_PROGRAM")
             echo "Program logical error."
@@ -138,6 +138,10 @@ function set_parameters {
         # get parameter[i]
         PAR=${ALL_PAR[$i]}
         case $PAR in
+            '-d'|'--debug')
+                # Debug mode
+                set -x
+            ;;
             '-h'|'--help' )
                 # Show help mesage
                 mkbuild_use && exit 0
@@ -224,12 +228,12 @@ function get_variable {
     [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM
     [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0
 
-    grep "^${1}" $MK_INPUT_FILE | cut -f2 -d\"
+    grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2 -d\"
 }
 
 function edit_file {
 
-    # Edit file  $SLACKBUILD, by change string [[$1]] to $2
+    # Edit file  $3, by change string [[$1]] to $2
     local STR_OLD
     local STR_NEW
 
@@ -240,6 +244,19 @@ function edit_file {
     mv $AUX_TMP $3
 }
 
+function edit_file_full {
+
+    # Edit file  $3, by change string $1 to $2
+    local STR_OLD
+    local STR_NEW
+
+    [ $# -ne 3 ] && mkbuild_error $ERROR_PROGRAM
+    STR_OLD=$( echo $1 | sed 's/\//\\\//g' )
+    STR_NEW=$( echo $2 | sed 's/\//\\\//g' )
+    eval "sed 's/$STR_OLD/$STR_NEW/' $3 > $AUX_TMP"
+    mv $AUX_TMP $3
+}
+
 function start_build  {
 
     # Build initial sections
@@ -256,12 +273,14 @@ function start_build  {
     edit_file "ARCH" "$ARCH" $1
     edit_file "NUMBER OF JOBS" "$NUMJOBS" $1
     edit_file "VERSION" $VERSION $1
-    edit_file "SOURCE NAME CONSTRUCTION STRING" $CONST_STRING $1
+    edit_file "SOURCE NAME CONSTRUCTION STRING" "$CONST_STRING" $1
     edit_file "EXTENSION" "$EXTENSION" $1
     edit_file "DOWNLOAD FOLDER URL" "$URL" $1
     edit_file "OTHER CONFIGURE ARGS" "$OPTIONS" $1
     edit_file "DOCUMENTATION FILES" "$DOCFILES" $1
     edit_file "PREFIX" "$PREFIX" $1
+
+    edit_file_full "\$EXTENSION" "$EXTENSION" $1
 }
 
 function clear_files {
@@ -418,46 +437,46 @@ error_codes
 set_parameters $@
 
 # Get values
-AUTHOR=${AUTHOR:="`get_variable AUTHOR`"}
-[ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "AUTHOR"
+AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"}
+[ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR"
 
-AUTHOR_INITIALS=${AUTHOR_INITIALS:="`get_variable AUTHOR_INITIALS`"}
-[ -z $AUTHOR_INITIALS ] && mkbuild_error $ERROR_CONSTRUCTION "AUTHOR_INITIALS"
+AUTHOR_INITIALS=${AUTHOR_INITIALS:="`get_variable "SLACKBUILD AUTHOR INITIALS"`"}
+[ -z $AUTHOR_INITIALS ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS"
 
-URL=${URL:="`get_variable URL`"}
+URL=${URL:="`get_variable "DOWNLOAD FOLDER URL"`"}
 EXTENSION=${EXTENSION:="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`"}
 if [ $EXTENSION = "gz" -o $EXTENSION = "tgz" -o $EXTENSION = "bz2" -o $EXTENSION = "zip" ]; then
     SOURCE_NAME=`basename $URL`
     URL_BASE=`dirname $URL`
 else
-    EXTENSION=`get_variable EXTENSION`
+    EXTENSION=`get_variable "EXTENSION"`
     [ -z $EXTENSION ] && mkbuild_error $ERROR_CONSTRUCTION "EXTENSION"
     URL_BASE=$URL
 fi
 
 # Source name
-SRC_NAME=${SRC_NAME:="`get_variable SRC_NAME`"}
+SRC_NAME=${SRC_NAME:="`get_variable "SOURCE NAME"`"}
 [ -z $SRC_NAME ] && SRC_NAME=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'`
-[ -z $SRC_NAME ] && mkbuild_error $ERROR_CONSTRUCTION "SRC_NAME"
+[ -z $SRC_NAME ] && mkbuild_error $ERROR_CONSTRUCTION "SOURCE NAME"
 
 # Package name
-PKG_NAME=${PKG_NAME:="`get_variable PKG_NAME`"}
+PKG_NAME=${PKG_NAME:="`get_variable "PACKAGE NAME"`"}
 [ -z $PKG_NAME ] && PKG_NAME=`echo $SRC_NAME | tr [A-Z_] [a-z\-]`
 
 # Version
-VERSION=${VERSION:="`get_variable VERSION`"}
+VERSION=${VERSION:="`get_variable "VERSION"`"}
 [ -z $VERSION ] && VERSION=`echo $SRC_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'`
 [ -z $VERSION ] && mkbuild_error $ERROR_CONSTRUCTION "VERSION"
 
 # Construction source name string
-CONST_STRING=${CONST_STRING:="`get_variable CONST_STRING`"}
+CONST_STRING=${CONST_STRING:="`get_variable "SOURCE NAME CONSTRUCTION STRING"`"}
 [ -z "$CONST_STRING" ] && CONST_STRING="\$SRC_NAME-\$VERSION.tar.$EXTENSION"
 
 # Build Source Name
 [ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
 
 # Decompressor program and test flag
-DECOMPRESSOR=${DECOMPRESSOR:="`get_variable DECOMPRESSOR`"}
+DECOMPRESSOR=${DECOMPRESSOR:="`get_variable "DECOMPRESSOR"`"}
 if [ -z $DECOMPRESSOR ]; then
     case $EXTENSION in
         'gz'|'GZ')
@@ -477,31 +496,31 @@ if [ -z $DECOMPRESSOR ]; then
         ;;
     esac
 fi
-[ -z $DECOMPRESSOR_TEST_FLAG ] && DECOMPRESSOR_TEST_FLAG=`get_variable DECOMPRESSOR_TEST_FLAG`
-[ -z $DECOMPRESSOR_TEST_FLAG ] && mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR_TEST_FLAG"
+[ -z $DECOMPRESSOR_TEST_FLAG ] && DECOMPRESSOR_TEST_FLAG=`get_variable "DECOMPRESSOR TEST FLAG"`
+[ -z $DECOMPRESSOR_TEST_FLAG ] && mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR TEST FLAG"
 
 # Documentations list
-DOCFILES=${DOCFILES:="`get_variable DOCFILES`"}
+DOCFILES=${DOCFILES:="`get_variable "DOCUMENTATION FILES"`"}
 if [ -z "$DOCFILES" ]; then
     DOCFILES="NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"
 fi
 
 # ./configure option
-OPTIONS=${OPTIONS:="`get_variable OPTIONS`"}
+OPTIONS=${OPTIONS:="`get_variable "OTHER CONFIGURE ARGS"`"}
 
 # PREFIX
-PREFIX=${PREFIX:="`get_variable PREFIX`"}
+PREFIX=${PREFIX:="`get_variable "PREFIX"`"}
 [ -z $PREFIX ] && PREFIX="/usr"
 
 # Number of jobs
-NUMJOBS=${NUMJOBS:="`get_variable NUMJOBS`"}
+NUMJOBS=${NUMJOBS:="`get_variable "NUMBER OF JOBS"`"}
 
 # Make slack-required file.
-SLACK_REQUIRED=${SLACK_REQUIRED:="`get_variable SLACK_REQUIRED`"}
+SLACK_REQUIRED=${SLACK_REQUIRED:="`get_variable "SLACK REQUIRED"`"}
 [ -z "$SLACK_REQUIRED" ] && make_slack_required
 
 # SlackBuild model
-MODEL=${MODEL:="`get_variable MODEL`"}
+MODEL=${MODEL:="`get_variable "SLACKBUILD MODEL"`"}
 [ -z $MODEL ] && MODEL="generic.mkSlackbuild"
 
 #