X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=easy-builder;h=220649fd9cf2b8d6d0a4cc2a2c074e87913377d1;hb=f662350b758060273877907565413f253f45be72;hp=845d2c7ca2e29f5a1e28fcf185fc6a5c923d4c8e;hpb=41d1f1587bc636a5a23f77ab9ae80a6f52a6dbab;p=xonotic%2Fnetradiant.git diff --git a/easy-builder b/easy-builder index 845d2c7c..220649fd 100755 --- a/easy-builder +++ b/easy-builder @@ -14,6 +14,28 @@ install_dir="${project_source_dir}/install${SUBDIR:+/${SUBDIR}}" install_target='install/strip' build_type='Release' +case "$(uname -s)" in + # Stripping is known to make non-PIE Linux netradiant binary unusable. + # Maybe that's related to the way we patch rpath? + # + # Building NetRadiant as non-PIE is required because of + # a mistake in the mimetype-library that prevents users + # to run the application from file managers on Linux. + # + # See: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/11 + # + # After installation it's possible to strip manually all binaries except + # the netradiant one. + 'Linux') + install_target='install' + ;; + # Stripping is known to make FreeBSD binaries unusable. + # Maybe that's related to the way we patch rpath? + 'FreeBSD') + install_target='install' + ;; +esac + _job_count=4 _nproc () { @@ -25,9 +47,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 +105,63 @@ 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 () { + sync + mkdir -pv "${build_dir}" + cd "${build_dir}" +} + +task_fetch_submodules () { + sync + "${fetch_submodules_cmd[@]}" +} + +task_configure () { + sync + 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 () { + sync + make -j"${job_count}" builtins +} + +task_discover_builtins () { + sync + cmake "${project_source_dir}" +} + +task_build () { + sync + make -j"${job_count}" +} + +task_install () { + sync + make "${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 + +task_discover_builtins + +task_build + +task_install