Skip to content

Commit

Permalink
glob2: Update to 0.9.4.4 and fix many problems
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandesign committed Oct 18, 2018
1 parent 0671808 commit 865d6d2
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 70 deletions.
87 changes: 61 additions & 26 deletions games/glob2/Portfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name glob2
version 0.9.3
revision 10
version 0.9.4.4
checksums rmd160 c0f1c2534eeb95bb901bc61a462495183f191be2 \
sha256 0f4d898ec6b05ce27b4a12ef242cc26571304b90d2509932a4743c71311314b8 \
size 11338986

set branch [join [lrange [split ${version} .] 0 2] .]
categories games
license GPL-3+
platforms darwin
maintainers nomaintainer
maintainers {ryandesign @ryandesign} openmaintainer

description Globulation 2 - a free and innovative strategy game

long_description Globulation 2 is an innovative high quality Real-Time \
Strategy, which minimizes micro-management by \
automatically assigning tasks to the units. The player \
Expand All @@ -20,15 +28,15 @@ long_description Globulation 2 is an innovative high quality Real-Time \
features a scripting language for versatile gameplay or \
tutorials and an integrated map editor.

homepage http://globulation2.org/
master_sites http://dl.sv.nongnu.org/releases/glob2/${version}/
checksums md5 e0483d5864cff4ace5ac8e39eae27429 \
sha1 669a43707cf03e4e810e77ef8bef2f46f1116090 \
rmd160 266edd6a57f1e8ea8e1effac3871f3c0083fc05f
homepage https://globulation2.org
master_sites http://dl.sv.nongnu.org/releases/glob2/${branch}/

depends_build port:pkgconfig \
port:scons

depends_build port:scons
depends_lib port:boost \
port:freetype \
port:fribidi \
port:jpeg \
port:libiconv \
port:libogg \
Expand All @@ -37,33 +45,60 @@ depends_lib port:boost \
port:libsdl_image \
port:libsdl_net \
port:libsdl_ttf \
port:libvorbis\
port:libvorbis \
port:portaudio \
path:lib/libspeex.dylib:speex \
port:tiff \
port:zlib

patchfiles patch-SConstruct.diff
pre-patch {
# Files missing in tarball; downloaded from
# https://bitbucket.org/giszmo/glob2/src/7f98290bab5c5f5c4194b2aa7ae26c992ccef6d1/darwin/
# with these changes to the Info.plist:
# * CFBundleVersion changed from hardcoded outdated version to @VERSION@
# * CFBundleShortVersionString added
# * NSHighResolutionCapable added
xinstall -d ${worksrcpath}/darwin
xinstall -W ${filespath} -m 0644 Glob2.icns Info.plist ${worksrcpath}/darwin
reinplace "s|@VERSION@|${version}|g" ${worksrcpath}/darwin/Info.plist
}

patchfiles-append BuildProject.patch
patchfiles-append bundle.patch
patchfiles-append CoreFoundation.patch
patchfiles-append iostream.patch
patchfiles-append SConstruct.patch

use_configure no

set buildoptions "BINDIR=\"${destroot}${prefix}/bin\" \
INSTALLDIR=\"${destroot}${prefix}/share\" \
DATADIR=\"${prefix}/share/glob2\" \
CXXFLAGS=\"-I${prefix}/include\" \
LINKFLAGS=\"-L${prefix}/lib\""

pre-build {
# The destroot directories must be created here so scons can find them
# during the build.
xinstall -d ${destroot}${prefix}/bin
xinstall -d ${destroot}${prefix}/share
}
variant universal {}

build.cmd ${prefix}/bin/scons
build.target $buildoptions
build.target
build.args --portaudio=true \
CC="${configure.cc}" \
CXX="${configure.cxx}" \
CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \
LINKFLAGS="${configure.ldflags} [get_canonical_archflags ld]"

# The SConscript makes a Mac app bundle when release=1, but incorrectly
# attempts to do so before building anything, which of course fails.
# So don't use release=1 in the build phase, but do use it in destroot.
destroot.target
destroot.args {*}${build.args} \
release=1

destroot.target "install $buildoptions"
post-destroot {
move ${worksrcpath}/Glob2.app ${destroot}${applications_dir}

# Using a symlink doesn't work because the app can't find its data files.
set fp [open ${destroot}${prefix}/bin/glob2 w 0755]
puts ${fp} "#!/bin/sh"
puts ${fp} "exec \"${applications_dir}/Glob2.app/Contents/MacOS/glob2\" \"$@\""
close ${fp}
}

livecheck.type regex
livecheck.url http://globulation2.org/wiki/Download_and_Install
livecheck.url ${homepage}/wiki/Download_and_Install
livecheck.regex /${name}-(\[0-9.\]+)${extract.suffix}
22 changes: 22 additions & 0 deletions games/glob2/files/BuildProject.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Make Game::BuildProject public to fix "error: 'BuildProject' is a private
member of 'Game'".
https://savannah.nongnu.org/bugs/?47070
https://bitbucket.org/giszmo/glob2/commits/c4da01699846179d8bf21e8dae2b973158ec0775
--- src/Game.h.orig 2009-08-29 15:39:06.000000000 -0500
+++ src/Game.h 2018-10-17 20:39:14.000000000 -0500
@@ -149,6 +149,7 @@
BOTTOM_TO_TOP
};

+public:
struct BuildProject
{
int posX;
@@ -159,6 +160,7 @@
int unitWorkingFuture;
};

+private:
///Initiates Game
void init(GameGUI *gui, MapEdit* edit);

14 changes: 14 additions & 0 deletions games/glob2/files/CoreFoundation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Include CoreFoundation instead of Carbon since this code only uses
CoreFoundation stuff, and including Carbon plus "using namespace boost"
causes "error: reference to 'Collection' is ambiguous".
--- src/Glob2.cpp.orig 2009-08-29 15:39:06.000000000 -0500
+++ src/Glob2.cpp 2018-10-17 21:37:30.000000000 -0500
@@ -62,7 +62,7 @@
#endif

#ifdef __APPLE__
-# include <Carbon/Carbon.h>
+# include <CoreFoundation/CoreFoundation.h>
# include <sys/param.h>
#endif

Binary file added games/glob2/files/Glob2.icns
Binary file not shown.
26 changes: 26 additions & 0 deletions games/glob2/files/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>glob2</string>
<key>CFBundleIconFile</key>
<string>Glob2.icns</string>
<key>CFBundleIdentifier</key>
<string>com.globulation2.Glob2</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Glob2</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@VERSION@</string>
<key>CFBundleVersion</key>
<string>@VERSION@</string>
<key>NSAppleScriptEnabled</key>
<string>NO</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
98 changes: 98 additions & 0 deletions games/glob2/files/SConstruct.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Allow CC, CXX, and CFLAGS to be specified.

Add linking with boost_system and fix linking with boost_date_time.
https://savannah.nongnu.org/bugs/?39593

Look for dependencies in PATH.

Do not add Fink library and include paths.

Fix finding fribidi.

Do not remove duplicate flags when calling env.ParseConfig, as that turns the
"-arch x86_64 -arch i386" we pass when building universal into
"x86_64 -arch i386" resulting in "error: no such file or directory: 'x86_64'".

Exit after building the bundle, before building the dmg and rebuilding sources.
--- SConstruct.orig 2009-08-30 14:23:30.000000000 -0500
+++ SConstruct 2018-10-18 00:39:21.000000000 -0500
@@ -14,6 +14,9 @@

def establish_options(env):
opts = Options('options_cache.py')
+ opts.Add("CC", "Manually set the C compiler", "cc")
+ opts.Add("CXX", "Manually set the C++ compiler", "c++")
+ opts.Add("CFLAGS", "Manually add to the CFLAGS", "-g")
opts.Add("CXXFLAGS", "Manually add to the CXXFLAGS", "-g")
opts.Add("LINKFLAGS", "Manually add to the LINKFLAGS", "-g")
if isDarwinPlatform:
@@ -120,13 +123,23 @@
missing.append("libboost_thread")
env.Append(LIBS=[boost_thread])

+ boost_system = ''
+ if conf.CheckLib("boost_system"):
+ boost_system="boost_system"
+ elif conf.CheckLib("boost_system-mt"):
+ boost_system="boost_system-mt"
+ else:
+ print "Could not find libboost_system or libboost_system-mt"
+ missing.append("libboost_system")
+ env.Append(LIBS=[boost_system])
+
boost_date_time = ''
if conf.CheckLib("boost_date_time") and conf.CheckCXXHeader("boost/date_time/posix_time/posix_time.hpp"):
- boost_thread="boost_thread"
+ boost_date_time="boost_date_time"
elif conf.CheckLib("boost_date_time-mt") and conf.CheckCXXHeader("boost/date_time/posix_time/posix_time.hpp"):
- boost_thread="boost_thread-mt"
+ boost_date_time="boost_date_time-mt"
else:
- print "Could not find libboost_date_time or libboost_date_time-mt or boost/thread/thread.hpp"
+ print "Could not find libboost_date_time or libboost_date_time-mt or boost/date_time/posix_time/posix_time.hpp"
missing.append("libboost_date_time")
env.Append(LIBS=[boost_date_time])

@@ -225,7 +238,7 @@
action='store',
metavar='portaudio',
help='should portaudio be used')
- env = Environment()
+ env = Environment(ENV = {'PATH' : os.environ['PATH']})
try:
env.Clone()
except AttributeError:
@@ -241,11 +254,10 @@
if env['mingw'] or isWindowsPlatform:
env.Append(LIBPATH=["C:/msys/1.0/local/lib", "C:/msys/1.0/lib"])
env.Append(CPPPATH=["C:/msys/1.0/local/include/SDL", "C:/msys/1.0/local/include", "C:/msys/1.0/include/SDL", "C:/msys/1.0/include"])
- if isDarwinPlatform:
- env.Append(LIBPATH=["/sw/lib"])
- env.Append(CPPPATH=["/sw/include"])
- configure(env)
env.Append(CPPPATH=['#libgag/include', '#'])
+ env.ParseConfig("pkg-config fribidi --cflags", None, False)
+ env.ParseConfig("pkg-config fribidi --libs", None, False)
+ configure(env)
if env['release']:
env.Append(CXXFLAGS=' -O2')
env.Append(LINKFLAGS=' -O2')
@@ -261,8 +273,8 @@
env.Append(CPPPATH=['/usr/local/include/SDL'])
env.Append(CPPDEFINES=['-D_GNU_SOURCE=1', '-Dmain=SDL_main'])
else:
- env.ParseConfig("sdl-config --cflags")
- env.ParseConfig("sdl-config --libs")
+ env.ParseConfig("sdl-config --cflags", None, False)
+ env.ParseConfig("sdl-config --libs", None, False)
env.Append(LIBS=['vorbisfile', 'SDL_ttf', 'SDL_image', 'SDL_net', 'speex'])

env["TARFILE"] = env.Dir("#").abspath + "/glob2-" + env["VERSION"] + ".tar.gz"
@@ -296,6 +307,7 @@
BUNDLE_PLIST="darwin/Info.plist",
BUNDLE_ICON="darwin/Glob2.icns" )
bundle.createBundle(os.getcwd(), os.getcwd(), env)
+ Exit(0)
dmg.create_dmg("Glob2-%s"%env["VERSION"],"%s.app"%env["BUNDLE_NAME"],env)

#TODO mac_bundle should be dependency of Dmg:
12 changes: 12 additions & 0 deletions games/glob2/files/bundle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Do not copy libraries into app bundle.
--- scons/bundle.py.orig 2009-06-14 05:11:34.000000000 -0500
+++ scons/bundle.py 2018-10-18 00:26:09.000000000 -0500
@@ -30,8 +30,6 @@
# add icon -- TODO generate .icns file from png or svg
iconFile = env['BUNDLE_ICON']
run('cp %s %s/Contents/Resources' % (iconFile, bundleDir) )
- # add dependent libraries, fixing all absolute paths
- addDependentLibsToBundle( bundleDir )


def createBundleMessage(target, source, env) :
13 changes: 13 additions & 0 deletions games/glob2/files/iostream.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
The code uses iostream, not stdio.h. Failing to include iostream
causes "error: no member named 'cout' in namespace 'std'".
--- src/VoiceRecorder.cpp.orig 2009-08-29 15:39:06.000000000 -0500
+++ src/VoiceRecorder.cpp 2018-10-17 21:46:33.000000000 -0500
@@ -21,7 +21,7 @@

#include "VoiceRecorder.h"
#include <assert.h>
-#include <stdio.h>
+#include <iostream>
#include "Order.h"
#include "Utilities.h"

44 changes: 0 additions & 44 deletions games/glob2/files/patch-SConstruct.diff

This file was deleted.

0 comments on commit 865d6d2

Please sign in to comment.