diff options
author | midipix <writeonce@midipix.org> | 2016-05-11 00:05:15 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-05-11 00:14:45 -0400 |
commit | a6e0dcb609cefabff2817b2dd7bbc6698c5870d6 (patch) | |
tree | 5bf3db2a1b0ad26f773708eb7a79f78b8d2bf9f1 /configure | |
parent | 3be73d5188b49d43edfc2bd80dca3d06063b34a3 (diff) | |
download | dalist-a6e0dcb609cefabff2817b2dd7bbc6698c5870d6.tar.bz2 dalist-a6e0dcb609cefabff2817b2dd7bbc6698c5870d6.tar.xz |
build system: upgrade build system, eliminate differences in core definitions.
Prior to this patch, there were several differences between this project's
build system and the one from which it was derived (sofort). Although the
differences were very minor and for the most part related to this project
being part of a free-standing, midipix-specific development framework,
they still added an extra maintenance burden, specifically by requiring
that common changes be applied via patch(1) rather than git-am(1).
Following recent improvements to the common build system, it is now
possible to have a free-standing, midipix-specific project without
any changes to the core build system files, hence the current upgrade.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 156 |
1 files changed, 151 insertions, 5 deletions
@@ -13,7 +13,7 @@ usage() error_msg() { - echo $@ >&2 + echo "$@" >&2 } @@ -28,6 +28,14 @@ init_vars() . "$mb_config" || exit 2 fi + # git + if [ -d "$mb_project_dir/.git" ]; then + mb_git_reference_dir="\$(PROJECT_DIR)/.git" + fi + + # project + mb_nickname=$NICKNAME + # dirs mb_prefix=$PREFIX mb_exec_prefix=$EXEC_PREFIX @@ -57,7 +65,11 @@ init_vars() mb_cflags_cmdline=$CFLAGS_CMDLINE mb_cflags_config=$CFLAGS_CONFIG mb_cflags_sysroot=$CFLAGS_SYSROOT + mb_cflags_os=$CFLAGS_OS + mb_cflags_site=$CFLAGS_SITE mb_cflags_path=$CFLAGS_PATH + mb_cflags_strict=$CFLAGS_STRICT + mb_cflags_util=$CFLAGS_UTIL mb_ldflags=$LDFLAGS mb_ldflags_debug=$LDFLAGS_DEBUG @@ -66,6 +78,8 @@ init_vars() mb_ldflags_config=$LDFLAGS_CONFIG mb_ldflags_sysroot=$LDFLAGS_SYSROOT mb_ldflags_path=$LDFLAGS_PATH + mb_ldflags_strict=$LDFLAGS_STRICT + mb_ldflags_util=$LDFLAGS_UTIL mb_pe_subsystem=$PE_SUBSYSTEM mb_pe_image_base=$PE_IMAGE_BASE @@ -103,6 +117,10 @@ verify_build_directory() common_defaults() { + # project + [ -z "$mb_nickname" ] && mb_nickname=$mb_package + [ -z "$mb_avoid_version" ] && mb_avoid_version='no' + # dirs [ -z "$mb_prefix" ] && [ -z "$mb_prefix_set" ] \ && mb_prefix='/usr/local' @@ -135,7 +153,11 @@ common_defaults() [ -z "$mb_cflags_cmdline" ] && mb_cflags_cmdline=$mb_default_cflags_cmdline [ -z "$mb_cflags_config" ] && mb_cflags_config=$mb_default_cflags_config [ -z "$mb_cflags_sysroot" ] && mb_cflags_sysroot=$mb_default_cflags_sysroot + [ -z "$mb_cflags_os" ] && mb_cflags_os=$mb_default_cflags_os + [ -z "$mb_cflags_site" ] && mb_cflags_site=$mb_default_cflags_site [ -z "$mb_cflags_path" ] && mb_cflags_path=$mb_default_cflags_path + [ -z "$mb_cflags_strict" ] && mb_cflags_strict=$mb_default_cflags_strict + [ -z "$mb_cflags_util" ] && mb_cflags_util=$mb_default_cflags_util [ -z "$mb_ldflags_debug" ] && mb_ldflags_debug=$mb_default_ldflags_debug [ -z "$mb_ldflags_common" ] && mb_ldflags_common=$mb_default_ldflags_common @@ -143,6 +165,8 @@ common_defaults() [ -z "$mb_ldflags_config" ] && mb_ldflags_config=$mb_default_ldflags_config [ -z "$mb_ldflags_sysroot" ] && mb_ldflags_sysroot=$mb_default_ldflags_sysroot [ -z "$mb_ldflags_path" ] && mb_ldflags_path=$mb_default_ldflags_path + [ -z "$mb_ldflags_strict" ] && mb_ldflags_strict=$mb_default_ldflags_strict + [ -z "$mb_ldflags_util" ] && mb_ldflags_util=$mb_default_ldflags_util [ -z "$mb_pe_subsystem" ] && mb_pe_subsystem=$mb_default_pe_subsystem [ -z "$mb_pe_image_base" ] && mb_pe_image_base=$mb_default_pe_image_base @@ -152,6 +176,13 @@ common_defaults() [ -z "$mb_elf_hash_style" ] && mb_elf_hash_style=$mb_default_elf_hash_style [ -z "$mb_elf_config_defs" ] && mb_elf_config_defs=$mb_default_elf_config_defs + # config + [ -z "$mb_all_static" ] && mb_all_static='no' + [ -z "$mb_all_shared" ] && mb_all_shared='no' + [ -z "$mb_disable_frontend" ] && mb_disable_frontend='no' + [ -z "$mb_disable_static" ] && mb_disable_static='no' + [ -z "$mb_disable_shared" ] && mb_disable_shared='no' + # host/target [ -z "$mb_host" ] && mb_host=$mb_target [ -z "$mb_target" ] && mb_target=$mb_host @@ -282,9 +313,10 @@ native_defaults() exit 2 fi - [ -z "$mb_native_os" ] && mb_native_os=$mb_native_os - [ -z "$mb_native_os_bits" ] && mb_native_os_bits=$mb_native_os_bits - [ -z "$mb_native_os_underscore" ] && mb_native_os_underscore=$mb_native_os_underscore + # fallback os recipe + if ! [ -f $mb_project_dir/sysinfo/os/$mb_native_os.mk ]; then + mb_native_os='any-os'; + fi } @@ -296,10 +328,36 @@ cross_defaults() } +config_flags() +{ + mb_ldflags_tmp=" $mb_ldflags " + mb_ldflags_libs=`echo "$mb_ldflags_tmp" | sed 's/ -static / /g'` + + if [ "$mb_ldflags_tmp" != "$mb_ldflags_libs" ]; then + mb_ldflags="$mb_ldflags_libs" + mb_ldflags_util="$mb_ldflags_util -static" + fi + + # ccstrict + if [ "$mb_ccstrict" = 'yes' ]; then + mb_cflags_strict='-Wall -Werror -Wextra -Wundef' + fi + + # ldstrict + if [ "$mb_ldstrict" = 'yes' ]; then + mb_ldflags_strict='-Wl,--no-undefined' + fi +} + + config_copy() { sed -e 's^@package@^'"$mb_package"'^g' \ + -e 's^@nickname@^'"$mb_nickname"'^g' \ -e 's^@project_dir@^'"$mb_project_dir"'^g' \ + -e 's^@git_reference_dir@^'"$mb_git_reference_dir"'^g' \ + -e 's^@custom_install_headers@^'"$mb_custom_install_headers"'^g' \ + -e 's^@avoid_version@^'"$mb_avoid_version"'^g' \ \ -e 's^@build@^'"$mb_build"'^g' \ -e 's^@host@^'"$mb_host"'^g' \ @@ -317,7 +375,11 @@ config_copy() -e 's^@cflags_cmdline@^'"$mb_cflags $mb_cflags_cmdline"'^g' \ -e 's^@cflags_config@^'"$mb_cflags_config"'^g' \ -e 's^@cflags_sysroot@^'"$mb_cflags_sysroot"'^g' \ + -e 's^@cflags_os@^'"$mb_cflags_os"'^g' \ + -e 's^@cflags_site@^'"$mb_cflags_site"'^g' \ -e 's^@cflags_path@^'"$mb_cflags_path"'^g' \ + -e 's^@cflags_strict@^'"$mb_cflags_strict"'^g' \ + -e 's^@cflags_util@^'"$mb_cflags_util"'^g' \ \ -e 's^@ldflags@^'"$mb_ldflags"'^g' \ -e 's^@ldflags_debug@^'"$mb_ldflags_debug"'^g' \ @@ -326,6 +388,8 @@ config_copy() -e 's^@ldflags_config@^'"$mb_ldflags_config"'^g' \ -e 's^@ldflags_sysroot@^'"$mb_ldflags_sysroot"'^g' \ -e 's^@ldflags_path@^'"$mb_ldflags_path"'^g' \ + -e 's^@ldflags_strict@^'"$mb_ldflags_strict"'^g' \ + -e 's^@ldflags_util@^'"$mb_ldflags_util"'^g' \ \ -e 's^@pe_subsystem@^'"$mb_pe_subsystem"'^g' \ -e 's^@pe_image\_base@^'"$mb_pe_image_base"'^g' \ @@ -346,16 +410,43 @@ config_copy() \ -e 's^@native_cc@^'"$mb_native_cc"'^g' \ -e 's^@native_os@^'"$mb_native_os"'^g' \ - -e 's^@native_os_bits@^'"$mb_native_os_bits"'^g' \ + -e 's^@native_os_bits@^'"$mb_native_os_bits"'^g' \ -e 's^@native_os_underscore@^'"$mb_native_os_underscore"'^g' \ \ -e 's^@user_cc@^'"$mb_user_cc"'^g' \ -e 's^@user_cpp@^'"$mb_user_cpp"'^g' \ -e 's^@user_cxx@^'"$mb_user_cxx"'^g' \ + \ + -e 's^@all_static@^'"$mb_all_static"'^g' \ + -e 's^@all_shared@^'"$mb_all_shared"'^g' \ + -e 's^@disable_frontend@^'"$mb_disable_frontend"'^g' \ + -e 's^@disable_static@^'"$mb_disable_static"'^g' \ + -e 's^@disable_shared@^'"$mb_disable_shared"'^g' \ $mb_project_dir/Makefile.in > $mb_pwd/Makefile } +config_support() +{ + [ "$mb_disable_shared" = 'yes' ] && return 0 + + mbt_cc=`make .display-cc` + mbt_cflags=`make .display-cflags` + mbt_source='int foo(int x){return ++x;}' + mbt_result='no' + + rm -f a.out + echo "$mbt_source" | "$mbt_cc" -shared -o a.out -xc - + stat a.out >/dev/null 2>&1 && mbt_result='yes' + rm -f a.out + + if [ "$mbt_result" = 'no' ]; then + mb_disable_shared='yes' + config_copy + fi +} + + config_host() { make -s host.tag && return 0 @@ -442,6 +533,59 @@ for arg ; do --debug) mb_debug='yes' ;; + + # config + --all-static) + mb_all_static='yes' + ;; + --all-shared) + mb_all_shared='yes' + ;; + --disable-frontend) + mb_disable_frontend='yes' + ;; + --disable-app) + mb_disable_frontend='yes' + ;; + --enable-frontend) + mb_disable_frontend='no' + ;; + --enable-app) + mb_disable_frontend='no' + ;; + --disable-static) + mb_disable_static='yes' + ;; + --disable-shared) + mb_disable_shared='yes' + ;; + --enable-static) + mb_disable_static='no' + ;; + --enable-shared) + mb_disable_shared='no' + ;; + + # convenience + --strict) + mb_ccstrict='yes' + mb_ldstrict='yes' + ;; + --ccstrict) + mb_ccstrict='yes' + ;; + --ldstrict) + mb_ldstrict='yes' + ;; + + # project + --nickname=*) + mb_nickname=${arg#*=} + ;; + --avoid-version) + mb_avoid_version='yes' + ;; + *) error_msg ${arg#}: "unsupported config argument." exit 2 @@ -459,7 +603,9 @@ cross_defaults # four: config +config_flags config_copy +config_support config_host config_status |