New Apple OS X application bundle based on work done for GtkRadiant 1.6.4. Produces...
[xonotic/netradiant.git] / setup / data / osx / Makefile
1 # Makefile for NetRadiant.app, requires http://macdylibbundler.sourceforge.net/
2
3 INSTALL = ../../../install
4 TARGET = target
5 RESOURCES = $(TARGET)/NetRadiant.app/Contents/Resources
6 BINDIR = $(RESOURCES)/install
7 CONFDIR = $(RESOURCES)/etc
8 DATADIR = $(RESOURCES)/share
9 LIBDIR = $(RESOURCES)/lib
10 VERSION = 1.5.0
11 DMG = $(TARGET)/NetRadiant-$(VERSION).dmg
12 VOLUME_NAME = "NetRadiant $(VERSION)"
13
14 # We must rewrite some Gtk configuration files, which vary from environment to
15 # environment depending on where you've installed MacPorts. Fun!
16
17 MACPORTS_PREFIX := $(shell which port | sed 's:/bin/port::')
18 PREFIX_SED_EXPR = "s:$(MACPORTS_PREFIX):@executable_path/..:g"
19
20 all: install bundle
21
22 -pre-install:
23         install -d $(TARGET)
24         cp -r NetRadiant.app $(TARGET)
25         find $(TARGET) -name .turd -delete
26         
27 -gtk-runtime-gdk-pixbuf-2.0:
28         cp -r $(MACPORTS_PREFIX)/lib/gdk-pixbuf-2.0 $(LIBDIR)
29         find $(LIBDIR)/gdk-pixbuf-2.0 -type f ! -name "*.so" -delete
30         
31         gdk-pixbuf-query-loaders | sed $(PREFIX_SED_EXPR) > \
32                 $(CONFDIR)/gtk-2.0/gdk-pixbuf.loaders
33
34 -gtk-runtime-pango:
35         cp -r $(MACPORTS_PREFIX)/lib/pango $(LIBDIR)
36         find $(LIBDIR)/pango -type f ! -name "*.so" -delete
37         
38         pango-querymodules | sed $(PREFIX_SED_EXPR) > \
39                 $(CONFDIR)/pango/pango.modules
40         
41 -gtk-runtime: -gtk-runtime-gdk-pixbuf-2.0 -gtk-runtime-pango
42         cp -r $(MACPORTS_PREFIX)/lib/gtk-2.0 $(LIBDIR)
43         find $(LIBDIR)/gtk-2.0 -type f ! -name "*.so" -delete   
44         
45         rm -rf $(LIBDIR)/gtk-2.0/{includes,modules}
46         rm -rf $(LIBDIR)/gtk-2.0/*/printbackends
47         
48         cp -r $(MACPORTS_PREFIX)/share/themes/Default $(RESOURCES)/share
49         
50         gtk-query-immodules-2.0 | sed $(PREFIX_SED_EXPR) > \
51                 $(CONFDIR)/gtk-2.0/gtk.immodules
52
53 install: -pre-install -gtk-runtime
54         cp -r $(INSTALL) $(RESOURCES)
55         #rm -rf `find $(INSTDIR)/installs -type d -name .svn`
56
57 bundle:
58         
59         # The Radiant plugins (modules) are a little funky
60         # Some of them are actually linked against the build directory
61         
62         test -L install || ln -s $(INSTALL)
63         
64         dylibbundler -b \
65                 -x $(BINDIR)/radiant \
66                 -x $(BINDIR)/q2map \
67                 -x $(BINDIR)/q3data \
68                 -x $(BINDIR)/q3map2 \
69                 -x $(BINDIR)/qdata3 \
70                 `find $(BINDIR)/modules -name "*.dylib" | xargs -I {} echo -x {}` \
71                 `find $(LIBDIR) -name "*.dylib" | xargs -I {} echo -x {}` \
72         -d $(LIBDIR) -of -p @executable_path/../lib
73         
74         rm -f install
75
76 image:
77         find $(TARGET) -name .DS_Store -delete
78         ln -f -s /Applications $(TARGET)/Applications
79         hdiutil create -ov $(DMG) -srcfolder $(TARGET) -volname $(VOLUME_NAME)
80         rm $(TARGET)/Applications
81
82 clean:
83         rm -rf $(TARGET)/*