From 5943c816cf0d433a390010fa3f385c812eb30625 Mon Sep 17 00:00:00 2001 From: midipix Date: Jan 03 2019 03:21:07 +0000 Subject: build system: moved handling of pe-specific variables to ccenv. --- diff --git a/Makefile.in b/Makefile.in index be602cc..c17ddcb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,10 +79,6 @@ USER_CC = @user_cc@ USER_CPP = @user_cpp@ USER_CXX = @user_cxx@ -PE_SUBSYSTEM = @pe_subsystem@ -PE_IMAGE_BASE = @pe_image_base@ -PE_CONFIG_DEFS = @pe_config_defs@ - NATIVE_HOST = @native_host@ NATIVE_CFGHOST = @native_cfghost@ NATIVE_CFLAGS = @native_cflags@ @@ -281,9 +277,10 @@ clean: clean-implib rm -f build/$(PACKAGE).pc -.display: .display-project .display-pkgconf .display-env \ - .display-tools .display-flags .display-pe \ - .display-dirs .display-build .display-config +.display: .display-project .display-pkgconf .display-env \ + .display-tools .display-flags \ + .display-dirs .display-build \ + .display-config .conf: PAGER ?= less .conf: @@ -375,7 +372,6 @@ clean: clean-implib .display-pe: @echo PE_SUBSYSTEM:' '$(PE_SUBSYSTEM) @echo PE_IMAGE_BASE:' '$(PE_IMAGE_BASE) - @echo PE_CONFIG_DEFS:' '$(PE_CONFIG_DEFS) @echo .display-dirs: diff --git a/config.usage b/config.usage index 87fbdd3..f29f27c 100644 --- a/config.usage +++ b/config.usage @@ -147,7 +147,6 @@ supported variables: PE_SUBSYSTEM PE_IMAGE_BASE - PE_CONFIG_DEFS NATIVE_CC NATIVE_CPP diff --git a/configure b/configure index 23820a5..74af5fb 100755 --- a/configure +++ b/configure @@ -184,7 +184,6 @@ init_vars() mb_pe_subsystem=$PE_SUBSYSTEM mb_pe_image_base=$PE_IMAGE_BASE - mb_pe_config_defs=$PE_CONFIG_DEFS # overrides mb_user_cc=$CC @@ -199,6 +198,9 @@ init_vars() mb_native_cfghost=$NATIVE_CFGHOST mb_native_cflags=$NATIVE_CFLAGS mb_native_ldflags=$NATIVE_LDFLAGS + + mb_native_pe_subsystem=$NATIVE_PE_SUBSYSTEM + mb_native_pe_image_base=$NATIVE_PE_IMAGE_BASE } diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh index d6876c7..83b5daa 100644 --- a/sofort/ccenv/ccenv.sh +++ b/sofort/ccenv/ccenv.sh @@ -903,11 +903,30 @@ ccenv_set_os_dso_patterns() esac } +ccenv_set_os_pe_switches() +{ + if [ "$ccenv_os" = 'PE' ] && [ -z "$ccenv_pe_subsystem" ]; then + case "$ccenv_os" in + midipix | mingw ) + ccenv_pe_subsystem='windows' + ;; + * ) + ccenv_pe_subsystem='console' + ;; + esac + fi +} + ccenv_output_defs() { ccenv_in="$mb_project_dir/sofort/ccenv/ccenv.in" ccenv_mk="$mb_pwd/ccenv/$ccenv_cfgtype.mk" + if [ "$ccenv_cc_binfmt" = 'PE' ]; then + ccenv_pe="$mb_project_dir/sofort/ccenv/pedefs.in" + ccenv_in="$ccenv_in $ccenv_pe" + fi + if [ $ccenv_cfgtype = 'native' ]; then ccenv_tmp=$(mktemp) @@ -919,7 +938,7 @@ ccenv_output_defs() -e 's/NATIVE_#/#/g' \ -e 's/ =/=/g' \ -e 's/ +=/+=/g' \ - "$ccenv_in" > "$ccenv_tmp" + $ccenv_in > "$ccenv_tmp" ccenv_in="$ccenv_tmp" fi @@ -935,7 +954,7 @@ ccenv_output_defs() "$__var" "'/g' "; \ done)" - eval sed $ccenv_sed_substs "$ccenv_in" \ + eval sed $ccenv_sed_substs $ccenv_in \ | sed -e 's/[ \t]*$//g' \ > "$ccenv_mk" @@ -1015,12 +1034,18 @@ ccenv_common_init() ccenv_cc="$mb_user_cc" ccenv_cpp="$mb_user_cpp" ccenv_cxx="$mb_user_cxx" + + ccenv_pe_subsystem="$mb_pe_subsystem" + ccenv_pe_image_base="$mb_pe_image_base" else ccenv_tflags= ccenv_cflags="$mb_native_cflags" ccenv_cc="$mb_native_cc" ccenv_cpp="$mb_native_cpp" ccenv_cxx="$mb_native_cxx" + + ccenv_pe_subsystem="$mb_native_pe_subsystem" + ccenv_pe_image_base="$mb_native_pe_image_base" fi } @@ -1048,6 +1073,7 @@ ccenv_set_toolchain_variables() ccenv_set_os_dso_exrules ccenv_set_os_dso_linkage ccenv_set_os_dso_patterns + ccenv_set_os_pe_switches ccenv_output_defs ccenv_clean_up diff --git a/sofort/ccenv/ccenv.vars b/sofort/ccenv/ccenv.vars index 1d68357..4775b37 100644 --- a/sofort/ccenv/ccenv.vars +++ b/sofort/ccenv/ccenv.vars @@ -80,3 +80,7 @@ ccenv_windrc= # cflags ccenv_cflags_os= ccenv_cflags_pic= + +# pe +ccenv_pe_subsystem= +ccenv_pe_image_base= diff --git a/sofort/ccenv/pedefs.in b/sofort/ccenv/pedefs.in new file mode 100644 index 0000000..300d990 --- /dev/null +++ b/sofort/ccenv/pedefs.in @@ -0,0 +1,4 @@ +# @ccenv_cfgtype@ pe switches +PE_SUBSYSTEM = @ccenv_pe_subsystem@ +PE_IMAGE_BASE = @ccenv_pe_image_base@ + diff --git a/sofort/config/config.vars b/sofort/config/config.vars index 5cbc0e0..80d8535 100644 --- a/sofort/config/config.vars +++ b/sofort/config/config.vars @@ -92,7 +92,6 @@ user_cxx pe_subsystem pe_image_base -pe_config_defs native_cc native_cpp @@ -103,6 +102,9 @@ native_cfghost native_cflags native_ldflags +native_pe_subsystem +native_pe_image_base + all_shared all_static disable_frontend