stages: 1/16-qi: make sure to create the usr/pkg directory for build the final system
[dragora.git] / stages / 1 / 16-qi
blob9e68118bd4b6fb224d088b3279b8e6206fcd74a4
1 # Build script for qi.
3 # Copyright (c) 2015-2019 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 ${CWD}/qi ..."
19 cd -- "${CWD}/qi"
21 make -j1 clean
23 ./configure \
24  --prefix=/tools \
25  --packagedir=/usr/pkg \
26  --targetdir=/
28 make -j1 install
30 # Clean up the source repository
32 rm -f config.mak
33 make -j1 clean
35 # Create usr/pkg directory at 'rootdir'
36 mkdir -p -- "${rootdir}/usr/pkg"
38 # Copy our custom qirc to /tools
39 cp -p "${worktree}/archive/qi/qirc" /tools/etc/
41 # Set compiler options provided by default in Dragora
42 case $arch in
43 i586)
44     sed -i \
45      -e 's|#QICFLAGS=.*|QICFLAGS=-g0 -Os -march=i586 -mtune=i686|' \
46      -e 's|#QICXXFLAGS=.*|QICXXFLAGS=-g0 -Os -march=i586 -mtune=i686|' \
47      /tools/etc/qirc
48     ;;
49 x86_64)
50     sed -i \
51      -e 's|#QICFLAGS=.*|QICFLAGS=-g0 -Os -mtune=generic -pipe|' \
52      -e 's|#QICXXFLAGS=.*|QICXXFLAGS=-g0 -Os -mtune=generic -pipe|' \
53      /tools/etc/qirc
54     ;;
56     sed -i \
57      -e 's|#QICFLAGS=.*|QICFLAGS=-g0 -Os -pipe|' \
58      -e 's|#QICXXFLAGS=.*|QICXXFLAGS=-g0 -Os -pipe|' \
59      /tools/etc/qirc
60     ;;
61 esac
63 # Include additional settings from targets/
65 # We prefix '--enable-multilib' for targets supporting it,
66 # the native GCC wants this option explicitly
67 if test -n "$multilib_options"
68 then
69     case $multilib_options in
70     *--disable-multilib* | *--enable-multilib* | *--with-multilib-list=)
71         true
72         ;;
73     *)
74         multilib_options="--enable-multilib $multilib_options"
75         ;;
76     esac
79 cat << EOF >> /tools/etc/qirc
81 # Multilib options
82 multilib_options=$multilib_options
84 # lib<equal> suffix (multilib, if any)
85 libSuffix=$libSuffix
87 # GCC (arch-specific) options
88 gcc_options=$gcc_options
89 EOF
91 chmod 644 /tools/etc/qirc