OSDN Git Service

Modified configure.ac to add a --enable-cocoa option which builds the new Mac OS...
authorEric Branlund <ebranlund@fastmail.com>
Mon, 26 Aug 2019 02:31:53 +0000 (19:31 -0700)
committerEric Branlund <ebranlund@fastmail.com>
Mon, 26 Aug 2019 02:31:53 +0000 (19:31 -0700)
configure.ac
lib/edit/Makefile.am
lib/file/Makefile.am
lib/help/Makefile.am
lib/pref/Makefile.am
lib/xtra/graf/Makefile.am
lib/xtra/sound/Makefile.am
readme_eng.txt
src/Makefile.am

index a10d928..d79c9fa 100644 (file)
@@ -48,6 +48,13 @@ AC_ARG_ENABLE(worldscore,
 [  --disable-worldscore    disable worldscore support], ,AC_DEFINE(WORLD_SCORE, 1, [Allow the game to send scores to the score server]))
 AC_ARG_ENABLE(chuukei,
 [  --enable-chuukei        enable internet chuukei support], AC_DEFINE(CHUUKEI, 1, [Chuukei mode]))
+AC_ARG_ENABLE([cocoa],
+[  --enable-cocoa          enable a Cocoa user interface (OS X only)],
+AC_DEFINE([MACH_O_COCOA], [1], [Use a Cocoa interface (OS X only)]), [])
+AM_CONDITIONAL([COCOA], [test x$enable_cocoa = xyes])
+if test x"$enable_cocoa" = yes; then
+AC_LANG_OBJC
+fi
 
 dnl Checks for libraries.
 dnl Replace `main' with a function in -lncurses:
index 03f027e..9d6c497 100644 (file)
@@ -28,3 +28,16 @@ angband_DATA = \
   $(angband_files)
 endif
 
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+appdatadir = $(APPRES)/lib/edit
+appdata_DATA = \
+       $(angband_files)
+endif
index 59658f0..0057614 100644 (file)
@@ -26,3 +26,16 @@ angband_DATA = \
   $(angband_files)
 endif
 
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+appfiledir = $(APPRES)/lib/file
+appfile_DATA = \
+       $(angband_files)
+endif
\ No newline at end of file
index a823db0..9e20958 100644 (file)
@@ -32,3 +32,16 @@ angband_DATA = \
   $(angband_files)
 endif
 
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+apphelpdir = $(APPRES)/lib/help
+apphelp_DATA = \
+       $(angband_files)
+endif
index efe4191..b7079ea 100644 (file)
@@ -24,3 +24,16 @@ angband_DATA = \
   $(angband_files)
 endif
 
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+appprefdir = $(APPRES)/lib/pref
+apppref_DATA = \
+       $(angband_files)
+endif
index 7098ee0..76009c5 100644 (file)
@@ -3,8 +3,13 @@
 angband_files = \
        8x8.bmp
 
+angband4_conf = list.txt
+angband4_tile_files = \
+       old/8x8.png \
+       adam-bolt/16x16.png
+
 EXTRA_DIST = \
-  $(angband_files)
+  $(angband_files) $(angband4_conf) $(angband4_tile_files)
 
 if SET_GID
 angbanddir = @DEFAULT_PATH@xtra/graf
@@ -13,3 +18,18 @@ angband_DATA = \
   $(angband_files)
 endif
 
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+appgrafdir = $(APPRES)/lib/xtra/graf
+appgraf_DATA = \
+       $(angband4_conf)
+nobase_appgraf_DATA = \
+       $(angband4_tile_files)
+endif
index 2b0097b..27158c3 100644 (file)
@@ -20,3 +20,17 @@ EXTRA_DIST = \
        sound.cfg \
        $(sound_files) \
        se_maoudamashii_voice_monster01.wav
+
+if COCOA
+# APPNAME to APPRES duplicate what's in src/Makefile.am.  It would be nice to
+# avoid that, but until then, they should match.
+APPNAME = $(PACKAGE_NAME)
+APPDIR = $(APPNAME).app
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPRES = $(APPCONT)/Resources
+
+appsounddir = $(APPRES)/lib/xtra/sound
+appsound_DATA = \
+       sound.cfg $(sound_files)
+endif
index 7d3c4bd..ca850e3 100644 (file)
@@ -58,7 +58,21 @@ or makefile.dos before MAKE with these.
 Download the binary archive for Macintosh.
 Unpack it, and click hengband to play.
 
+For Mac OS X with XCode installed, the Unix instructions can work to build a
+version usable from a terminal.  If XQuartz, https://www.xquartz.org ,  is
+installed, X11 will be used for display.
 
+For Mac OS X 7 or later with XCode installed, a native version can be built by
+downloading the source archive and running
+
+tar -zxvf hengband-x.x.x.tar.gz
+cd hengband-x.x.x
+./configure --disable-japanese --enable-cocoa --without-x
+make install
+
+from a terminal where you substitute x.x.x with the version number you
+downloaded.  That will build hengband.app in the hengband-x.x.x directory;
+you can then move hengband.app to where you want it to be.
 
 -----  Basic for Playing  ------
 
index e71ed93..b04885b 100644 (file)
@@ -95,8 +95,55 @@ EXTRA_hengband_SOURCES = \
        makefile.bcc makefile.std makefile.dos makefile.ibm \
        readdib.c wall.bmp
 
+cocoa_icon_files = \
+       cocoa/hengband_Icons.icns \
+       cocoa/Save.icns \
+       cocoa/Edit.icns \
+       cocoa/Data.icns
+cocoa_plist_template = cocoa/Angband-Cocoa.xml
+cocoa_plist_files = \
+       cocoa/CommandMenu.plist
+cocoa_en_nib_files = \
+       cocoa/en.lproj/MainMenu.nib/designable.nib \
+       cocoa/en.lproj/MainMenu.nib/keyedobjects.nib
+
 EXTRA_DIST = \
-       gcc-wrap
+       gcc-wrap \
+       $(cocoa_icon_files) \
+       $(cocoa_plist_template) \
+       $(cocoa_plist_files) \
+       $(cocoa_en_nib_files)
+
+if COCOA
+hengband_SOURCES += main-cocoa.m grafmode.h grafmode.c
+AM_CFLAGS = -mmacosx-version-min=10.7
+AM_OBJCFLAGS = -mmacosx-version-min=10.7
+hengband_LDFLAGS = -framework cocoa $(AM_LDFLAGS)
+hengband_LINK = MACOSX_DEPLOYMENT_TARGET=10.7 $(OBJCLINK) $(hengband_LDFLAGS) $(LDFLAGS) -o $@ 
+APPNAME = $(PACKAGE_NAME)
+APPEXE = hengband
+APPDIR = $(APPNAME).app
+BUNDLE_IDENTIFIER = jp.osdn.hengband
+BUNDLE_VERSION = $(PACKAGE_VERSION)
+# Be careful with characters (like '&') in the copyright that have special
+# meanings to sed.
+COPYRIGHT = (c) Mr. Hoge and many others
+APPBNDL = $(bindir)/$(APPDIR)
+APPCONT = $(APPBNDL)/Contents
+APPBIN = $(APPCONT)/MacOS
+APPRES = $(APPCONT)/Resources
+appbin_PROGRAMS = $(APPEXE)
+appbindir = $(APPBIN)
+dist_appicon_DATA = $(cocoa_icon_files)
+appicondir = $(APPRES)
+appplist_DATA = $(cocoa_plist_files)
+appplistdir = $(APPRES)
+appennib_DATA = $(cocoa_en_nib_files)
+appennibdir = $(APPRES)/en.lproj/MainMenu.nib
+else
+EXTRA_hengband_SOURCES += main-cocoa.m grafmode.h grafmode.c
+hengband_LINK = $(LINK)
+endif
 
 COMPILE = $(srcdir)/gcc-wrap $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -106,3 +153,24 @@ if SET_GID
        chgrp "@GAMEGROUP@" "$(DESTDIR)$(bindir)/hengband"
        chmod g+s "$(DESTDIR)$(bindir)/hengband"
 endif
+
+if COCOA
+# Create lib/info and lib/xtra within the application bundle since not
+# currently installing anything to them.  Other relevant lib directories
+# should be created from the Makefiles in the lib directory.
+install-data-local:
+       @mkdir -p $(APPCONT)
+       @mkdir -p $(APPRES)/lib/info
+       @mkdir -p $(APPRES)/lib/xtra
+       sed -e 's/\$$VERSION\$$/$(PACKAGE_VERSION)/' \
+               -e 's/\$$COPYRIGHT\$$/$(COPYRIGHT)/' \
+               -e 's/\$$NAME\$$/$(APPNAME)/' \
+               -e 's/\$$EXECUTABLE\$$/$(APPEXE)/' \
+               -e 's/\$$BUNDLE_VERSION\$$/$(BUNDLE_VERSION)/' \
+               -e 's/\$$BUNDLE_IDENTIFIER\$$/$(BUNDLE_IDENTIFIER)/' \
+               $(srcdir)/$(cocoa_plist_template) > $(APPCONT)/Info.plist
+
+distclean-local:
+       -rm $(APPCONT)/Info.plist
+
+endif