[PATCH 2/5] menu: Write data directory during build instead of with wmaker.inst.

Doug Torrance <[email protected]> Thu, 17 Aug 2017 21:02:25 -0400
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
Many of the menu files contain the macro #wmdatadir# as a placeholder for
the data directory containing Window Maker themes, styles, background
pixmaps, etc.  This macro is replaced by the the actual path to the data
directory (by default /usr/local/share/WindowMaker) by the wmaker.inst
script, but only when copying WMRootMenu to the user's home directory.

Instead, we replace the macro during the build.  This way, *every* menu
file has the correct path.

Note that several of the files in question were not previously generated
during build.  These have been renamed with a .in extension.
---
 WindowMaker/Makefile.am                       | 16 ++++++++--------
 WindowMaker/{plmenu.pl => plmenu.pl.in}       |  0
 WindowMaker/{plmenu.zh_CN => plmenu.zh_CN.in} |  0
 WindowMaker/{wmmacros => wmmacros.in}         |  0
 util/wmaker.inst.in                           |  6 +-----
 5 files changed, 9 insertions(+), 13 deletions(-)
 rename WindowMaker/{plmenu.pl => plmenu.pl.in} (100%)
 rename WindowMaker/{plmenu.zh_CN => plmenu.zh_CN.in} (100%)
 rename WindowMaker/{wmmacros => wmmacros.in} (100%)

diff --git a/WindowMaker/Makefile.am b/WindowMaker/Makefile.am
index e648d542..51fab0c8 100644
--- a/WindowMaker/Makefile.am
+++ b/WindowMaker/Makefile.am
@@ -4,7 +4,7 @@ prefsdatadir = $(pkgdatadir)
 
 wpexecbindir = @wprefs_bindir@
 
-# menus which need generated to have correct path to WPrefs
+# menus which need generated to have correct path to WPrefs or data directory
 GENERATED_MENUS =\
 	menu\
 	menu.bg\
@@ -24,11 +24,14 @@ GENERATED_MENUS =\
 	plmenu.ja\
 	plmenu.ko\
 	plmenu.nl\
+	plmenu.pl\
 	plmenu.ro\
 	plmenu.sk\
-	plmenu.zh_TW
+	plmenu.zh_CN\
+	plmenu.zh_TW\
+	wmmacros
 
-# menus which do not mention WPrefs
+# menus which do not mention WPrefs or data directory
 NONGENERATED_MENUS =\
 	menu.ca\
 	menu.cz\
@@ -54,9 +57,7 @@ NONGENERATED_MENUS =\
 	plmenu.de\
 	plmenu.fr\
 	plmenu.hr\
-	plmenu.it\
-	plmenu.pl\
-	plmenu.zh_CN
+	plmenu.it
 
 dist_prefsdata_DATA =\
 	appearance.menu\
@@ -65,7 +66,6 @@ dist_prefsdata_DATA =\
 	exitscript.sh\
 	README\
 	README.themes\
-	wmmacros\
 	$(NONGENERATED_MENUS)
 
 nodist_prefsdata_DATA = $(GENERATED_MENUS)
@@ -76,4 +76,4 @@ CLEANFILES = $(GENERATED_MENUS)
 
 $(GENERATED_MENUS):
 	$(AM_V_GEN)sed -e "s:#wprefs#:$(wpexecbindir)/WPrefs:" \
-		$(srcdir)/[email protected] > $@
+		-e "s:#wmdatadir#:$(pkgdatadir):" $(srcdir)/[email protected] > $@
diff --git a/WindowMaker/plmenu.pl b/WindowMaker/plmenu.pl.in
similarity index 100%
rename from WindowMaker/plmenu.pl
rename to WindowMaker/plmenu.pl.in
diff --git a/WindowMaker/plmenu.zh_CN b/WindowMaker/plmenu.zh_CN.in
similarity index 100%
rename from WindowMaker/plmenu.zh_CN
rename to WindowMaker/plmenu.zh_CN.in
diff --git a/WindowMaker/wmmacros b/WindowMaker/wmmacros.in
similarity index 100%
rename from WindowMaker/wmmacros
rename to WindowMaker/wmmacros.in
diff --git a/util/wmaker.inst.in b/util/wmaker.inst.in
index 4aeac652..2e3f3ef7 100644
--- a/util/wmaker.inst.in
+++ b/util/wmaker.inst.in
@@ -62,12 +62,8 @@ copy() {
 	if [ "$file" = "WindowMaker" ]; then
 		sed -e "s|~/GNUstep|$GSDIR|g" "$source" > "$target"
 	else
-		if test "x$GNUSTEP_USER_ROOT" = "x"; then
-			sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
-					"$source" > "$target"
-		else
+		if test "x$GNUSTEP_USER_ROOT" != "x"; then
 			sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
-				-e "s:#wmdatadir#:$GLOBALDIR:g" \
 					"$source" > "$target"
 		fi
 	fi
-- 
2.11.0


-- 
To unsubscribe, send mail to [email protected].