qi: Bump to release 2.12
[dragora.git] / stages / 1 / 17-qi
blob4bf48171919ffb0ed78b846d828c02d2a477b169
1 # Build script for qi.
3 # Copyright (c) 2015-2024 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 echo "Making Qi from ${worktree}/qi ..."
19 cd -- "${worktree}/qi"
21 # Set default compiler options for Dragora
22 case $arch in
23 i586)
24     package_cflags="-O2 -march=pentium-mmx -mtune=pentiumpro -fstack-clash-protection -fstack-protector-strong --param=ssp-buffer-size=4 -pipe"
25     package_cxxflags="$package_cflags"
26     package_ldflags="-s"
27     package_cppflags="-D_FORTIFY_SOURCE=2"
28     ;;
29 x86_64)
30     package_cflags="-fPIC -O2 -mtune=generic -fstack-clash-protection -fcf-protection=full -fstack-protector-strong --param=ssp-buffer-size=4 -pipe"
31     package_cxxflags="$package_cflags"
32     package_ldflags="-s"
33     package_cppflags="-D_FORTIFY_SOURCE=2"
34     ;;
36     package_cflags="-O2 -fstack-protector-strong --param=ssp-buffer-size=4 -pipe"
37     package_cxxflags="$package_cflags"
38     package_ldflags="-s"
39     package_cppflags="-D_FORTIFY_SOURCE=2"
40     ;;
41 esac
43 make -j1 clean
45 ./configure \
46  --prefix=/tools \
47  --localstatedir=/var \
48  --packagedir=/usr/pkg \
49  --targetdir=/ \
50  --arch=$package_arch \
51  --qi-cflags="$package_cflags" \
52  --qi-cxxflags="$package_cxxflags" \
53  --qi-ldflags="$package_ldflags" \
54  --qi-cppflags="$package_cppflags"
56 unset -v package_cflags package_cxxflags package_ldflags package_cppflags
58 make -j1 install
60 # Clean up the source repository
62 rm -f config.mak
63 make -j1 clean
65 # Make available "usr/pkg" directory and output directory
66 mkdir -p -- "${rootdir}/usr/pkg" "${rootdir}/var/cache/qi/packages"
68 # Adjust prefixes in config for final system installation
69 sed -i \
70  -e 's|/tools|/usr|g'   \
71  -e 's|/usr/etc|/etc|'  \
72  /tools/etc/qirc
74 # Include additional settings from targets/
76 # We prefix '--enable-multilib' for targets supporting it,
77 # the native GCC wants this option explicitly
78 if test -n "$multilib_options"
79 then
80     case $multilib_options in
81     *--disable-multilib* | *--enable-multilib* | *--with-multilib-list=)
82         true
83         ;;
84     *)
85         multilib_options="--enable-multilib $multilib_options"
86         ;;
87     esac
90 cat << EOF >> /tools/etc/qirc
92 # Multilib options
93 multilib_options="$multilib_options"
95 # lib<equal> suffix (multilib, if any)
96 libSuffix="$libSuffix"
98 # GCC (arch-specific) options
99 gcc_options="$gcc_options"
102 chmod 644 /tools/etc/qirc