foxygit / doom Log in
commit 184ea9ba501adf04b9b352760774fde268c0cc7f
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat May 14 20:11:26 2011 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat May 14 20:11:26 2011 +0000

    Convert build system to using the PROGRAM_PREFIX system used on
    raven-branch.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 2336
---
 codeblocks/config.h                                 |  3 +++
 configure.in                                        | 11 +++++++++++
 msvc/config.h                                       |  3 +++
 pkg/config.make.in                                  |  1 +
 pkg/osx/GNUmakefile                                 |  9 ++++-----
 pkg/osx/LauncherManager.m                           |  6 +++---
 pkg/win32/GNUmakefile                               |  6 +++---
 setup/Makefile.am                                   | 11 +++++------
 setup/configfile.c                                  |  6 +++---
 setup/{setup-manifest.xml => setup-manifest.xml.in} |  2 +-
 src/Makefile.am                                     | 12 ++++++------
 src/doom-screensaver.desktop.in                     |  4 ++--
 src/m_config.c                                      |  6 +++---
 13 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/codeblocks/config.h b/codeblocks/config.h
index 9026d398..75da3ba1 100644
--- a/codeblocks/config.h
+++ b/codeblocks/config.h
@@ -17,6 +17,9 @@
 /* Define to the version of this package. */
 #define PACKAGE_VERSION "1.5.0"

+/* Change this when you create your awesome forked version */
+#define PROGRAM_PREFIX "chocolate-"
+
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1

diff --git a/configure.in b/configure.in
index c653f4e9..7007b96e 100644
--- a/configure.in
+++ b/configure.in
@@ -112,6 +112,16 @@ AM_INIT_AUTOMAKE([1.8.0])

 WINDOWS_RC_VERSION=`echo $PACKAGE_VERSION.0 | sed 's/\./, /g' `

+# This controls the prefix added to the start of program names.  For example,
+# if this is changed to "lemon-", the programs generated will be named
+# lemon-doom, lemon-heretic, etc.
+
+PROGRAM_PREFIX=chocolate-
+
+AC_SUBST(PROGRAM_PREFIX)
+AC_DEFINE_UNQUOTED(PROGRAM_PREFIX, "$PROGRAM_PREFIX",
+                   Change this when you create your awesome forked version)
+
 AM_CONFIG_HEADER(config.h:config.hin)

 AC_SUBST(WINDOWS_RC_VERSION)
@@ -145,6 +155,7 @@ pkg/osx/Info.plist
 pkg/osx/Info-gnustep.plist
 setup/Makefile
 setup/setup-res.rc
+setup/setup-manifest.xml
 src/Makefile
 src/doom-screensaver.desktop
 src/resource.rc
diff --git a/msvc/config.h b/msvc/config.h
index d91bd23b..f00d581e 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -19,6 +19,9 @@
 /* Define to the version of this package. */
 #define PACKAGE_VERSION "1.5.0"

+/* Change this when you create your awesome forked version */
+#define PROGRAM_PREFIX "chocolate-"
+
 /* Version number of package */
 #define VERSION "1.5.0"

diff --git a/pkg/config.make.in b/pkg/config.make.in
index 445e89a9..8f94f945 100644
--- a/pkg/config.make.in
+++ b/pkg/config.make.in
@@ -10,6 +10,7 @@ STRIP = @STRIP@

 # Package name and version number:

+PROGRAM_PREFIX = @PROGRAM_PREFIX@
 PACKAGE = @PACKAGE@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
diff --git a/pkg/osx/GNUmakefile b/pkg/osx/GNUmakefile
index 514a208d..d53a9981 100644
--- a/pkg/osx/GNUmakefile
+++ b/pkg/osx/GNUmakefile
@@ -78,10 +78,10 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
 	cp launcher "$(APP_BIN_DIR)"
 	$(STRIP) "$(APP_BIN_DIR)/launcher"

-	./cp-with-libs $(TOPLEVEL)/src/$(PACKAGE_TARNAME) "$(APP_BIN_DIR)"
-	$(STRIP) "$(APP_BIN_DIR)/$(PACKAGE_TARNAME)"
-	./cp-with-libs $(TOPLEVEL)/setup/chocolate-setup "$(APP_BIN_DIR)"
-	$(STRIP) "$(APP_BIN_DIR)/chocolate-setup"
+	./cp-with-libs $(TOPLEVEL)/src/$(PROGRAM_PREFIX)doom "$(APP_BIN_DIR)"
+	$(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)doom"
+	./cp-with-libs $(TOPLEVEL)/setup/$(PROGRAM_PREFIX)setup "$(APP_BIN_DIR)"
+	$(STRIP) "$(APP_BIN_DIR)/$(PROGRAM_PREFIX)setup"

 	$(TOPLEVEL)/man/simplecpp -DPRECOMPILED -D__MACOSX__  \
 	             < $(TOPLEVEL)/man/INSTALL.template       \
@@ -94,7 +94,6 @@ $(STAGING_DIR): launcher $(TOPLEVEL_DOCS)
 	cp $(TOPLEVEL)/man/*.6 "$(APP_BIN_DIR)/man/man6"
 	cp disk/dir.DS_Store $(STAGING_DIR)/.DS_Store
 	cp disk/background.png $(STAGING_DIR)/background.png
-#	setfile -a V $(STAGING_DIR)/background.png

 clean : launcher_clean
 	rm -f $(DMG)
diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m
index 937c0d98..69c59577 100644
--- a/pkg/osx/LauncherManager.m
+++ b/pkg/osx/LauncherManager.m
@@ -294,8 +294,8 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
         return;
     }

-    ExecuteProgram(PACKAGE_TARNAME, [iwad UTF8String],
-                                    [args UTF8String]);
+    ExecuteProgram(PROGRAM_PREFIX "doom", [iwad UTF8String],
+                                          [args UTF8String]);
     [NSApp terminate:sender];
 }

@@ -306,7 +306,7 @@ static NSString *AppendQuotedFilename(NSString *str, NSString *fileName)
     [self saveConfig];

     [self->iwadController setEnvironment];
-    ExecuteProgram("chocolate-setup", NULL, NULL);
+    ExecuteProgram(PROGRAM_PREFIX "setup", NULL, NULL);
 }

 // Invoked when the "Terminal" option is selected from the menu, to open
diff --git a/pkg/win32/GNUmakefile b/pkg/win32/GNUmakefile
index 7df4cc16..34f2c9bd 100644
--- a/pkg/win32/GNUmakefile
+++ b/pkg/win32/GNUmakefile
@@ -3,9 +3,9 @@ include ../config.make

 TOPLEVEL=../..

-EXE_FILES=$(TOPLEVEL)/src/$(PACKAGE_TARNAME).exe       \
-          $(TOPLEVEL)/src/chocolate-server.exe         \
-          $(TOPLEVEL)/setup/chocolate-setup.exe
+EXE_FILES=$(TOPLEVEL)/src/$(PROGRAM_PREFIX)doom.exe    \
+          $(TOPLEVEL)/src/$(PROGRAM_PREFIX)server.exe  \
+          $(TOPLEVEL)/setup/$(PROGRAM_PREFIX)setup.exe

 DLL_FILES=$(TOPLEVEL)/src/SDL.dll                      \
           $(TOPLEVEL)/src/SDL_mixer.dll                \
diff --git a/setup/Makefile.am b/setup/Makefile.am
index 91c7449a..96003ce0 100644
--- a/setup/Makefile.am
+++ b/setup/Makefile.am
@@ -3,7 +3,7 @@ gamesdir = $(prefix)/games

 AM_CFLAGS = -I../textscreen -I../src @SDLMIXER_CFLAGS@

-games_PROGRAMS = chocolate-setup
+games_PROGRAMS = @PROGRAM_PREFIX@setup

 SOURCE_FILES =                                  \
     compatibility.c   compatibility.h           \
@@ -22,16 +22,15 @@ SOURCE_FILES =                                  \
     txt_mouseinput.c  txt_mouseinput.h

 EXTRA_DIST=                                     \
-    setup_icon.c                                \
-    setup-manifest.xml
+    setup_icon.c

 if HAVE_WINDRES
-chocolate_setup_SOURCES=$(SOURCE_FILES) setup-res.rc
+@PROGRAM_PREFIX@setup_SOURCES=$(SOURCE_FILES) setup-res.rc
 else
-chocolate_setup_SOURCES=$(SOURCE_FILES)
+@PROGRAM_PREFIX@setup_SOURCES=$(SOURCE_FILES)
 endif

-chocolate_setup_LDADD =                              \
+@PROGRAM_PREFIX@setup_LDADD =                        \
                        ../wince/libc_wince.a         \
                        ../textscreen/libtextscreen.a \
                        @SDLMIXER_LIBS@               \
diff --git a/setup/configfile.c b/setup/configfile.c
index c7109739..6a6eb3f6 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -637,9 +637,9 @@ void M_LoadDefaults (void)
     else
     {
         extra_defaults.filename
-            = malloc(strlen(configdir) + strlen(PACKAGE_TARNAME) + 10);
-        sprintf(extra_defaults.filename, "%s%s.cfg",
-                configdir, PACKAGE_TARNAME);
+            = malloc(strlen(configdir) + strlen(PROGRAM_PREFIX) + 15);
+        sprintf(extra_defaults.filename, "%s%sdoom.cfg",
+                configdir, PROGRAM_PREFIX);
     }

     LoadDefaultCollection(&doom_defaults);
diff --git a/setup/setup-manifest.xml b/setup/setup-manifest.xml.in
similarity index 94%
rename from setup/setup-manifest.xml
rename to setup/setup-manifest.xml.in
index c2788306..ff879263 100644
--- a/setup/setup-manifest.xml
+++ b/setup/setup-manifest.xml.in
@@ -12,7 +12,7 @@
   <!-- The "name" field in this tag should be the same as the executable's
        name -->
   <assemblyIdentity version="0.0.0.0" processorArchitecture="X86"
-                    name="chocolate-setup.exe" type="win32"/>
+                    name="@PROGRAM_PREFIX@setup.exe" type="win32"/>
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
     <security>
       <requestedPrivileges>
diff --git a/src/Makefile.am b/src/Makefile.am
index 26fe7c7d..7a690cf1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@

 gamesdir = $(prefix)/games

-games_PROGRAMS = chocolate-doom chocolate-server
+games_PROGRAMS = @PROGRAM_PREFIX@doom @PROGRAM_PREFIX@server

 AM_CFLAGS = -I../opl -I../textscreen -I../pcsound @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@

@@ -21,8 +21,8 @@ net_server.c         net_server.h          \
 net_structrw.c       net_structrw.h        \
 z_native.c           z_zone.h

-chocolate_server_SOURCES=$(DEDSERV_FILES)
-chocolate_server_LDADD = ../wince/libc_wince.a @LDFLAGS@ @SDLNET_LIBS@
+@PROGRAM_PREFIX@server_SOURCES=$(DEDSERV_FILES)
+@PROGRAM_PREFIX@server_LDADD = ../wince/libc_wince.a @LDFLAGS@ @SDLNET_LIBS@

 MAIN_SOURCE_FILES=\
 am_map.c             am_map.h              \
@@ -167,12 +167,12 @@ SOURCE_FILES = $(MAIN_SOURCE_FILES)                \
                $(FEATURE_SOUND_SOURCE_FILES)

 if HAVE_WINDRES
-chocolate_doom_SOURCES=$(SOURCE_FILES) resource.rc
+@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES) resource.rc
 else
-chocolate_doom_SOURCES=$(SOURCE_FILES)
+@PROGRAM_PREFIX@doom_SOURCES=$(SOURCE_FILES)
 endif

-chocolate_doom_LDADD =                               \
+@PROGRAM_PREFIX@doom_LDADD =                         \
                        ../wince/libc_wince.a         \
                        ../textscreen/libtextscreen.a \
                        ../pcsound/libpcsound.a       \
diff --git a/src/doom-screensaver.desktop.in b/src/doom-screensaver.desktop.in
index cee79c2d..1d6e3303 100644
--- a/src/doom-screensaver.desktop.in
+++ b/src/doom-screensaver.desktop.in
@@ -3,8 +3,8 @@
 Encoding=UTF-8
 Name=Doom
 Comment=DOOM by Id Software.
-TryExec=@PACKAGE_TARNAME@
-Exec=@PACKAGE_TARNAME@
+TryExec=@PACKAGE_PREFIX@doom
+Exec=@PACKAGE_PREFIX@doom
 StartupNotify=false
 Terminal=false
 Type=Application
diff --git a/src/m_config.c b/src/m_config.c
index 04d0a963..d0fd5185 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1452,9 +1452,9 @@ void M_LoadDefaults (void)
     else
     {
         extra_defaults.filename
-            = malloc(strlen(configdir) + strlen(PACKAGE_TARNAME) + 10);
-        sprintf(extra_defaults.filename, "%s%s.cfg",
-                configdir, PACKAGE_TARNAME);
+            = malloc(strlen(configdir) + strlen(PROGRAM_PREFIX) + 15);
+        sprintf(extra_defaults.filename, "%s%sdoom.cfg",
+                configdir, PROGRAM_PREFIX);
     }

     LoadDefaultCollection(&doom_defaults);