]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - easy-builder
easy-builder: don't forget submodules
[xonotic/netradiant.git] / easy-builder
index 845d2c7ca2e29f5a1e28fcf185fc6a5c923d4c8e..0f266902b90715ee0a8ad3c03cbabe1c57bd0b6b 100755 (executable)
@@ -14,6 +14,11 @@ install_dir="${project_source_dir}/install${SUBDIR:+/${SUBDIR}}"
 install_target='install/strip'
 build_type='Release'
 
+if [ "$(uname -s)" = 'FreeBSD' ]
+then
+       install_target='install'
+fi
+
 _job_count=4
 
 _nproc () {
@@ -25,9 +30,13 @@ _nproc () {
                        'Linux')
                                egrep "^processor" /proc/cpuinfo | wc -l
                                ;;
-                       'FreeBSD'|'Darwin')
+                       'FreeBSD')
                                sysctl -n hw.ncpu
                                ;;
+                       'Darwin')
+                               sysctl -n hw.logicalcpu \
+                               || sysctl -n hw.ncpu
+                               ;;
                        'MSYS_NT-'*|'CYGWIN_NT-'*|'MINGW'*'_NT-'*)
                                if command -v 'wmic' >/dev/null
                                then
@@ -79,32 +88,55 @@ done
 
 case "$(uname -s)" in
        'Darwin')
-               cmake_user_opts[${#cmake_user_opts[@]}]='-DBUILTIN_GTKGLEXT=ON'
+               cmake_user_opts[${#cmake_user_opts[@]}]='-DBUILTIN_GTKGLEXT=ON -DBUILTIN_GTKTHEME_MOJAVE=ON'
                ;;
 esac
 
+task_enter_build_dir () {
+       mkdir -pv "${build_dir}"
+       cd "${build_dir}"
+}
+
+task_fetch_submodules () {
+       "${fetch_submodules_cmd[@]}"
+}
+
+task_configure () {
+       cmake \
+               -G'Unix Makefiles' \
+               -D'CMAKE_INSTALL_PREFIX'="${install_dir}" \
+               -D'CMAKE_BUILD_TYPE'="${build_type}" \
+               "${cmake_user_opts[@]}" \
+               "${project_source_dir}"
+}
+
+task_build_builtins () {
+       cmake \
+               --build "${build_dir}" \
+               -- \
+               -j"${job_count}" \
+               'builtins'
+}
+
+task_build () {
+       cmake \
+               --build "${build_dir}" \
+               -- \
+               -j"${job_count}" \
+               "${install_target}"
+}
+
 set -x
 
-"${fetch_submodules_cmd[@]}"
-
-mkdir -pv "${build_dir}"
-cd "${build_dir}"
-
-cmake \
-       -G'Unix Makefiles' \
-       -D'CMAKE_INSTALL_PREFIX'="${install_dir}" \
-       -D'CMAKE_BUILD_TYPE'="${build_type}" \
-       "${cmake_user_opts[@]}" \
-       "${project_source_dir}"
-
-cmake \
-       --build "${build_dir}" \
-       -- \
-       -j"${job_count}" \
-       'builtins'
-
-cmake \
-       --build "${build_dir}" \
-       -- \
-       -j"${job_count}" \
-       "${install_target}"
+task_enter_build_dir
+
+task_fetch_submodules
+
+task_configure
+
+task_build_builtins
+
+# Sometime linking fails on macOS with this message:
+#   ld: symbol(s) not found for architecture x86_64
+# and restarting the build process just work.
+task_build || task_build