]> Dogcows Code - chaz/yoink/commitdiff
now can create win32 portable packages
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 5 Mar 2010 22:43:48 +0000 (15:43 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 5 Mar 2010 22:43:48 +0000 (15:43 -0700)
17 files changed:
COPYING
Makefile.am
README
configure.ac
doc/man2html.sh [new file with mode: 0755]
doc/yoink.6.in
extra/PKGBUILD [new file with mode: 0644]
src/Makefile.am
src/Moof/HashTools.cc [moved from src/Moof/Hash.cc with 95% similarity]
src/Moof/HashTools.hh [moved from src/Moof/Hash.hh with 87% similarity]
src/Moof/Manager.hh
win32/Makefile.am [deleted file]
win32/makedeps.sh [moved from win32/tools/makedeps.sh with 74% similarity]
win32/makepackage.sh [new file with mode: 0755]
win32/mkpackage.sh.in [deleted file]
win32/unix2dos.sh [moved from tools/unix2dos with 83% similarity]
win32/yoink.nsi [moved from win32/yoink.nsi.in with 95% similarity]

diff --git a/COPYING b/COPYING
index 1948e77123790d58a0335ca3f5d683c903759188..5b126c9cc81932174aa7d4b05325ab048c995817 100644 (file)
--- a/COPYING
+++ b/COPYING
@@ -55,7 +55,7 @@ Copyright: (c) 2000-2004 Unicode, Inc.
 Copyright: (c) 2002 Bob Pendleton
   License: LGPL-2.1
 
-  Portion: libpng-3.dll
+  Portion: libpng14-14.dll
    Source: http://www.libpng.org/pub/png/libpng.html
 Copyright: (c) 2004, 2006-2009 Glenn Randers-Pehrson
   License: libpng
index bb29cd0c02ce9bd61aa72f4363d499e3e4ad9329..f3c3773fa70b7f40aa70e45d32fa50c1e4aeaf1b 100644 (file)
@@ -3,24 +3,29 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = data doc src
 
-EXTRA_DIST = autogen.sh extra
+EXTRA_DIST = autogen.sh extra win32
 
 
-.PHONY: run debug docs package
+.PHONY: run debug docs portable installer
 
 run: all
-       @cd src && $(MAKE) run
+       @$(CD) src && $(MAKE) run
 
 debug: all
-       @cd src && $(MAKE) debug
+       @$(CD) src && $(MAKE) debug
 
 docs:
        $(DOXYGEN)
 
 if WIN32
-package: all
-       @cd win32 && $(MAKE) installer
-else
-package: dist-bzip2
+
+portable: all
+       $(SH) win32/makepackage.sh -p $(prefix) -d "$(DATA_FILES)" \
+               -s $(STRIP) -V $(VERSION)
+
+installer: all
+       $(SH) win32/makepackage.sh -p $(prefix) -d "$(DATA_FILES)" \
+               -s $(STRIP) -V $(VERSION) -i $(MAKENSIS)
+
 endif
 
diff --git a/README b/README
index 7994e6958c1f8c67f0c3aace1368d2c8e0118d3a..6c69f0a004bd68773487bca2793e216e4c37a488 100644 (file)
--- a/README
+++ b/README
@@ -13,7 +13,6 @@ II.  Developers
   b)   Sending patches
 III. Packagers
   a)   The build system
-  b)   Targeting Win32
 
 
 I. Users
@@ -69,7 +68,7 @@ library.  These classes and helper functions reside in the Mf namespace.
 Since I wrote this code alongside the Yoink-specific stuff, there is
 somewhat of a blurry line between the two categories, unfortunately.
 
-3. 3rd-party code.
+3. Third-party code.
 
 This is made up of free code from other projects or libraries (aside from
 the explicit dependencies above), the licenses of which are also in the
@@ -83,7 +82,7 @@ email me your stuff or tell me where to pull from (git).  If you're
 interested in that, please observe the following:
 
 *  Stick to the coding style of the source code files you edit.  Follow the
-   general style of method and variable naming, as well as white spacing
+   general style of method and variable naming, as well as white space
    formatting.  In particular, use literal tabs with an assumed tabstop of
    4 characters.  Also, limit line lengths to 75 characters.
 
@@ -92,7 +91,7 @@ interested in that, please observe the following:
    and conditions as the files you edit, usually the 2-clause BSD license.
 
 *  If you want your name and contact information in the file AUTHORS,
-   please just add it in the patch you provide.
+   please make it so in the patch you provide.
 
 
 III. Packagers
@@ -101,25 +100,7 @@ III. Packagers
 a) The build system
 
 You can probably tell that the build system of this package is built from
-autoconf and automake.  It should be fairly sane.  If you find any build
-system problems or code which doesn't compile cleanly on your platform,
-feel free to send back patches.
-
-b) Targeting Win32
-
-If you have a working mingw32 toolchain with all the dependencies, you can
-build a win32 binary using a command such as this:
-
-./configure --host=mingw32 --prefix=/usr/mingw32/usr
-
-where mingw32 is the correct name of your toolchain and the prefix points
-to the installation of your toolchain.  I maintain an archive of most of
-the dependencies.  The package is in the git repository; just unzip it onto
-your toolchain and configure/compile.  If everything goes smoothly, you
-should have a new, shiny yoink.exe.  You can then build a complete
-installer using "make package" if you have nsis installed.
-
-I haven't tried building with cygwin or mingw32 on an actual Windows
-machine, and I certainly haven't tried to do it with Visual Studio.  You're
-on your own if you go that route.
+autoconf and automake.  It should be fairly sane.  If you find any
+packaging-related problems or code which doesn't compile cleanly on your
+platform, feel free to send patches.
 
index a35b3a4879e7187b698f1fe411686bed5f20f46b..93319640e08f43f3ff1cdf99e5b1d3d54d7618bc 100644 (file)
@@ -343,12 +343,6 @@ AC_CONFIG_FILES([Makefile
                                 doc/yoink.6
                                 src/Makefile])
 
-if test x$WIN32 = xyes
-then
-       AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh win32/yoink.nsi])
-fi
-
-
 AC_CONFIG_HEADERS([src/config.h])
 
 AC_OUTPUT
diff --git a/doc/man2html.sh b/doc/man2html.sh
new file mode 100755 (executable)
index 0000000..49f6c72
--- /dev/null
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+#
+# Yoink
+# Run this script to convert the manual page to html.
+#
+# Requires groff.
+# Have fun!
+#
+
+function showhelp()
+{
+       echo "Create an html manual page."
+       echo "Usage: $0 [-Hfh] [-i manpage] [-o htmlfile]"
+       echo ""
+       echo "  -H  Hide email addresses in the manual page."
+       echo "  -f  Force overwrite of output file."
+       echo "  -h  Show this help an exit."
+       echo "  -i  Specify the manual page to convert."
+       echo "  -o  Specify output path of html file."
+}
+
+INFILE="doc/yoink.6"
+OUTFILE="yoink.html"
+
+while getopts ":Hfhi:o:" opt
+do
+       case $opt in
+               H)
+                       HIDE_EMAIL=yes
+                       ;;
+               f)
+                       FORCE=yes
+                       ;;
+               h)
+                       showhelp
+                       exit 0
+                       ;;
+               i)
+                       INFILE="$OPTARG"
+                       ;;
+               o)
+                       OUTFILE="$OPTARG"
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       showhelp
+                       exit 1
+                       ;;
+       esac
+done
+
+if test x$FORCE != xyes && test -e "$OUTFILE"
+then
+       echo "Refusing to overwrite file: $OUTFILE.  Use -f to override." >&2
+       exit 1
+fi
+
+if test ! -f "$INFILE"
+then
+       echo "Can't open file: $INFILE" >&2
+       exit 1
+fi
+
+DATE=$(date +"%d %b %Y")
+
+# 1. Remove first two lines (comments about groff).
+# 2. Edit page title.
+# 3. Insert a footer before </body>.
+HTML=$(groff -t -e -mandoc -Thtml "$INFILE" | sed -e "1,2d" \
+-e "s|<title>.*</title>|<title>Yoink Manual</title>|" -e "s|</body>|\
+<p style=\"font-size: 9px; text-align: center;\">\\
+This manual page was generated on $DATE.\\
+For more information, go to the\\
+<a href=\"http://www.dogcows.com/yoink/\">Yoink website</a>.\\
+</p>\\
+</body>|")
+
+if test x$HIDE_EMAIL = xyes
+then
+# 4. Replace email addresses with a placeholder.
+       echo "$HTML" \
+       | sed -e "s|&lt;.*@.*&gt;|\&lt;email address not shown\&gt;|g" \
+       >"$OUTFILE"
+else
+       echo "$HTML" >"$OUTFILE"
+fi
+
index 4de435386dc7034f1233034c033e11ffd7b56ecf..01f14bd86a50cab556b488aa99304411010cbea1 100644 (file)
@@ -180,7 +180,7 @@ the \fBframerate\fP to a point such that the actual framerate is basically
 constant.  A constant 20fps or 30fps will look better than a sporadic
 40-60fps.  You can also decrease the \fBtimestep\fP at the expense of
 decreased simulation accuracy.  You'll have to experiment with this value
-to find out acceptable levels.
+to determine acceptable levels.
 .PP
 If you are having audio problems, you may need to upgrade OpenAL.  Some
 systems still provide an old, busted version of OpenAL which may result in
@@ -189,12 +189,12 @@ of openal-soft, a high-quality software implementation that is still being
 maintained.
 .SH BUGS
 .IP \(bu 3
-The robots are currently lacking in intelligence.
+The robots aren't very bright.
 .IP \(bu
 Although the pixelated graphics are intentional, there are some unintended
 artifacts which are more obvious with certain video drivers.
 .PP
-Send bug reports, patches, and love notes to:
+Send bug reports, patches and love notes to:
 .IP
 Charles McGarvey <@PACKAGE_BUGREPORT@>
 .SH AUTHOR
diff --git a/extra/PKGBUILD b/extra/PKGBUILD
new file mode 100644 (file)
index 0000000..fed4e99
--- /dev/null
@@ -0,0 +1,31 @@
+# Contributor: Charles McGarvey <onefriedrice@brokenzipper.com>
+pkgname=yoink
+pkgver=@VERSION@
+pkgrel=1
+pkgdesc="Alien-smashing action game"
+arch=('i686' 'x86_64')
+url="http://www.dogcows.com/yoink"
+license=('BSD')
+groups=()
+depends=('libgl' 'libpng' 'libvorbis' 'lua' 'openal' 'sdl')
+makedepends=('boost' 'pkgconfig')
+optdepends=()
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+source=(http://www.dogcows.com/yoink/$pkgname-$pkgver.tar.bz2)
+noextract=()
+md5sums=('@CHECKSUM@')
+
+build() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  ./configure --prefix=/usr
+  make || return 1
+  make DESTDIR="$pkgdir/" install
+}
+
+# vim:set ts=2 sw=2 et:
index c87c4126ffdff48ae4c4b8085882c5e360c93028..9a7f5146e454789933ca73128d720488f1e5429d 100644 (file)
@@ -29,8 +29,8 @@ libmoof_a_SOURCES = \
                                        Moof/Event.hh \
                                        Moof/Frustum.cc \
                                        Moof/Frustum.hh \
-                                       Moof/Hash.cc \
-                                       Moof/Hash.hh \
+                                       Moof/HashTools.cc \
+                                       Moof/HashTools.hh \
                                        Moof/Image.cc \
                                        Moof/Image.hh \
                                        Moof/Interpolator.hh \
similarity index 95%
rename from src/Moof/Hash.cc
rename to src/Moof/HashTools.cc
index 357b5318a3edb02fb2382fc3689b0f78b84bf1e9..9bcefe3c071489303ba5df4d8c6cbf3fa4d6b01d 100644 (file)
@@ -9,7 +9,7 @@
 *
 **************************************************************************/
 
-#include "Hash.hh"
+#include "HashTools.hh"
 
 
 namespace Mf {
@@ -31,7 +31,7 @@ namespace Mf {
 // 2. It will not produce the same results on little-endian and big-endian
 //    machines.
 
-unsigned getHash::operator()(const void* key, int len,
+unsigned HashFunction::operator()(const void* key, int len,
                                                         unsigned int seed) const
 {
        // 'm' and 'r' are mixing constants generated offline.
similarity index 87%
rename from src/Moof/Hash.hh
rename to src/Moof/HashTools.hh
index e97ee254ec140fb04fdc8542bec83e754dddc9d8..5bed739d069f749c37f47c16bc0bd1c46e690c38 100644 (file)
@@ -9,8 +9,8 @@
 *
 **************************************************************************/
 
-#ifndef _MOOF_HASH_HH_
-#define _MOOF_HASH_HH_
+#ifndef _MOOF_HASHTOOLS_HH_
+#define _MOOF_HASHTOOLS_HH_
 
 #include <string>
 
@@ -20,7 +20,7 @@
 namespace Mf {
 
 
-struct getHash
+struct HashFunction
 {
        // generic hash function
        unsigned operator()(const void* key, int len,
@@ -40,5 +40,5 @@ struct getHash
 
 } // namespace Mf
 
-#endif // _MOOF_HASH_HH_
+#endif // _MOOF_HASHTOOLS_HH_
 
index 2773a593f5e081ce3ae710404d0d124e42ad5900..94f07ba4862bbca8f1938bad8d8181bafe0aaad7 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <Moof/Hash.hh>
+#include <Moof/HashTools.hh>
 
 
 namespace Mf {
@@ -49,7 +49,7 @@ public:
 
 private:
 
-       typedef stlplus::hash<std::string,T*,getHash> PtrMap;
+       typedef stlplus::hash<std::string,T*,HashFunction> PtrMap;
 
        static PtrMap   mPtrMap;
        std::string             mName;
@@ -88,7 +88,7 @@ private:
 };
 
 template <class T>
-stlplus::hash<std::string,T*,getHash> Manager<T>::mPtrMap;
+stlplus::hash<std::string,T*,HashFunction> Manager<T>::mPtrMap;
 
 
 } // namespace Mf
diff --git a/win32/Makefile.am b/win32/Makefile.am
deleted file mode 100644 (file)
index 016518b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-INSTALLER_NAME = yoinksetup-$(VERSION).exe
-
-.PHONY: installer
-installer:
-       @echo "Building win32 installer..."
-       @(sh mkpackage.sh $(INSTALLER_NAME) 2> installer.log 1>&2 && \
-         rm installer.log && echo "Done.") || \
-       (echo "Installer compilation failed!"; \
-        echo "Check installer.log for details."; exit 1)
-
similarity index 74%
rename from win32/tools/makedeps.sh
rename to win32/makedeps.sh
index f5988b1f3d195eca086fc69e3975094ace9eae70..e84fac07762343f0e0bec0b2725abb17c34f916c 100755 (executable)
@@ -1,14 +1,81 @@
-#!/bin/bash
-
-# Download and cross-compile dependencies for Yoink.  This script requires
-# bash, wget, md5sum, unzip, tar, patch, make and install.  Have fun!
-
-HOST="i686-mingw32"
-PREFIX="/usr/$HOST/usr"
+#!/bin/sh
+
+#
+# Yoink
+# Run this script to download and cross-compile dependencies for win32.
+#
+# A directory named deps will be created and/or populated in the current
+# directory.  Upon successful completion (be patient), the compiled
+# dependencies will be packaged into an archive named deps.tar.bz2 in the
+# current directory.  To install the dependencies, execute this command:
+#
+# tar xf deps.tar.bz2 -C $PREFIX
+# 
+# where $PREFIX is the path to your mingw32 toolchain.  If problems occur,
+# check stdout and stderr for clues.  You may be able to easily determine
+# the problem and make the necessary corrections.  These packages will be
+# downloaded and built:
+#
+# SDL 1.2.14
+# boost 1.42.0 (headers only)
+# libogg 1.1.4
+# libpng 1.4.1
+# libvorbis 1.2.3
+# lua 5.1.4
+# openal-soft 1.11.753
+# zlib 1.2.3
+#
+# This script requires a working mingw32 toolchain and other basic tools.
+# Have fun!
+#
+# Example usage:
+#   ./makedeps.sh -H i486-mingw32 -p /usr/i486-mingw32 -m "-j8"
+#
+# Bugs: Each time the script is run, all of the dependencies will be
+# rebuilt, even the ones which were already built successfully.
+#
+
+function showhelp()
+{
+       echo "Download and cross-compile dependencies for win32."
+       echo "Usage: $0 [-h] [-m makeopts] -H host -p prefix"
+       echo ""
+       echo "  -H  Specify the name of your toolchain, like i486-mingw32."
+       echo "  -h  Show this help an exit."
+       echo "  -m  Specify options to be passed to make."
+       echo "  -p  Specify the path to your toolchain installation."
+}
 
-MAKEOPTS="-j8"
+while getopts ":H:hm:p:" opt
+do
+       case $opt in
+               H)
+                       HOST="$OPTARG"
+                       ;;
+               h)
+                       showhelp
+                       exit 0
+                       ;;
+               m)
+                       MAKEOPTS="$OPTARG"
+                       ;;
+               p)
+                       PREFIX="$OPTARG"
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       showhelp
+                       exit 1
+                       ;;
+       esac
+done
+
+if test x$HOST = x || test x$PREFIX = x
+then
+       showhelp
+       exit 1
+fi
 
-#####
 
 function die()
 {
@@ -24,7 +91,7 @@ rm -f $DESTDIR/README
 PACKAGE="boost_1_42_0"
 VERSION="1.42.0"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.bz2 ]] && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.bz2 && (wget "http://sourceforge.net/projects/boost/files/boost/$VERSION/$PACKAGE.tar.bz2/download" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 7bf3b4eb841b62ffb0ade2b82218ebe6  boost_1_42_0.tar.bz2
 EOL
@@ -38,7 +105,7 @@ cp -r $PACKAGE/boost $DESTDIR/$PREFIX/include/boost) || die "installing $PACKAGE
 
 PACKAGE="SDL-1.2.14"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.gz && (wget "http://www.libsdl.org/release/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 e52086d1b508fa0b76c52ee30b55bec4  SDL-1.2.14.tar.gz
 EOL
@@ -53,7 +120,7 @@ make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
 
 PACKAGE="libogg-1.1.4"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/ogg/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 10200ec22543841d9d1c23e0aed4e5e9  libogg-1.1.4.tar.gz
 EOL
@@ -68,7 +135,7 @@ make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
 
 PACKAGE="libvorbis-1.2.3"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.gz && (wget "http://downloads.xiph.org/releases/vorbis/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 5aa77f55c0e0aab8eb8ed982335daac8  libvorbis-1.2.3.tar.gz
 EOL
@@ -85,7 +152,7 @@ make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
 
 PACKAGE="openal-soft-1.11.753-bin"
 cd $DESTDIR
-[[ ! -f $PACKAGE.zip ]] && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.zip && (wget "http://kcat.strangesoft.net/$PACKAGE.zip" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 20747ce5ca0f902ae082fef15d7b41a5  openal-soft-1.11.753-bin.zip
 EOL
@@ -116,7 +183,7 @@ EOL
 
 PACKAGE="zlib123-dll"
 cd $DESTDIR
-[[ ! -f $PACKAGE.zip ]] && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.zip && (wget "http://www.zlib.net/$PACKAGE.zip" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 cc7fa97f9c19386bb701acc79d0abbca  zlib123-dll.zip
 EOL
@@ -135,7 +202,7 @@ ln -fs libzdll.a libz.dll.a) || die "installing $PACKAGE"
 
 PACKAGE="libpng-1.4.1"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://prdownloads.sourceforge.net/libpng/$PACKAGE.tar.gz?download" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.gz && (wget "http://prdownloads.sourceforge.net/libpng/$PACKAGE.tar.gz?download" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 fa0b2a84733463f90d3ac9f43ccafabc  libpng-1.4.1.tar.gz
 EOL
@@ -152,7 +219,7 @@ make DESTDIR=$DESTDIR install || die "installing $PACKAGE"
 
 PACKAGE="lua-5.1.4"
 cd $DESTDIR
-[[ ! -f $PACKAGE.tar.gz ]] && (wget "http://www.lua.org/ftp/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
+test ! -f $PACKAGE.tar.gz && (wget "http://www.lua.org/ftp/$PACKAGE.tar.gz" || die "downloading $PACKAGE")
 (md5sum -c <<"EOL"
 d0870f2de55d59c1c8419f36e8fac150  lua-5.1.4.tar.gz
 EOL
@@ -179,7 +246,7 @@ diff -ur lua-5.1.4.orig/Makefile lua-5.1.4/Makefile
  
  # What to install.
 -TO_BIN= lua luac
-+TO_BIN= lua.exe luac.exe
++TO_BIN= lua.exe luac.exe lua51.dll
  TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
 -TO_LIB= liblua.a
 +TO_LIB= liblua.a liblua.dll.a
diff --git a/win32/makepackage.sh b/win32/makepackage.sh
new file mode 100755 (executable)
index 0000000..6cb1afa
--- /dev/null
@@ -0,0 +1,143 @@
+#!/bin/sh
+
+#
+# Yoink
+# Run this script to create a portable win32 package.
+#
+
+function showhelp()
+{
+       echo "Create a portable win32 package or installer."
+       echo "Usage: $0 [-h] [-i makensis] [-s strip] -d assets -V version -p prefix"
+       echo ""
+       echo "  -d  Specify the game assets to be included."
+       echo "  -h  Show this help an exit."
+       echo "  -i  To make an installer, specify the makensis program."
+       echo "  -V  Specify the version of the program to be packaged"
+       echo "  -s  To strip the binaries, specify the strip program."
+       echo "  -p  Specify the path to your toolchain installation."
+}
+
+while getopts ":V:hd:i:p:s:" opt
+do
+       case $opt in
+               V)
+                       VERSION="$OPTARG"
+                       ;;
+               d)
+                       ASSETS="$OPTARG"
+                       ;;
+               h)
+                       showhelp
+                       exit 0
+                       ;;
+               i)
+                       MAKENSIS="$OPTARG"
+                       ;;
+               p)
+                       PREFIX="$OPTARG"
+                       ;;
+               s)
+                       STRIP="$OPTARG"
+                       ;;
+               \?)
+                       echo "Invalid option: -$OPTARG" >&2
+                       showhelp
+                       exit 1
+                       ;;
+       esac
+done
+
+if test "x$ASSETS" = x || test "x$VERSION" = x || test "x$PREFIX" = x
+then
+       showhelp
+       exit 1
+fi
+
+function die()
+{
+       rm -rf "$BUILD"
+       echo "die:" $@
+       exit 1
+}
+
+ROOT="$PWD"
+BUILD="$PWD/tmp-$$"
+NAME="yoink-$VERSION"
+ARCHIVE="$BUILD/$NAME"
+INSTALLER_SCRIPT="$ROOT/win32/yoink.nsi"
+
+MAN2HTML="$ROOT/doc/man2html.sh"
+UNIX2DOS="$ROOT/win32/unix2dos.sh"
+
+DLLS="libogg-0 libpng14-14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1"
+
+
+if test ! -f "src/version.c"
+then
+       echo "Run the script from the repository root directory."
+       exit 1
+fi
+
+if ! mkdir "$BUILD"
+then
+       "The temp directory $BUILD could not be created."
+       exit 1
+fi
+mkdir -p "$ARCHIVE"
+
+
+cp -f "$ROOT/src/yoink.exe" "$ARCHIVE" || die "copying yoink.exe"
+test "x$STRIP" != x && "$STRIP" "$ARCHIVE/yoink.exe"
+
+for dll in $DLLS
+do
+       cp -f "$PREFIX/bin/$dll.dll" "$ARCHIVE" || die "copying $dll"
+       test "x$STRIP" != x && "$STRIP" "$ARCHIVE/$dll.dll"
+done
+
+for asset in $ASSETS
+do
+       cp -f --parents "data/$asset" "$ARCHIVE"
+done
+
+for doc in AUTHORS ChangeLog COPYING README TODO
+do
+       "$UNIX2DOS" "$doc" "$ARCHIVE/$doc.txt" || die "unix2dos $doc"
+done
+
+"$MAN2HTML" -f -o "$ARCHIVE/Manual.html"
+"$UNIX2DOS" "$ARCHIVE/Manual.html"
+
+cp -rf "$ROOT/doc/licenses" "$ARCHIVE" || die "copying doc/licenses"
+cd "$ARCHIVE/licenses"
+for license in $(ls)
+do
+       (mv "$license" "$license.txt" && "$UNIX2DOS" "$license.txt") \
+               || die "moving and unix2dos $license"
+done
+cd "$ROOT"
+
+
+if test "x$MAKENSIS" = x
+then
+# build the portable archive
+       cd "$BUILD"
+       zip -r $NAME.zip $NAME || die "zipping portable archive"
+       cd "$ROOT"
+       mv "$BUILD/$NAME.zip" .
+       echo "Done! Package saved to $NAME.zip."
+else
+# build an installer
+       cd "$BULID"
+       "$MAKENSIS" "$INSTALLER_SCRIPT" \
+               -DINSTALLFILES="$NAME" -DVERSION="$VERSION" \
+               || die "running '$MAKENSIS'"
+       cd "$ROOT"
+       mv "$BUILD/$NAME.exe" .
+       echo "Done! Installer saved to $NAME.exe."
+fi
+
+
+rm -rf "$BUILD"
+
diff --git a/win32/mkpackage.sh.in b/win32/mkpackage.sh.in
deleted file mode 100644 (file)
index 4a760d8..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-
-#
-# Yoink
-# Run this script to create a win32 installer.
-# This was blatantly yoinked and adapted from the Wormux Project.
-#
-
-# Paths
-SCRIPT="$PWD/yoink.nsi"
-BUILD_DIR="$PWD/build"
-ROOT_DIR="$PWD/.."
-
-# Programs
-MAKENSIS="@MAKENSIS@"
-STRIP="@STRIP@"
-UNIX2DOS="$ROOT_DIR/tools/unix2dos"
-
-# DLL dependencies
-DLLS="libogg-0 libpng14-14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1"
-
-# Prepare
-rm -rf "$BUILD_DIR"
-mkdir -p "$BUILD_DIR"
-
-cp -f "$ROOT_DIR/src/yoink.exe" "$BUILD_DIR"
-#"${STRIP:-strip}" "$BUILD_DIR/yoink.exe"
-
-for dll in $DLLS
-do
-       cp -f "@prefix@/bin/$dll.dll" "$BUILD_DIR"
-       #"${STRIP:-strip}" "BUILD_DIR/$dll.dll"
-done
-
-cd "$ROOT_DIR"
-for asset in @DATA_FILES@
-do
-       cp -f --parents "data/$asset" "$BUILD_DIR"
-done
-
-cd "$ROOT_DIR"
-for doc in AUTHORS ChangeLog COPYING README TODO
-do
-       "$UNIX2DOS" "$doc" "$BUILD_DIR/$doc.txt"
-done
-
-cd "$ROOT_DIR/doc"
-cp -rf licenses "$BUILD_DIR"
-
-cd "$BUILD_DIR/licenses"
-for license in $(ls)
-do
-       mv "$license" "$license.txt"
-       "$UNIX2DOS" "$license.txt"
-done
-
-
-#
-# Compile the installer and cleanup.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-if ! "${MAKENSIS:-makensis}" "$SCRIPT"
-then
-       echo "makensis failed, aborting..."
-       exit 1
-fi
-
-#rm -rf "$BUILD_DIR"
-
similarity index 83%
rename from tools/unix2dos
rename to win32/unix2dos.sh
index 3c171e55dc219d028fd6b6a7c85d6b21702934bb..c3ee7a8d336f5ef54c3a721c3fdb26198f8bf6a1 100755 (executable)
@@ -1,7 +1,9 @@
 #!/bin/sh
 
+#
+# Yoink
 # An implementation of unix2dos using sed.
-# Written by Charles McGarvey; released into the public domain.
+#
 
 if [ -f "$1" ];
 then
similarity index 95%
rename from win32/yoink.nsi.in
rename to win32/yoink.nsi
index b1a1aed141d2c3432ddbacbe810e266101ee0280..7f1b635094714bf2bc3f56bf4e88d3acf8f8c28f 100644 (file)
@@ -12,7 +12,7 @@
 
   ;Name and file
   Name "Yoink"
-  OutFile "../yoinksetup-@VERSION@.exe"
+  OutFile "yoinksetup-$VERSION.exe"
   SetCompressor /SOLID lzma
 
   ;Default installation folder
@@ -64,7 +64,7 @@ Section "Install Yoink!" SecInstallYoink
   SetOutPath "$INSTDIR"
   
   ;ADD YOUR OWN FILES HERE...
-  File /r "build/*"
+  File /r "$INSTALLFILES/*"
   
   ;Store installation folder
   WriteRegStr HKCU "Software\Yoink" "" $INSTDIR
@@ -78,9 +78,9 @@ Section "Install Yoink!" SecInstallYoink
   CreateShortCut "$SMPROGRAMS\Yoink\Uninstall.lnk" "$INSTDIR\uninstall.exe"
 
   WriteRegStr HKCU "Software\Games\Yoink" "" "$INSTDIR"
-  WriteRegStr HKCU "Software\Games\Yoink" "Version" "@VERSION@"
+  WriteRegStr HKCU "Software\Games\Yoink" "Version" "$VERSION"
   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayName" "Yoink"
-  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayVersion" "@VERSION@"
+  WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "DisplayVersion" "$VERSION"
   WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Yoink" "UninstallString" "$INSTDIR\uninstall.exe"
 
 SectionEnd
This page took 0.046092 seconds and 4 git commands to generate.