#!/bin/bash
## src2pkg script for:  libcap
## Auto-generated by src2pkg-2.1
## src2pkg - Copyright 2005-2009 Gilbert Ashley <[email protected]>

SOURCE_NAME='libcap2_2.17.orig.tar.gz'
ALT_NAME='libcap'
VERSION='2.17'   # Use ALT_VERSION to override guessed value
# ARCH=''
# BUILD='1'
# PRE_FIX='usr'
# Any extra options go here:
# EXTRA_CONFIGS=""
PATCHLIST='libcap-patches/0001-fix-Makefiles.patch
libcap-patches/fix-broken-includes.diff
libcap-patches/libcap2_2.17-2.diff.gz'

# Optional function replaces configure_source, compile_source, fake_install
# To use, uncomment and write/paste CODE between the {} brackets.
# build() { CODE }

# Get the functions and configs
/usr/libexec/src2pkg/FUNCTIONS ;

# Execute the named packaging steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms

# Set the CFLAGS
( cd $SRC_DIR ; sed -i.orig "s/^\(DEBUG =\).*/\1$STDFLAGS/" Make.Rules )

configure_source #
compile_source   # If used, the 'build' function replaces these 3
fake_install     #

# add some links in /usr/lib
mkdir -p $PKG_DIR/usr/lib${LIBDIRSUFFIX}
( cd $PKG_DIR/usr/lib${LIBDIRSUFFIX}
       ln -sf ../../lib/libcap.so.2 .
       ln -sf ../../lib/libcap.so .
)

# add mising header
# cp $SRC_DIR/libcap/libcap.h $PKG_DIR/usr/include

# Add included scripts
( cd $SRC_DIR/contrib || exit 1
 for FILE in pcaps4convenience pcaps4server pcaps4suid0 ; do
   install -m 0755 -D $FILE $PKG_DIR/usr/sbin/$FILE
 done
)

fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# DOCLIST='' PATCHLIST='' INSTALL_TYPE=''
# CONFIG_COMMAND='' MAKE_COMMAND='' INSTALL_LINE=''
# When editing src2pkg scripts to add custom code, use these variables
# to refer to the current directory, the sources or the package tree:
# $CWD (current directory), $SRC_DIR (sources), $PKG_DIR (package tree)
# Other commonly-used directories include: $DOC_DIR (document directory)
# $MAN_DIR (man-page directory) $DATA_DIR (shared-data directory)