lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 517f15c 2/2: Use an interpreter for cross-com


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 517f15c 2/2: Use an interpreter for cross-compiled binaries
Date: Tue, 23 Aug 2016 21:43:20 +0000 (UTC)

branch: master
commit 517f15c0acf28ca499fc938b5bc768665cb849c8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use an interpreter for cross-compiled binaries
    
    Prepend new 'make' variable 'PERFORM' to any recipe command that
    runs a cross-compiled binary. For example, set:
      PERFORM := wine
    to use 'wine' as an interpreter for cross-compiled msw binaries.
    
    'binfmt_misc' might have been used instead, without changing the
    makefiles. However:
     - It doesn't work in my lightweight chroot, which has nothing
       whatsoever in /proc .
     - Explicitly invoking 'wine' is more secure. See, e.g.:
         https://bugs.launchpad.net/ubuntu/+source/wine/+bug/85338
---
 GNUmakefile               |    4 ++--
 objects.make              |    2 +-
 posix_fhs.make            |    2 ++
 test_coding_rules_test.sh |   10 +++++++++-
 workhorse.make            |   24 ++++++++++++------------
 5 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 1b5e881..0bd85fc 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -339,7 +339,7 @@ check_concinnity: source_clean custom_tools
        @$(ECHO) "  Problems detected by xmllint:"
        @for z in $(xml_files); \
          do \
-           $(XMLLINT) --encode ASCII $$z \
+           $(PERFORM) $(XMLLINT) --encode ASCII $$z \
            | $(TR) --delete '\r' \
            | $(DIFF) \
              --ignore-blank-lines \
@@ -349,7 +349,7 @@ check_concinnity: source_clean custom_tools
              || $(ECHO) "... in file $$z"; \
          done;
        @$(ECHO) "  Miscellaneous problems:"
-       @-$(TEST_CODING_RULES) *
+       @-$(PERFORM) $(TEST_CODING_RULES) *
 
 
################################################################################
 
diff --git a/objects.make b/objects.make
index 54f785b..7e17a46 100644
--- a/objects.make
+++ b/objects.make
@@ -990,7 +990,7 @@ rate_table_tool$(EXEEXT): \
   rate_table.o \
   rate_table_tool.o \
 
-test_coding_rules_test := $(src_dir)/test_coding_rules_test.sh
+test_coding_rules_test := PERFORM=$(PERFORM) 
$(src_dir)/test_coding_rules_test.sh
 test_coding_rules$(EXEEXT): POST_LINK_COMMAND = $(test_coding_rules_test)
 test_coding_rules$(EXEEXT): \
   $(boost_filesystem_objects) \
diff --git a/posix_fhs.make b/posix_fhs.make
index 45f9eb6..16bba16 100644
--- a/posix_fhs.make
+++ b/posix_fhs.make
@@ -26,6 +26,8 @@ system_root := /
 EXEEXT :=
 SHREXT := .so
 
+PERFORM := wine
+
 platform_boost_libraries := \
   -lboost_filesystem-gcc \
 
diff --git a/test_coding_rules_test.sh b/test_coding_rules_test.sh
index 5f5cc9a..0c76d9e 100755
--- a/test_coding_rules_test.sh
+++ b/test_coding_rules_test.sh
@@ -21,6 +21,14 @@
 # email: <address@hidden>
 # snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 
+# This script is intended to be invoked by lmi makefiles. If it is
+# run independently, the environment variable PERFORM should be set
+# to indicate any cross interpreter--e.g., use this command:
+#   PERFORM=wine /path/to/test_coding_rules_test.sh
+# to make this script run a cross-compiled 'test_coding_rules.exe'
+# built for msw in a GNU/Linux environment. It can be run natively
+# with $PERFORM unset.
+
 echo "Testing 'test_coding_rules'."
 
 rm --force eraseme*
@@ -346,7 +354,7 @@ touch another.unexpected.file
 
 # Compare observed to expected. Note that directory '.' is ignored.
 
-2>&1 ./test_coding_rules \
+2>&1 $PERFORM ./test_coding_rules \
   . \
   a_nonexistent_file \
   an_expungible_file.bak \
diff --git a/workhorse.make b/workhorse.make
index 860ce41..9b885f4 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -922,7 +922,7 @@ install: $(default_targets)
        @[ -z "$(compiler_runtime_files)" ] \
          || $(CP) --preserve --update $(compiler_runtime_files) 
/opt/lmi/local/bin
 ifeq (,$(USE_SO_ATTRIBUTES))
-       @cd $(data_dir); $(bin_dir)/product_files$(EXEEXT)
+       @cd $(data_dir); $(PERFORM) $(bin_dir)/product_files$(EXEEXT)
 else
        @$(ECHO) "Can't build product_files$(EXEEXT) with USE_SO_ATTRIBUTES."
 endif
@@ -1136,7 +1136,7 @@ run_unit_tests: unit_tests_not_built $(addsuffix 
-run,$(unit_test_targets))
 .PHONY: %$(EXEEXT)-run
 %$(EXEEXT)-run:
        @$(ECHO) -e "\nRunning $*:"
-       @-./$* --accept
+       @-$(PERFORM) ./$* --accept
 
 
################################################################################
 
@@ -1166,10 +1166,10 @@ self_test_options := --accept --data_path=$(data_dir) 
--selftest
 
 .PHONY: cli_selftest
 cli_selftest:
-       @./antediluvian_cli$(EXEEXT) $(self_test_options) > /dev/null
-       @./antediluvian_cli$(EXEEXT) $(self_test_options)
-       @./lmi_cli_shared$(EXEEXT) $(self_test_options) > /dev/null
-       @./lmi_cli_shared$(EXEEXT) $(self_test_options)
+       @$(PERFORM) ./antediluvian_cli$(EXEEXT) $(self_test_options) > /dev/null
+       @$(PERFORM) ./antediluvian_cli$(EXEEXT) $(self_test_options)
+       @$(PERFORM) ./lmi_cli_shared$(EXEEXT) $(self_test_options) > /dev/null
+       @$(PERFORM) ./lmi_cli_shared$(EXEEXT) $(self_test_options)
 
 cli_test-sample.ill: special_emission :=
 cli_test-sample.cns: special_emission := emit_composite_only
@@ -1177,13 +1177,13 @@ cli_test-sample.cns: special_emission := 
emit_composite_only
 .PHONY: cli_test-%
 cli_test-%:
        @$(ECHO) Test $*:
-       @./lmi_cli_shared$(EXEEXT) \
+       @$(PERFORM) ./lmi_cli_shared$(EXEEXT) \
          --accept \
          --data_path=$(data_dir) \
          --emit=$(special_emission),emit_text_stream,emit_quietly,emit_timings 
\
          --file=$* \
          | $(SED) -e '/milliseconds/!d'
-       @./lmi_cli_shared$(EXEEXT) \
+       @$(PERFORM) ./lmi_cli_shared$(EXEEXT) \
          --accept \
          --data_path=$(data_dir) \
          --emit=$(special_emission),emit_text_stream,emit_quietly \
@@ -1206,8 +1206,8 @@ cli_test-%:
 .PHONY: cgi_tests
 cgi_tests: $(test_data) configurable_settings.xml antediluvian_cgi$(EXEEXT)
        @$(ECHO) Test common gateway interface:
-       @./antediluvian_cgi$(EXEEXT) --write_content_string > /dev/null
-       @./antediluvian_cgi$(EXEEXT) --enable_test <cgi.test.in >cgi.touchstone
+       @$(PERFORM) ./antediluvian_cgi$(EXEEXT) --write_content_string > 
/dev/null
+       @$(PERFORM) ./antediluvian_cgi$(EXEEXT) --enable_test <cgi.test.in 
>cgi.touchstone
        @<cgi.touchstone \
          $(DIFF) \
              --ignore-all-space \
@@ -1288,7 +1288,7 @@ testdecks := $(wildcard $(addprefix $(test_dir)/*., 
$(testdeck_suffixes)))
 
 .PHONY: $(testdecks)
 $(testdecks):
-       @-$(bin_dir)/lmi_cli_shared$(EXEEXT) \
+       @-$(PERFORM) $(bin_dir)/lmi_cli_shared$(EXEEXT) \
          --accept \
          --ash_nazg \
          --data_path=$(data_dir) \
@@ -1298,7 +1298,7 @@ $(testdecks):
        @$(MD5SUM) --binary $(basename $(notdir $@)).* >> $(system_test_md5sums)
        @for z in $(dot_test_files); \
          do \
-           $(bin_dir)/ihs_crc_comp$(EXEEXT) $$z $(touchstone_dir)/$$z \
+           $(PERFORM) $(bin_dir)/ihs_crc_comp$(EXEEXT) $$z 
$(touchstone_dir)/$$z \
            | $(SED) -e '/Summary.*max rel err/!d' -e "s/^ /$$z/" \
            >> $(system_test_analysis); \
          done



reply via email to

[Prev in Thread] Current Thread [Next in Thread]