]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- add __configure_sh macro to be able to run ./configure with bash for example
[packages/rpm-build-macros.git] / rpm.macros
index 6ec50314eefc4bf5a2eb5b6c1d0120df09f17125..795b31dff8740b2b248edf33986b2b5b10bd8276 100644 (file)
         };
 }')
 
+#-----------------------------------------------------------------
+#
+#  Generate a command which cleans environment, leaving only the
+# most important variables.
+#  If any spec requires any additional environment it should
+# redefine %_preserve_env in following manner:
+#
+#      # ADDITIONAL_VAR is required because [a good reason here]
+#      %{expand:%%define _preserve_env %_preserve_env ADDITIONAL_VAR}
+
+%_preserve_env PATH HOME TMP TMPDIR
+
+%_clean_env            env -i %(awk -vq="'" -vqq="\\"'\\"" -vq2q="'\\"'" 'BEGIN {
+       split("%{?_preserve_env:%_preserve_env}", P);
+       for (i in P) {
+               p = P[i];
+               if (ENVIRON[p]) {
+                       split( ENVIRON[p], V, "" );
+                       val = p "=";
+                       for ( j = 1; j in V; j++ ) {
+                               v = V[j];
+                               if ( v == q )
+                                       v = qq;
+                               else if ( v == "\\"" )
+                                       v = q2q;
+                               else if ( v == "\\\\" )
+                                       v = "\\\\\\\\";
+                               else
+                                       gsub( "[^a-zA-Z0-9/:._-]", "\\"&\\"", v );
+                               val = val "" v;
+                       }
+                       printf( val " " );
+               }
+       }
+}')
+
 #-----------------------------------------------------------------
 %configure2_13 { \
  if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
@@ -192,7 +228,8 @@ CXXFLAGS="%{rpmcxxflags}" \
 #%configure_cache 0
 %configure_cache_file  %{buildroot}.configure.cache
 
-%configure {./configure \
+%__configure_sh sh
+%configure {%__configure_sh ./configure \
        LDFLAGS="${LDFLAGS:-%rpmldflags}" \
        CFLAGS="${CFLAGS:-%rpmcflags}" \
        CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
@@ -499,7 +536,7 @@ fi; }; __spec_install_post_chrpath } } }
         LC_ALL=C objdump -T $f 2> /dev/null | LC_ALL=C awk -v "file=$f" 'BEGIN { found=0; skip["program_name"]=1; symbols = "" } /^[0-9a-z]+ +D +\*UND\*/ { if ($NF in skip) { next; }; found = 1; symbols = symbols "\n\t" $NF } END { if (found) { print "\nUnresolved symbols found in: " file symbols; exit(1); } } ' || fail=1 ; \
     done ; \
     echo " DONE"; \
-    %{!?no_install_post_check_so:[ $fail -eq 1 ] && exit 0 || exit 0;} \
+    %{!?no_install_post_check_so:[ $fail -eq 1 ] && : || :;} \
 }; __spec_install_post_check_so }}
 
 #-----------------------------------------------------------------
This page took 0.056927 seconds and 4 git commands to generate.