aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2009-09-21 11:26:49 -0700
committerAdam Vandenberg2009-09-21 13:05:41 -0700
commit791ba4531f67c7cb7ba08956ec71e5c4aa7de6b5 (patch)
tree0d6ba4dbc6b5f47e2ee216518be8f83f7b9a4de2
parent6786e52811d39afa6e3a24b099f631b4eaae2da2 (diff)
downloadhomebrew-791ba4531f67c7cb7ba08956ec71e5c4aa7de6b5.tar.bz2
Add nethack formula
-rw-r--r--Library/Formula/nethack.rb72
1 files changed, 72 insertions, 0 deletions
diff --git a/Library/Formula/nethack.rb b/Library/Formula/nethack.rb
new file mode 100644
index 000000000..bf9be7fd1
--- /dev/null
+++ b/Library/Formula/nethack.rb
@@ -0,0 +1,72 @@
+require 'brewkit'
+
+# Nethack the way God intended it to be played: from a terminal.
+# This build script was created referencing:
+# * http://nethack.wikia.com/wiki/Compiling#On_Mac_OS_X
+# * http://nethack.wikia.com/wiki/Pkgsrc#patch-ac_.28system.h.29
+# and copious hacking until things compiled.
+#
+# The patch applied incorporates the patch-ac above, the OS X
+# instructions from the Wiki, and whatever else needed to be
+# done.
+
+class Nethack <Formula
+ @url='http://downloads.sourceforge.net/project/nethack/nethack/3.4.3/nethack-343-src.tgz'
+ @homepage='http://www.nethack.org/index.html'
+ @version='3.4.3'
+ @md5='21479c95990eefe7650df582426457f9'
+
+ def patches
+ {
+ :p1 =>
+["http://github.com/adamv/nethack-osx/raw/82992eb6e4d8c76b05037579126293d644ef971d/patches/nethack-osx-343.patch"]
+ }
+ end
+
+ def install
+ # Symlink makefiles
+ system 'sh sys/unix/setup.sh'
+
+ ## We are not using the default installer
+
+ # Install to a sane location, geez.
+ nethackdir = "#{prefix}/libexec/nethack"
+ system "mkdir -p #{nethackdir}"
+
+ inreplace "include/config.h",
+ '# define HACKDIR "/usr/games/lib/nethackdir"',
+ "#define HACKDIR \"#{nethackdir}\""
+
+ # Make the data first, before we munge the CFLAGS
+ system "cd dat;make"
+
+ Dir.chdir 'dat' do
+ nethack_libexec = (libexec+'nethack')
+
+ %w(perm logfile).each do |f|
+ system "touch #{f}"
+ nethack_libexec.install f
+ end
+
+ # Stage the data
+ nethack_libexec.install %w(help hh cmdhelp history opthelp wizhelp dungeon license data oracles options rumors quest.dat)
+ nethack_libexec.install Dir['*.lev']
+ end
+
+ # Make the game
+ ENV['CFLAGS'] = ENV['CFLAGS'] + " -I../include"
+ system 'cd src;make'
+
+ bin.install 'src/nethack'
+ system "mkdir #{prefix}/libexec/nethack/save"
+ end
+
+ def caveats
+ <<-EOS
+In order to save your game, you need to create the save directory manually:
+ mkdir #{prefix}/libexec/nethack/save
+If you can get this build script to create this folder, please patch it.
+(Currently empty folders are nuked by a perl onliner.)
+ EOS
+ end
+end