aboutsummaryrefslogtreecommitdiffstats
path: root/spec-helper
blob: bb6a5e16e1141cb3905bab87b64efa47d3b23218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
#---------------------------------------------------------------
# Project         : Linux-Mandrake
# Module          : bin
# File            : spec-helper
# Version         : $Id$
# Author          : Frederic Lepied
# Created On      : Wed Feb  9 16:25:21 2000
#---------------------------------------------------------------

if [ -z "$RPM_BUILD_ROOT" ]; then
    echo "no RPM_BUILD_ROOT variable; exiting." 1>&2
    exit 0
fi

SPEC_HELPER_ROOT=${SPEC_HELPER_ROOT=/usr/share/spec-helper}
PATH=$SPEC_HELPER_ROOT:$PATH
export PATH

# usage
usage() {
    echo "usage: spec-helper [-l|-c|-m|-s]" 1>&2
    echo "-c don't clean up files" 1>&2
    echo "-m don't compress files" 1>&2
    echo "-s don't strip files" 1>&2
    echo "-l don't fix full link as relative." 1>&2
}

# handle options
while [ $# != 0 ]; do
    case $1 in
	-c) DONT_CLEANUP=1;;
	-m) DONT_COMPRESS=1;;
	-s) DONT_STRIP=1;;
	-l) DONT_RELINK=1;;
	*) usage; exit 1;;
    esac

    shift
done

unlink_packlist() {
    find $RPM_BUILD_ROOT -name ".packlist" -exec rm -f '{}' ';' # remove .packlist's, unneeded by perl packages
}

test -z "$DONT_CLEANUP" && echo -n "Cleaning files..." && clean_files && echo "done"
test -z "$DONT_COMPRESS" && echo -n "Compressing files..." && compress_files && echo "done"
test -z "$DONT_STRIP" && echo -n "Stripping files..." && strip_files && echo "done"
test -z "$DONT_RELINK" && echo -n "Relativisation of symlinks..." && relative_me_babe && echo "done"
test -z "$DONT_UNLINK_PACKLIST" && echo -n "Removing .packlist's..." && unlink_packlist && echo "done"

exit 0

# spec-helper ends here