[GRASS-SVN] r71041 - in grass/trunk: include/Make scripts

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 6 14:47:14 PDT 2017


Author: wenzeslaus
Date: 2017-05-06 14:47:14 -0700 (Sat, 06 May 2017)
New Revision: 71041

Added:
   grass/trunk/include/Make/ShScript.make
   grass/trunk/include/Make/ShScriptRules.make
   grass/trunk/scripts/windows_sh_launch.bat
Log:
support for shell scripts in build system (experimental) [news]

Copied: grass/trunk/include/Make/ShScript.make (from rev 70939, grass/trunk/include/Make/Script.make)
===================================================================
--- grass/trunk/include/Make/ShScript.make	                        (rev 0)
+++ grass/trunk/include/Make/ShScript.make	2017-05-06 21:47:14 UTC (rev 71041)
@@ -0,0 +1,45 @@
+
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
+ifdef MINGW
+SCRIPT = $(SCRIPTDIR)/$(PGM).sh
+else
+SCRIPT = $(SCRIPTDIR)/$(PGM)
+endif
+
+HTMLSRC = $(SCRIPT)
+
+ETCDIR = $(ETC)/$(PGM)
+ETCPYFILES := $(patsubst %,$(ETCDIR)/%.sh,$(ETCFILES))
+
+include $(MODULE_TOPDIR)/include/Make/Rules.make
+include $(MODULE_TOPDIR)/include/Make/Html.make
+include $(MODULE_TOPDIR)/include/Make/ShScriptRules.make
+
+SCRIPT_ACTIONS = $(SCRIPT) $(ETCPYFILES) html scriptstrings
+ifdef MINGW
+SCRIPT_ACTIONS += $(BIN)/$(PGM).bat
+SCRIPT_DIR = %GISBASE%/scripts
+endif
+
+script: $(SCRIPT_ACTIONS)
+
+$(BIN)/$(PGM).bat: $(MODULE_TOPDIR)/scripts/windows_sh_launch.bat
+	sed -e "s#SCRIPT_NAME#$(PGM)#" -e "s#SCRIPT_DIR#$(SCRIPT_DIR)#" $(MODULE_TOPDIR)/scripts/windows_sh_launch.bat > $@
+	unix2dos $@
+
+scriptstrings: $(STRINGDIR)/$(PGM)_to_translate.c
+
+install:
+	$(INSTALL) $(SCRIPT) $(INST_DIR)/scripts/
+	$(INSTALL_DATA) $(HTMLDIR)/$(PGM).html $(INST_DIR)/docs/html/
+	$(eval IMG := $(wildcard $(HTMLDIR)/*.png) $(wildcard $(HTMLDIR)/*.jpg))
+	if [ -n "$(IMG)" ] ; then \
+		$(INSTALL_DATA) $(IMG)  $(INST_DIR)/docs/html/ ; \
+	fi
+	$(INSTALL_DATA) $(ARCH_DISTDIR)/docs/man/man1/$(PGM).1 $(INST_DIR)/docs/man/man1/
+	if [ -d "$(ETC)/$(PGM)" ] ; then \
+		cp -RL $(ETC)/$(PGM) $(INST_DIR)/etc/ ; \
+	fi
+
+.PHONY: script scriptstrings

Copied: grass/trunk/include/Make/ShScriptRules.make (from rev 70939, grass/trunk/include/Make/ScriptRules.make)
===================================================================
--- grass/trunk/include/Make/ShScriptRules.make	                        (rev 0)
+++ grass/trunk/include/Make/ShScriptRules.make	2017-05-06 21:47:14 UTC (rev 71041)
@@ -0,0 +1,31 @@
+
+# common dependencies and rules for building scripts
+
+STRINGDIR = $(GRASS_HOME)/locale/scriptstrings
+
+$(SCRIPTDIR)/%: %.sh | $(SCRIPTDIR)
+	$(INSTALL) $< $@
+
+$(SCRIPTDIR)/%.sh: %.sh | $(SCRIPTDIR)
+	$(INSTALL) $< $@
+
+$(SCRIPTDIR):
+	$(MKDIR) $(SCRIPTDIR)
+
+$(ETCDIR)/%: % | $(ETCDIR)
+	$(INSTALL_DATA) $< $@
+
+$(ETCDIR):
+	$(MKDIR) $(ETCDIR)
+
+# Make strings in a fake .c file so that they get picked up by the internationalizer stuff.
+# These are only the options (parser.c) type things.
+# See locale/scriptstrings/README for more information
+
+strings = $(call run_grass,g.parser -t $(1) | sed s/\"/\\\\\"/g | sed 's/.*/_("&")/' > $(2))
+
+$(STRINGDIR)/%_to_translate.c: %.sh
+	-$(call strings,$<,$@)
+
+$(STRINGDIR)/%_to_translate.c: %
+	-$(call strings,$<,$@)

Copied: grass/trunk/scripts/windows_sh_launch.bat (from rev 70939, grass/trunk/scripts/windows_launch.bat)
===================================================================
--- grass/trunk/scripts/windows_sh_launch.bat	                        (rev 0)
+++ grass/trunk/scripts/windows_sh_launch.bat	2017-05-06 21:47:14 UTC (rev 71041)
@@ -0,0 +1,11 @@
+REM Unfortunately not translatable messages here
+
+IF "%GRASS_SHELL%"=="" (
+    ECHO The GRASS_SHELL environmental variable is not defined.
+    ECHO To use Bash/Shell scripts in GRASS GIS,
+    ECHO set the variable using something like:
+    ECHO SET GRASS_SHELL="C:\path\to\bash.exe"
+    EXIT /b
+)
+
+@"%GRASS_SHELL%" "SCRIPT_DIR/SCRIPT_NAME.sh" %*



More information about the grass-commit mailing list