-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·121 lines (101 loc) · 2.83 KB
/
configure
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
VERSION=1.2.1
VERSION_FULL=${VERSION}$(./version.sh)
PREFIX="${PREFIX:-/usr/local}"
BINDIR="${BINDIR:-${PREFIX}/bin}"
MANDIR="${MANDIR:-${PREFIX}/share/man}"
DOCDIR="${DOCDIR:-${PREFIX}/share/doc/badwolf-${VERSION}}"
DATADIR="${DATADIR:-${PREFIX}/share/lrrh}"
APPSDIR="${APPSDIR:-${PREFIX}/share/applications}"
PKGCONFIG="${PKGCONFIG:-pkg-config}"
MSGFMT="${MSGFMT:-msgfmt}"
INKSCAPE="${INKSCAPE:-inkscape}"
CC="${CC:-cc}"
CFLAGS="${CFLAGS:--g -O2 -pie -fPIE} -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wconversion -Wsign-conversion -Werror=implicit-int -Werror=vla ${EXTRA_CFLAGS}"
MANDOC="mandoc"
DEPS="gtk+-3.0 libxml-2.0"
is_ok() {
status="$?"
if test $status -eq 0; then
printf " OK\n"
else
printf " FAIL\n"
fi
return $status
}
required() {
is_ok || exit 1
}
pkg_config_check() {
printf 'Checking: %s %s ...' "${PKGCONFIG}" "$*"
"${PKGCONFIG}" "$@"
is_ok
}
printf 'Checking %s command existance ...' "${PKGCONFIG}"
command -v "${PKGCONFIG}" >/dev/null ; required
printf 'Checking %s command existance ...' "${CC}"
command -v "${CC}" >/dev/null ; required
printf 'Checking %s command existance ...' "${MANDOC}"
if command -v "${CC}" >/dev/null ; is_ok
then
:
else
MANDOC="true"
fi
for dep in ${DEPS}
do
pkg_config_check --exists "$dep" || exit 1
done
case "${WITH_WEBKITGTK}n" in
4.1n)
pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1 || exit 1
DEPS="${DEPS} webkit2gtk-4.1"
;;
4.0n)
pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1
DEPS="${DEPS} webkit2gtk-4.0"
;;
n)
echo "warning: Packagers should specify the ABI version (4.0 or 4.1) in WITH_WEBKITGTK" >&2
if pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1
then
DEPS="${DEPS} webkit2gtk-4.1"
else
pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1
DEPS="${DEPS} webkit2gtk-4.0"
fi
;;
*)
echo "error: invalid webkit2gtk version in WITH_WEBKITGTK environment variable, must be 4.0 or 4.1" >&2
exit 1
;;
esac
get_cflags() { "${PKGCONFIG}" --cflags "${DEPS}"; }
DEPS_cflags="$(get_cflags)"
get_libs() { "${PKGCONFIG}" --libs "${DEPS}"; }
DEPS_libs="$(get_libs)"
ICON_SIZES="$(for i in 24 32 48 64 128 256; do printf 'icons/hicolor/%sx%s/apps/badwolf.png ' $i $i ; done)"
printf 'Writing to config.mk ...'
cat >config.mk <<EOF
# Autogenerated by ./configure
PACKAGE = Badwolf
VERSION = ${VERSION}
VERSION_FULL = ${VERSION_FULL}
PREFIX = ${PREFIX}
BINDIR = ${BINDIR}
MANDIR = ${MANDIR}
DOCDIR = ${DOCDIR}
DATADIR = ${DATADIR}
APPSDIR = ${APPSDIR}
PKGCONFIG = ${PKGCONFIG}
CC = ${CC}
INKSCAPE = ${INKSCAPE}
MSGFMT = ${MSGFMT}
DBG = ${DBG}
MANDOC = ${MANDOC}
CFLAGS = ${CFLAGS} -DDATADIR=\"\${DATADIR}\" -DPACKAGE=\"\${PACKAGE}\" -D_XOPEN_SOURCE=700 -DVERSION=\"\${VERSION_FULL}\" ${DEPS_cflags}
LIBS = ${DEPS_libs}
ICON_SIZES = ${ICON_SIZES}
EOF
is_ok
echo 'Done, you can now run make'