summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-07-24 08:04:06 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2017-07-24 08:04:06 +0200
commit12580126ba41a2ab18bd0124afec887de26ff09e (patch)
treeafcd77f971f55c87d70fa4514f69b38993935ec3
parent87c326faf0c22f553e78471f7e8163312779645b (diff)
build-fct : clean up meson code path
-rwxr-xr-xbuild-fcts.sh58
1 files changed, 30 insertions, 28 deletions
diff --git a/build-fcts.sh b/build-fcts.sh
index 982e5cc..88ca321 100755
--- a/build-fcts.sh
+++ b/build-fcts.sh
@@ -19,7 +19,6 @@
19set -e 19set -e
20shopt -s expand_aliases 20shopt -s expand_aliases
21 21
22unset LANG
23MAKE_J="-j5" 22MAKE_J="-j5"
24export TERM=xterm-color 23export TERM=xterm-color
25 24
@@ -159,9 +158,9 @@ function build()
159 158
160 if [ $do_build -gt 0 ] 159 if [ $do_build -gt 0 ]
161 then 160 then
161 [ $use_meson -eq 1 -a -f "meson.build" ] && do_meson && return
162 local configure="./configure" 162 local configure="./configure"
163 local autogen="./autogen.sh" 163 local autogen="./autogen.sh"
164 local mesonfile="./meson.build"
165 local cmakedir="./" 164 local cmakedir="./"
166 local cmakefile="./CMakeLists.txt" 165 local cmakefile="./CMakeLists.txt"
167 166
@@ -172,25 +171,20 @@ function build()
172 [ ! -d "$BUILD_DIR" ] && ( mkdir "$BUILD_DIR" || fatal "mkdir" ) 171 [ ! -d "$BUILD_DIR" ] && ( mkdir "$BUILD_DIR" || fatal "mkdir" )
173 pushd "$BUILD_DIR" >/dev/null || fatal "pushd" 172 pushd "$BUILD_DIR" >/dev/null || fatal "pushd"
174 configure=".$configure" 173 configure=".$configure"
175 mesonfile=".$mesonfile"
176 cmakedir=".$cmakedir" 174 cmakedir=".$cmakedir"
177 cmakefile=".$cmakefile" 175 cmakefile=".$cmakefile"
178 fi 176 fi
179 177
180 [ $CLEAN_LEVEL -ge 2 -a -f Makefile ] && exec_cmd make distclean >/dev/null || true 178 [ $CLEAN_LEVEL -ge 2 -a -f Makefile ] && exec_cmd "make distclean" >/dev/null || true
181 [ $CLEAN_LEVEL -ge 1 -a -f Makefile ] && exec_cmd make clean >/dev/null || true 179 [ $CLEAN_LEVEL -ge 1 -a -f Makefile ] && exec_cmd "make clean" >/dev/null || true
182 if [ $CLEAN_LEVEL -ge 5 -a -f "$autogen" -a $use_meson -eq 0 ] 180 if [ $CLEAN_LEVEL -ge 5 -a -f "$autogen" ]
183 then 181 then
184 say "$autogen" && NOCONFIGURE=1 $autogen >/dev/null 2>&1 182 say "$autogen" && NOCONFIGURE=1 $autogen >/dev/null 2>&1
185 [ -f "$configure" ] || fatal "no $configure -> no can do !!!" 183 [ -f "$configure" ] || fatal "no $configure -> no can do !!!"
186 fi 184 fi
187 if [ $CLEAN_LEVEL -ge 3 -o ! -f Makefile ] 185 if [ $CLEAN_LEVEL -ge 3 -o ! -f Makefile ]
188 then 186 then
189 if [ $use_meson -eq 1 -a -f "$mesonfile" ] 187 if [ $try_cmake -eq 1 -a -f "$cmakefile" ]
190 then
191 [ $use_build_dir -eq 1 ] && popd
192 exec_cmd "meson --prefix=${PREFIX} $BUILD_DIR" || fatal "meson"
193 elif [ $try_cmake -eq 1 -a -f "$cmakefile" ]
194 then 188 then
195 exec_cmd "cmake $cmakedir -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}" || fatal "cmake" 189 exec_cmd "cmake $cmakedir -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX}" || fatal "cmake"
196 else 190 else
@@ -198,26 +192,34 @@ function build()
198 fi 192 fi
199 fi 193 fi
200 194
201 if [ $use_meson -eq 1 ] 195 echo -e " $RED:: build $RESET"
202 then 196 exec_cmd "make $MAKE_J" || fatal "make"
203 [ $CLEAN_LEVEL -ge 2 ] && exec_cmd "mesonconf --clearcache $BUILD_DIR" || fatal "mesonconf" 197 echo -e " $RED:: install $RESET"
204 exec_cmd "mesonconf $BUILD_DIR" || fatal "mesonconf" 198 say "make install" && echo "$SUDO_PASSWD" | sudo -S make install >/dev/null 2>&1 || fatal "make install"
205 pushd "$BUILD_DIR" >/dev/null || fatal "pushd"
206 echo -e " $RED:: build $RESET"
207 exec_cmd "ninja " || fatal "ninja"
208 echo -e " $RED:: install $RESET"
209 say "ninja install" && echo "$SUDO_PASSWD" | sudo -S ninja install >/dev/null 2>&1 || fatal "make install"
210 else
211 echo -e " $RED:: build $RESET"
212 exec_cmd "make $MAKE_J" || fatal "make"
213 echo -e " $RED:: install $RESET"
214 say "make install" && echo "$SUDO_PASSWD" | sudo -S make install >/dev/null 2>&1 || fatal "make install"
215 fi
216 echo "$SUDO_PASSWD" | sudo -S ldconfig 199 echo "$SUDO_PASSWD" | sudo -S ldconfig
217
218 [ $use_build_dir -eq 1 ] && popd
219 fi 200 fi
220 201
221 popd 202 popd
222} 203}
223 204
205function do_meson
206{
207 local mesontoken="build/meson-private/coredata.dat" # mesonmain.py#validate_dirs
208 echo -e " $RED:: clean $RESET"
209 [ $CLEAN_LEVEL -ge 4 -a -d $BUILD_DIR ] && exec_cmd "rm -fr $BUILD_DIR" 2>/dev/null
210 if [ ! -f "$mesontoken" ]
211 then
212 exec_cmd "meson --prefix=${PREFIX} $BUILD_DIR" || fatal "meson"
213 exec_cmd "mesonconf $BUILD_DIR" || fatal "mesonconf"
214 else
215 [ $CLEAN_LEVEL -ge 3 ] && ( exec_cmd "mesonconf --clearcache $BUILD_DIR" || fatal "mesonconf" )
216 fi
217 pushd "$BUILD_DIR" >/dev/null || fatal "pushd"
218 [ $CLEAN_LEVEL -ge 1 -a -f build.ninja ] && exec_cmd "ninja clean"
219 echo -e " $RED:: build $RESET"
220 exec_cmd "ninja" || fatal "ninja"
221 echo -e " $RED:: install $RESET"
222 say "ninja install" && echo "$SUDO_PASSWD" | sudo -S ninja install >/dev/null 2>&1 || fatal "make install"
223 echo "$SUDO_PASSWD" | sudo -S ldconfig
224 popd
225}