Browse code

* improvements for mingw, also improved speed a bit

Nat! authored on 06/09/2017 21:15:39
Showing 8 changed files
... ...
@@ -31,7 +31,7 @@
31 31
 #
32 32
 MULLE_EXECUTABLE_VERSION_MAJOR=3
33 33
 MULLE_EXECUTABLE_VERSION_MINOR=11
34
-MULLE_EXECUTABLE_VERSION_PATCH=1
34
+MULLE_EXECUTABLE_VERSION_PATCH=2
35 35
 
36 36
 MULLE_EXECUTABLE_VERSION="${MULLE_EXECUTABLE_VERSION_MAJOR}.${MULLE_EXECUTABLE_VERSION_MINOR}.${MULLE_EXECUTABLE_VERSION_PATCH}"
37 37
 
... ...
@@ -681,6 +681,7 @@ bootstrap_main()
681 681
          mulle_bootstrap_usage
682 682
       ;;
683 683
    esac
684
+   log_debug ":bootstrap_main done:"
684 685
 }
685 686
 
686 687
 
... ...
@@ -2,4 +2,4 @@
2 2
 
3 3
 REM "C:\Program Files\Git\usr\bin\sh.exe" and "/usr/local/bin" are replaced by install.sh 
4 4
 
5
-"C:\Program Files\Git\usr\bin\sh.exe" "mulle-mingw-dumpdef.sh" %*
5
+"C:\Program Files\Git\usr\bin\sh.exe" "%~dp0\mulle-mingw-dumpdef.sh" %*
... ...
@@ -2522,6 +2522,7 @@ build_main()
2522 2522
 
2523 2523
    OPTION_CHECK_USR_LOCAL_INCLUDE="`read_config_setting "check_usr_local_include" "NO"`"
2524 2524
    OPTION_USE_CC_CXX="`read_config_setting "use_cc_cxx" "YES"`"
2525
+   OPTION_CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build" "NO"`
2525 2526
 
2526 2527
    #
2527 2528
    # it is useful, that fetch understands build options and
... ...
@@ -2568,7 +2569,7 @@ build_main()
2568 2568
          ;;
2569 2569
 
2570 2570
          -k|--no-clean)
2571
-            OPTION_CLEAN_BEFORE_BUILD=
2571
+            OPTION_CLEAN_BEFORE_BUILD="NO"
2572 2572
          ;;
2573 2573
 
2574 2574
          -K|--clean)
... ...
@@ -86,28 +86,27 @@ simplified_dispense_style()
86 86
 _simplified_dispense_style_subdirectory()
87 87
 {
88 88
    local dispense_style="$1"
89
+   local configurations="$2"
90
+   local sdks="$3"
89 91
 
90 92
    local configuration
91 93
    local sdk
92 94
 
93
-   [ -z "${OPTION_CONFIGURATIONS}" ] && internal_fail "OPTION_CONFIGURATIONS is empty"
94
-   [ -z "${OPTION_SDKS}" ]           && internal_fail "OPTION_SDKS is empty"
95
+   [ -z "${configurations}" ] && internal_fail "configurations is empty"
96
+   [ -z "${sdks}" ]           && internal_fail "sdks is empty"
95 97
 
96 98
    case "${dispense_style}" in
97 99
       none)
98
-         PATH="`prepend_to_search_path_if_missing "$PATH" \
99
-                                                  "${DEPENDENCIES_DIR}/bin" \
100
-                                                  "${ADDICTIONS_DIR}/bin"`"
101 100
       ;;
102 101
 
103 102
       configuration-strict)
104
-         configuration="$(head -1 <<< "${OPTION_CONFIGURATIONS}")"
103
+         configuration="$(head -1 <<< "${configurations}")"
105 104
          echo "/${configuration}"
106 105
       ;;
107 106
 
108 107
       configuration-sdk-strict)
109
-         configuration="$(head -1 <<< "${OPTION_CONFIGURATIONS}")"
110
-         sdk="$(head -1 <<< "${OPTION_SDKS}")"
108
+         configuration="$(head -1 <<< "${configurations}")"
109
+         sdk="$(head -1 <<< "${sdks}")"
111 110
          echo "/${configuration}-${sdk}"
112 111
       ;;
113 112
 
... ...
@@ -118,15 +117,9 @@ _simplified_dispense_style_subdirectory()
118 118
 }
119 119
 
120 120
 
121
-#
122
-# only needed for true builds
123
-#
124
-build_complete_environment()
121
+build_environment_options()
125 122
 {
126
-   log_debug ":build_complete_environment:"
127
-
128
-   [ -z "${__BUILD_COMPLETE_ENVIRONMENT}" ] || internal_fail "build_complete_environment run twice"
129
-   __BUILD_COMPLETE_ENVIRONMENT="YES"
123
+   log_debug ":build_environment_options:"
130 124
 
131 125
    [ -z "${MULLE_BOOTSTRAP_SETTINGS_SH}" ] && . mulle-bootstrap-settings.sh
132 126
 
... ...
@@ -142,8 +135,31 @@ build_complete_environment()
142 142
       OPTION_CONFIGURATIONS="`read_root_setting "configurations" "${OPTION_CONFIGURATIONS}"`"
143 143
    fi
144 144
 
145
-   OPTION_CLEAN_BEFORE_BUILD=`read_config_setting "clean_before_build"`
145
+   #
146
+   # Determine dispense_style
147
+   #
148
+   if [ -z "${OPTION_DISPENSE_STYLE}" ]
149
+   then
150
+      OPTION_DISPENSE_STYLE="`read_config_setting "dispense_style" "none"`"
151
+   fi
152
+}
153
+
146 154
 
155
+#
156
+# only needed for true builds
157
+#
158
+build_complete_environment()
159
+{
160
+   log_debug ":build_complete_environment:"
161
+
162
+   [ -z "${__BUILD_COMPLETE_ENVIRONMENT}" ] || internal_fail "build_complete_environment run twice"
163
+   __BUILD_COMPLETE_ENVIRONMENT="YES"
164
+
165
+   build_environment_options
166
+
167
+   ##
168
+   ## try to minimize this
169
+   ##
147 170
    # experimentally, these could reside outside the project folder but never tested
148 171
    CLONESBUILD_DIR="`read_sane_config_path_setting "build_dir" "build/.repos"`"
149 172
    BUILDLOGS_DIR="`read_sane_config_path_setting "build_log_dir" "${CLONESBUILD_DIR}/.logs"`"
... ...
@@ -151,13 +167,6 @@ build_complete_environment()
151 151
    [ -z "${CLONESBUILD_DIR}" ]  && internal_fail "variable CLONESBUILD_DIR is empty"
152 152
    [ -z "${BUILDLOGS_DIR}" ]    && internal_fail "variable BUILDLOGS_DIR is empty"
153 153
 
154
-   #
155
-   # Determine dispense_style
156
-   #
157
-   if [ -z "${OPTION_DISPENSE_STYLE}" ]
158
-   then
159
-      OPTION_DISPENSE_STYLE="`read_config_setting "dispense_style" "none"`"
160
-   fi
161 154
 
162 155
    #
163 156
    # expand PATH for build, but it's kinda slow
... ...
@@ -908,22 +908,33 @@ ${i}"
908 908
 
909 909
 simplified_path()
910 910
 {
911
-   if [ "${MULLE_TRACE_PATHS_FLIP_X}" = "YES" ]
912
-   then
913
-      set +x
914
-   fi
911
+   #
912
+   # quick check if there is something to simplify 
913
+   # because this isn't fast at all
914
+   #
915
+   case "${1}" in
916
+      ""|".")
917
+         echo "."
918
+      ;;
915 919
 
916
-   if [ ! -z "$1" ]
917
-   then
918
-      _simplified_path "$@"
919
-   else
920
-      echo "."
921
-   fi
920
+      */|*\.\.*|*\./*)
921
+         if [ "${MULLE_TRACE_PATHS_FLIP_X}" = "YES" ]
922
+         then
923
+            set +x
924
+         fi
925
+   
926
+         _simplified_path "$@"
922 927
 
923
-   if [ "${MULLE_TRACE_PATHS_FLIP_X}" = "YES" ]
924
-   then
925
-      set -x
926
-   fi
928
+         if [ "${MULLE_TRACE_PATHS_FLIP_X}" = "YES" ]
929
+         then
930
+            set -x
931
+         fi
932
+      ;;
933
+      
934
+      *)
935
+         echo "$1"
936
+      ;;
937
+   esac
927 938
 }
928 939
 
929 940
 
... ...
@@ -125,13 +125,29 @@ log_debug()
125 125
 
126 126
 log_trace()
127 127
 {
128
-   log_printf "${C_TRACE}%b${C_RESET}\n" "$*"
128
+   case "${UNAME}" in
129
+      linux)
130
+         log_printf "${C_TRACE}$(date "+%s.%N") %b${C_RESET}\n" "$*"
131
+         ;;
132
+
133
+      *)
134
+         log_printf "${C_TRACE}$(date "+%s") %b${C_RESET}\n" "$*"
135
+      ;;
136
+   esac
129 137
 }
130 138
 
131 139
 
132 140
 log_trace2()
133 141
 {
134
-   log_printf "${C_TRACE2}%b${C_RESET}\n" "$*"
142
+   case "${UNAME}" in
143
+      linux)
144
+         log_printf "${C_TRACE2}$(date "+%s.%N") %b${C_RESET}\n" "$*"
145
+         ;;
146
+         
147
+      *)
148
+         log_printf "${C_TRACE2}$(date "+%s") %b${C_RESET}\n" "$*"
149
+      ;;
150
+   esac
135 151
 }
136 152
 
137 153
 
... ...
@@ -173,17 +173,19 @@ _flags_emit_path_value()
173 173
 
174 174
 _dependencies_subdir()
175 175
 {
176
-   local simplified
176
+   local dispense_style="$1"
177
+   local configurations="$2"
178
+   local sdks="$3"
177 179
 
178
-   simplified="`simplified_dispense_style "${OPTION_DISPENSE_STYLE}" \
179
-                                          "${OPTION_CONFIGURATION}" \
180
-                                          "${OPTION_SDK}"`"
180
+   simplified="`simplified_dispense_style "${dispense_style}" \
181
+                                          "${configurations}" \
182
+                                          "${sdks}"`"
181 183
    #
182 184
    # expand PATH for build, but it's kinda slow
183 185
    # so don't do it all the time
184 186
    #
185 187
 
186
-   _simplified_dispense_style_subdirectory "${simplified}"
188
+   _simplified_dispense_style_subdirectory "${simplified}" "${configurations}" "${sdks}"
187 189
 }
188 190
 
189 191
 
... ...
@@ -808,15 +810,18 @@ paths_main()
808 808
 
809 809
    #
810 810
    # if there is no "root", then pick the first configuration/sdk
811
-   # for the dependencies paths
811
+   # for the dependencies paths (FUTURE)
812 812
    #
813 813
    local old
814 814
    local subdir
815 815
 
816
-   build_complete_environment   # need this now
816
+# if we really need this, uncomment and explain what is needed
817
+# this slows mingw down a lot
818
+   build_environment_options   # need this now for _dependencies_subdir
817 819
 
818 820
    old="${DEPENDENCIES_DIR}"
819
-   subdir="`_dependencies_subdir`"
821
+   subdir="`_dependencies_subdir "${OPTION_DISPENSE_STYLE}" "${OPTION_CONFIGURATIONS}" "${OPTION_SDKS}"`"
822
+
820 823
    DEPENDENCIES_DIR="${DEPENDENCIES_DIR}${subdir}"
821 824
 
822 825
    local memo
... ...
@@ -831,11 +836,23 @@ paths_main()
831 831
       case "${type}" in
832 832
          "addictions")
833 833
             values="`_flags_emit_path_value "${ADDICTIONS_DIR}"`"
834
+            # short circuit for mingw
835
+            if [ $# -eq 0 -a -z "${result}" ]
836
+            then
837
+               echo "${values}"
838
+               return 0
839
+            fi
834 840
             result="`add_line "${result}" "${values}"`"
835 841
          ;;
836 842
 
837 843
          "dependencies")
838 844
             values="`_flags_emit_path_value "${DEPENDENCIES_DIR}"`"
845
+            # short circuit for mingw
846
+            if [ $# -eq 0 -a -z "${result}" ]
847
+            then
848
+               echo "${values}"
849
+               return 0
850
+            fi
839 851
             result="`add_line "${result}" "${values}"`"
840 852
          ;;
841 853
 
... ...
@@ -854,6 +871,12 @@ paths_main()
854 854
 
855 855
          "path")
856 856
             result="`_flags_do_path "${result}"`"
857
+            # short circuit for mingw
858
+            if [ $# -eq 0 -a -z "${result}" ]
859
+            then
860
+               echo "${values}"
861
+               return 0
862
+            fi
857 863
          ;;
858 864
 
859 865
          "make")
... ...
@@ -99,6 +99,11 @@ warn_user_setting()
99 99
 
100 100
    path="$1"
101 101
 
102
+   if [ -z "${MULLE_BOOTSTRAP_WARN_USER_SETTINGS}" ] 
103
+   then
104
+      MULLE_BOOTSTRAP_WARN_USER_SETTINGS="`read_config_setting "warn_user_setting" "YES"`"
105
+   fi
106
+
102 107
    if [ "$MULLE_BOOTSTRAP_WARN_USER_SETTINGS" = "YES" ]
103 108
    then
104 109
       log_warning "Using `dirname -- "${path}"` for `basename -- "${path}"`"
... ...
@@ -194,6 +199,12 @@ warn_environment_setting()
194 194
    local key
195 195
 
196 196
    key="$1"
197
+
198
+   if [ -z "$MULLE_BOOTSTRAP_WARN_ENVIRONMENT_SETTINGS" ]
199
+   then
200
+      MULLE_BOOTSTRAP_WARN_ENVIRONMENT_SETTINGS="`read_config_setting "warn_environment_setting" "YES"`"
201
+   fi
202
+
197 203
    if [ "$MULLE_BOOTSTRAP_WARN_ENVIRONMENT_SETTINGS" = "YES" ]
198 204
    then
199 205
       # don't trace some boring ones
... ...
@@ -274,7 +285,7 @@ _read_setting()
274 274
       then
275 275
          local key
276 276
 
277
-         key="`basename -- "${apath}"`"
277
+         key="${apath##*/}" # same as" `basename -- "${apath}"`"
278 278
          log_setting "${C_MAGENTA}${key}${C_SETTING} found as \"${apath}\""
279 279
       fi
280 280
 
... ...
@@ -399,7 +410,7 @@ _read_environment_setting()
399 399
 
400 400
    [ -z "${key}" ] && internal_fail "empty key in _read_environment_setting"
401 401
 
402
-   envname="MULLE_BOOTSTRAP_`echo "${key}" | tr '[:lower:]' '[:upper:]'`"
402
+   envname="MULLE_BOOTSTRAP_`tr '[:lower:]' '[:upper:]' <<< "${key}"`"
403 403
 
404 404
    if [ "$MULLE_FLAG_LOG_SETTINGS" = "YES" ]
405 405
    then
... ...
@@ -1595,8 +1606,6 @@ settings_initialize()
1595 1595
    [ -z "${MULLE_BOOTSTRAP_FUNCTIONS_SH}" ] && . mulle-bootstrap-functions.sh
1596 1596
 
1597 1597
    # MULLE_BOOTSTRAP_NO_WARN_LOCAL_SETTINGS="`read_config_setting "no_warn_local_setting"`"
1598
-   MULLE_BOOTSTRAP_WARN_USER_SETTINGS="`read_config_setting "warn_user_setting" "YES"`"
1599
-   MULLE_BOOTSTRAP_WARN_ENVIRONMENT_SETTINGS="`read_config_setting "warn_environment_setting" "YES"`"
1600 1598
 }
1601 1599
 
1602 1600
 settings_initialize