Changeset 701 in openpam


Ignore:
Timestamp:
Aug 16, 2013, 10:26:24 AM (7 years ago)
Author:
Dag-Erling Smørgrav
Message:
  • If @PACKAGE_VERSION@ is "trunk" and svnversion prints something sensible, append the svn revision.
  • Implement an ugly workaround for the shlib issue.
  • Clean up and add comments.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mkpkgng.in

    r692 r701  
    44#
    55
    6 srcdir="@abs_top_srcdir@"
    7 builddir="@abs_top_builddir@"
     6# Print an informational message
     7info() {
     8        echo "mkpkgng: $@"
     9}
    810
    9 pkgabi=$(pkg -vv | awk '$1 == "ABI:" { print $2 }')
    10 
     11# Print an error message and exit
    1112error() {
    12         echo "$@" 1>&2
     13        echo "mkpkgng: $@" 1>&2
    1314        exit 1
    1415}
    1516
     17# Ask a yes / no question
     18yesno() {
     19        while :; do
     20                echo -n "mkpkgng: $@ (yes/no) "
     21                read answer
     22                case $answer in
     23                [Yy]|[Yy][Ee][Ss])
     24                        return 0
     25                        ;;
     26                [Nn]|[Nn][Oo])
     27                        return 1
     28                        ;;
     29                esac
     30        done
     31}
     32
     33#
     34# Locate source and build directory
     35#
     36srcdir="@abs_top_srcdir@"
     37[ -f "$srcdir/include/security/openpam.h" ] || \
     38    error "Unable to locate source directory."
     39builddir="@abs_top_builddir@"
     40cd "$srcdir"
     41
     42#
     43# Determine pkgng version and ABI
     44#
     45pkgver=$(pkg query %v pkg)
     46[ -n "$pkgver" ] || error "Unable to determine pkgng version."
     47pkgabi=$(pkg -vv | awk '$1 == "ABI:" { print $2 }')
     48[ -n "$pkgabi" ] || error "Unable to determine package ABI."
     49
     50#
     51# Determine package name and version
     52#
     53package="@PACKAGE@"
     54version="@PACKAGE_VERSION@"
     55if [ "$version" = "trunk" ] ; then
     56        svnversion="$(svnversion 2>&1)"
     57        svnversion=$(expr "$svnversion" : '\([0-9][0-9]*\)[A-Z]\{0,1\}$')
     58        if [ -n "$svnversion" ] ; then
     59                version="$version-r${svnversion}"
     60        fi
     61fi
     62
     63#
     64# Locate GNU make
     65#
    1666if which gmake >/dev/null ; then
    1767        make=gmake
     
    1969        make=make
    2070fi
     71make="$make --no-print-directory --quiet V=0"
    2172
    22 tmproot=$(mktemp -d)
     73#
     74# Create temporary directory
     75#
     76info "Creating temporary directory."
     77tmproot=$(mktemp -d "${TMPDIR:-/tmp}/$package-$version.XXXXXX")
    2378[ -n "$tmproot" -a -d "$tmproot" ] || error "unable to create temporary directory"
    24 trap "echo deleting temporary directory ; rm -rf '$tmproot'" EXIT
     79trap "info Deleting temporary directory. ; rm -rf '$tmproot'" EXIT
    2580set -e
    2681
     82#
     83# Install into tmproot
     84#
     85info "Installing into temporary directory."
    2786$make install DESTDIR="$tmproot"
    2887
     88#
     89# Generate stub manifest
     90#
     91info "Generating stub manifest."
    2992manifest="$tmproot/+MANIFEST"
    30 
    3193cat >"$manifest" <<EOF
    32 name: @PACKAGE@
    33 version: @PACKAGE_VERSION@
     94name: $package
     95version: $version
    3496origin: local/openpam
    3597comment: BSD-licensed PAM implementation
     
    50112EOF
    51113
     114# Generate file list
     115info "Generating file list."
    52116(
    53117        echo "files:"
     
    60124)>>"$manifest"
    61125
    62 pkg create -r "$tmproot" -m "$tmproot" -o "$builddir"
     126# As of pkg 1.1.4, the shlib detection logic in "pkg create" only
     127# works when tmproot == "/", so instead of creating a package directly
     128# from the contents of $tmproot, we have to install to / and package
     129# that.
     130info "Packaging."
     131if [ "$pkgver" \< "1.1.5" ] ; then
     132        info "pkg 1.1.4 or older detected."
     133        yesno "We must now install to /.  Proceed?" || error "Chicken."
     134        $make install
     135        pkg create -m "$tmproot" -o "$builddir"
     136else
     137        pkg create -r "$tmproot" -m "$tmproot" -o "$builddir"
     138fi
     139
     140echo "Package created for $package-$version."
Note: See TracChangeset for help on using the changeset viewer.