-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJinxfile
More file actions
151 lines (133 loc) · 4.54 KB
/
Copy pathJinxfile
File metadata and controls
151 lines (133 loc) · 4.54 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/sh
JINX_MAJOR_VER=0.10
JINX_DEBIAN_SNAPSHOT=20260603T142951Z
JINX_BASE_PACKAGES="autopoint bison cmake docbook-xsl docbook-xml docbook-xsl-ns docbook5-xml doxygen file flex gettext groff m4 make meson ninja-build perl python3 texinfo w3m which xmlto xsltproc libmpc-dev libisl-dev"
OS_TRIPLET="${JINX_ARCH}-cascade"
SHARED_CFLAGS="-O2 -pipe"
SHARED_CXXFLAGS="-O2 -pipe"
HOST_CFLAGS="${SHARED_CFLAGS} -mtune=native"
HOST_CXXFLAGS="${SHARED_CXXFLAGS} -mtune=native"
case "${JINX_ARCH}" in
x86_64)
TARGET_CFLAGS="${SHARED_CFLAGS} -march=x86-64 -mtune=generic"
TARGET_CXXFLAGS="${SHARED_CXXFLAGS} -march=x86-64 -mtune=generic"
;;
esac
checked_subst() {
tmpfile="$2".checked_subst
sed -z -E -e "$1" "$2" >"$tmpfile"
if cmp -s "$2" "$tmpfile"; then
rm -f "$2".checked_subst
if [ "$3" = no_die ]; then
return 1
else
die "*** substitution '$1' failed for file '$2'"
fi
fi
touch -r "$2" "$2".checked_subst
chmod --reference="$2" "$2".checked_subst
mv -f "$2".checked_subst "$2"
}
autotools_recursive_regen() {
for f in $(grep -rl 'GNU config.sub ($timestamp)'); do
mv "$f" "$f".reference
cp -v ${base_dir}/support/autotools/config.sub "$f"
touch -r "$f".reference "$f"
rm -f "$f".reference
done
for f in $(grep -rl 'GNU config.guess ($timestamp)'); do
mv "$f" "$f".reference
cp -v ${base_dir}/support/autotools/config.guess "$f"
touch -r "$f".reference "$f"
rm -f "$f".reference
done
if ! [ -z "$(grep -rl "# No shared lib support for Linux oldld, aout, or coff.")" ]; then
for f in $(grep -rl "We cannot seem to hardcode it, guess we'll fake it."); do
if grep -q 'add_dir="\?-L$lt_sysroot$libdir"\?' "$f"; then
continue
fi
checked_subst 's/add_dir=(")?-L\$libdir(")?/add_dir=\1-L$lt_sysroot$libdir\1/g' "$f"
done
for f in $(grep -rl "# No shared lib support for Linux oldld, aout, or coff."); do
if grep -q 'AC_DEFUN(\[AC_PROG_LIBTOOL\]' "$f"; then
continue
fi
if grep -q 'ltconfig - Create a system-specific libtool' "$f"; then
continue
fi
checked_subst 's/(kopensolaris\*-gnu)/\1 | cascade*/g' "$f"
done
fi
}
autotools_configure() {
CFLAGS="$TARGET_CFLAGS" \
CXXFLAGS="$TARGET_CXXFLAGS" \
autotools_configure_noflags "$@"
}
autotools_configure_noflags() {
if [ -z "${configure_script_path-}" ]; then
configure_script_path="${source_dir}/configure"
fi
ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_calloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes \
${configure_script_path} \
--host=${OS_TRIPLET} \
--with-sysroot=${sysroot} \
--prefix=${prefix} \
--sysconfdir=/etc \
--localstatedir=/var \
--bindir=${prefix}/bin \
--sbindir=${prefix}/bin \
--libdir=${prefix}/lib \
--disable-malloc0returnsnull \
--enable-static \
--disable-shared \
"$@"
}
meson_configure() {
CFLAGS="$TARGET_CFLAGS" \
CXXFLAGS="$TARGET_CXXFLAGS" \
meson_configure_noflags "$@"
}
meson_configure_noflags() {
if [ -z "${meson_source_dir-}" ]; then
meson_source_dir="${source_dir}"
fi
meson setup "${meson_source_dir}" \
--cross-file "${base_dir}/support/meson/${JINX_ARCH}.cross-file" \
--prefix=${prefix} \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=lib \
--sbindir=bin \
--buildtype=release \
-Ddefault_library=static \
"$@"
}
cmake_configure() {
CFLAGS="$TARGET_CFLAGS" \
CXXFLAGS="$TARGET_CXXFLAGS" \
cmake_configure_noflags "$@"
}
cmake_configure_noflags() {
if [ -z "${cmake_source_dir-}" ]; then
cmake_source_dir="${source_dir}"
fi
cmake "${cmake_source_dir}" \
-DCMAKE_TOOLCHAIN_FILE="${base_dir}/support/cmake/CMakeToolchain_${JINX_ARCH}.cmake" \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_SBINDIR=bin \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_STATIC=ON \
-DBUILD_STATIC_LIBS=ON \
-DENABLE_SHARED=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DPKG_CONFIG_EXECUTABLE="/usr/local/bin/$OS_TRIPLET-pkg-config" \
-DCMAKE_COLOR_DIAGNOSTICS=ON \
-GNinja \
"$@"
}