blob: d3c77b8cd54527a7aa741b328212ac2da433d21e (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/bin/bash
CWD=`pwd`
program=`basename $0`
usage() {
cat << EOF_USAGE
Usage: $program [options]
Options:
-h,--help Display this message.
-d,--target-dest-dir=DIR The target ROOTFS directory
[default: DIR=/].
The script regenerates files that do not need to be stored in Git:
aclocal.m4 and m4 macros using aclocal;
config.h.in using autoheader;
Makefile.in and helper files using automake;
configure using autoconf.
EOF_USAGE
}
TARGET_DEST_DIR=/
ACDIR=usr/share/aclocal
INCDIR=usr/include
SYSTEM_ACDIR=
SYSTEM_INCDIR=
while [ 0 ] ; do
if [ "$1" = "-h" -o "$1" = "--help" ] ; then
usage
exit 0
elif [ "$1" = "-d" -o "$1" = "--target-dest-dir" ] ; then
if [ "$2" = "" ] ; then
echo -e "\n${program}: ERROR: --target-dest-dir is not specified.\n"
usage
exit 1
fi
TARGET_DEST_DIR="$2"
shift 2
elif [[ $1 == --target-dest-dir=* ]] ; then
TARGET_DEST_DIR="`echo $1 | cut -f2 -d'='`"
shift 1
else
if [ "$1" != "" ] ; then
echo -e "\n${program}: ERROR: Unknown argument: $1.\n"
usage
exit 1
fi
break
fi
done
if [ ! -d "${TARGET_DEST_DIR}" ] ; then
echo -e "\n${program}: ERROR: --target-dest-dir is not a directory.\n"
usage
exit 1
fi
# Absolute path:
if [ "${TARGET_DEST_DIR:0:1}" != "/" ] ; then
TARGET_DEST_DIR=${CWD}/${TARGET_DEST_DIR}
fi
# Remove last '/' char except for the root itself:
if [ "${TARGET_DEST_DIR}" != "/" -a "${TARGET_DEST_DIR: -1}" = "/" ] ; then
len=${#TARGET_DEST_DIR}
let "len = len - 1"
tmp="${TARGET_DEST_DIR:0:$len}"
TARGET_DEST_DIR=${tmp}
fi
if [ "${TARGET_DEST_DIR}" = "/" ] ; then
SYSTEM_ACDIR=/${ACDIR}
SYSTEM_INCDIR=/${INCDIR}
else
SYSTEM_ACDIR="${TARGET_DEST_DIR}/${ACDIR}"
SYSTEM_INCDIR="${TARGET_DEST_DIR}/${INCDIR}"
fi
aclocal --install -I m4 --force --system-acdir=${SYSTEM_ACDIR} || exit 1
autoheader --include=${SYSTEM_INCDIR} || exit 1
automake --gnu --add-missing --copy --force-missing || exit 1
autoconf --force || exit 1
rm -rf autom4te.cache
|