OSDN Git Service

make installできるようにした。(angband-2.9.3を参考にした)
authorhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 13 Feb 2002 00:35:50 +0000 (00:35 +0000)
committerhabu <habu@0568b783-4c39-0410-ac80-bf13821ea2a2>
Wed, 13 Feb 2002 00:35:50 +0000 (00:35 +0000)
通常はsrc/hengbandをトップディレクトリに移すだけ。(今までと同様の使いかた)
--with-setgid=games というようなオプションを付けてconfiguireすると、gamesグループでシステムにインストールする事ができる。この場合、デフォルトでは実行バイナリは/usr/local/bin/hengband、各種libファイルは/usr/local/share/games/hengband/lib以下に置かれる。

16 files changed:
acconfig.h
acinclude.m4 [new file with mode: 0644]
configure.in
lib/apex/Makefile.am
lib/bone/Makefile.am
lib/data/Makefile.am
lib/edit/Makefile.am
lib/file/Makefile.am
lib/help/Makefile.am
lib/info/Makefile.am
lib/pref/Makefile.am
lib/save/Makefile.am
lib/script/Makefile.am
lib/user/Makefile.am
lib/xtra/graf/Makefile.am
src/Makefile.am

index f79b9ef..9bad664 100644 (file)
@@ -12,3 +12,4 @@
 #undef CHUUKEI
 #undef WORLD_SCORE
 #undef USE_TRANSPARENCY
+#undef DEFAULT_PATH
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644 (file)
index 0000000..c23983e
--- /dev/null
@@ -0,0 +1,9 @@
+AC_DEFUN(MY_EXPAND_DIR, [
+  $1=$2
+  $1=`(
+       test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+       test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
+       eval echo \""[$]$1"\"
+      )`
+])
+
index 03c409a..030f5a5 100644 (file)
@@ -3,13 +3,40 @@ AC_INIT(src/main.c)
 
 AM_CONFIG_HEADER(src/autoconf.h)
 
+AM_INIT_AUTOMAKE(hengband, 1.0.9)
+
+AC_ARG_WITH(setgid,
+[  --with-setgid=NAME      install hengband as group NAME],
+[case "${withval}" in
+  no) GAMEGROUP="";;
+  yes) AC_MSG_ERROR(missing argument for --with-setgid);;
+  *) GAMEGROUP="$withval";;
+esac])
+AC_SUBST(GAMEGROUP)
+AM_CONDITIONAL(SET_GID, test "$GAMEGROUP" != "")
+
 AC_LANG_C
 
+dnl generate the installation path for the ./lib/ folder
+if test "$GAMEGROUP" != ""; then
+  MY_EXPAND_DIR(game_datadir, "$datadir/games/$PACKAGE/lib/")
+else
+  MY_EXPAND_DIR(game_datadir, "./lib/")
+  bindir=".."
+fi
+
+dnl overwrite the path with an user-specified value
+AC_ARG_WITH(libpath,
+[  --with-libpath=path     specify the path to the Hengband lib folder],
+[game_datadir="$withval"])
+
+AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$game_datadir")
+DEFAULT_PATH="$game_datadir"
+AC_SUBST(DEFAULT_PATH)
+
 dnl Checks for programs.
 AC_PROG_CC
 
-AM_INIT_AUTOMAKE(hengband, 1.0.9)
-
 AC_ARG_ENABLE(japanese,
 [  --disable-japanese      build english version], use_japanese=no, [AC_DEFINE(JP) AC_DEFINE(EUC)])
 
index 8e8ad9b..81ca89c 100644 (file)
@@ -1,4 +1,21 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        h_scores.raw readme.txt
+
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@apex
+
+angband_DATA = \
+  $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+       touch "$(DESTDIR)$(angbanddir)/scores.raw"
+       chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+       chmod -R g+w "$(DESTDIR)$(angbanddir)"
+endif
index 44812f7..3a23eda 100644 (file)
@@ -1,4 +1,21 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@bone
+
+angband_DATA = \
+  $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+       chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+       chmod -R g+w "$(DESTDIR)$(angbanddir)"
+endif
+
index 44812f7..2835820 100644 (file)
@@ -1,4 +1,21 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@data
+
+angband_DATA = \
+  $(angband_files)
+endif
+
+
+install-data-hook:
+if SET_GID
+       chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+       chmod g+w "$(DESTDIR)$(angbanddir)"
+endif
index b60c6b8..569dc1a 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        a_info_j.txt d_info_j.txt e_info_j.txt f_info_j.txt \
        k_info_j.txt misc_j.txt \
        q0000001_j.txt q0000002_j.txt q0000003_j.txt q0000004_j.txt \
@@ -17,3 +17,14 @@ EXTRA_DIST = \
        t0000006_j.txt t_basic_j.txt t_info_j.txt t_lite_j.txt \
        t_pref_j.txt v_info_j.txt w_info_j.txt \
        m_info_j.txt s_info_j.txt
+
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@edit
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 81ed580..481cb2d 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        a_cursed_j.txt a_high_j.txt a_low_j.txt a_med_j.txt \
        aname_j.txt book-0_jp.txt chainswd_j.txt dead_j.txt \
        death_j.txt elvish_j.txt error_j.txt mondeath_j.txt \
@@ -16,3 +16,13 @@ EXTRA_DIST = \
        timenorm.txt w_cursed.txt w_high.txt w_low.txt\
        w_med.txt
 
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@file
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 621b896..1956489 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        arena.txt attack.hlp attack.txt birth.hlp birth.txt \
        bldg.txt command.hlp command.txt commdesc.hlp commdesc.txt \
        dungeon.hlp dungeon.txt gambling.txt general.hlp general.txt \
@@ -16,3 +16,14 @@ EXTRA_DIST = \
        jtang.txt jtown.hlp jtown.txt jversion.txt \
        jversion.txt magic.hlp magic.txt option.hlp option.txt \
        pref.hlp pref.txt readme.txt spoiler.hlp tang.txt version.txt
+
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@help
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 44812f7..8a6b5ef 100644 (file)
@@ -1,4 +1,15 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@info
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 5af4ce0..65a1226 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        colors.prf \
        font-ami.prf font-dos.prf font-ibm.prf font-mac.prf \
        font-mon.prf font-win.prf font-x11.prf font-xxx.prf \
@@ -12,3 +12,14 @@ EXTRA_DIST = \
        pref-x11.prf pref.prf proxy.prf spell-xx.prf \
        user-win.prf user.prf xtra-gcu.prf \
        xtra-new.prf xtra-xxx.prf
+
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@pref
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 44812f7..c92fde5 100644 (file)
@@ -1,4 +1,20 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@save
+
+angband_DATA = \
+  $(angband_files)
+endif
+
+install-data-hook:
+if SET_GID
+       chown -R root.@GAMEGROUP@ "$(DESTDIR)$(angbanddir)"
+       chmod g+w "$(DESTDIR)$(angbanddir)"
+endif
index 44812f7..ce5ddb5 100644 (file)
@@ -1,4 +1,15 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@script
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 44812f7..0d34a7c 100644 (file)
@@ -1,4 +1,15 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
+angband_files = \
+  delete.me
+
 EXTRA_DIST = \
-       delete.me
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@user
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 44ea3bc..7098ee0 100644 (file)
@@ -1,4 +1,15 @@
 ## Makefile.am -- Process this file with automake to process Makefile.in
 
-EXTRA_DIST = \
+angband_files = \
        8x8.bmp
+
+EXTRA_DIST = \
+  $(angband_files)
+
+if SET_GID
+angbanddir = @DEFAULT_PATH@xtra/graf
+
+angband_DATA = \
+  $(angband_files)
+endif
+
index 653612f..be39df8 100644 (file)
@@ -29,3 +29,9 @@ EXTRA_hengband_SOURCES = \
        main-dos.c main-ibm.c main-mac-carbon.c \
        makefile.bcc makefile.std makefile.dos makefile.ibm \
        readdib.c script.c wall.bmp
+
+install-exec-hook:
+if SET_GID
+       chgrp "@GAMEGROUP@" "$(DESTDIR)$(bindir)/hengband"
+       chmod g+s "$(DESTDIR)$(bindir)/hengband"
+endif