aboutsummaryrefslogtreecommitdiff
path: root/packages/darwin_app/Makefile
blob: 4efaa70197766ab54394a3e330abe2c2657bb868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379

current: darwin_app

# needed to support weak linking of frameworks
MAKE=MACOSX_DEPLOYMENT_TARGET=10.3 make

CWD := $(shell pwd)
BUILD_BASE = $(CWD)/build
PD_APP_NAME = Pd
PD_APP_CONTENTS = $(BUILD_BASE)/$(PD_APP_NAME).app/Contents
INSTALL_PREFIX = $(PD_APP_CONTENTS)/Resources

SRC_ROOT_DIR = $(CWD)/../..
BUILDLAYOUT_DIR = $(PACKAGES_SRC)

# source for the Wish Shell.app used to build Pd
# download TclTkAquaStandalone-8.?.*.dmg from http://tcltkaqua.sourceforge.net/
# and mount it.  The files will be copied from the mounted .dmg image.
#WISH = /Applications/Utilities/Wish\ Shell.app
TCLTK := $(shell /bin/ls -1r TclTkAquaStandalone-8.?.*.dmg|head -1|sed 's/\.dmg//')
WISH_NAME = Wish\ Shell
WISH = /Volumes/$(TCLTK)/$(WISH_NAME).app
WISH_CONTENTS = $(WISH)/Contents


# locations of the various directories from CVS
SRC_ROOT_DIR = $(CWD)/../..

include ../Makefile.buildlayout

# these are sent to all of the various Makefiles so that they all copy their
# output to the same directory tree
DEST_PATHS = BUILDLAYOUT_DIR=$(BUILDLAYOUT_DIR) \
				SRC_ROOT_DIR=$(SRC_ROOT_DIR) \
				INSTALL_PREFIX=$(INSTALL_PREFIX) \
				UNAME=$(UNAME)

install: darwin_app

#------------------------------------------------------------------------------#
darwin_app: darwin_app_core extended_app_install rez
	@echo " "
	@echo "Pd.app build succeeded!"

#------------------------------------------------------------------------------#
# this target is for when you already have a pre-built Pd.app and you
# just want to fill it with goodies from CVS.  To do so, place your 
# Pd.app in $(BUILD_BASE)/Pd.app
extended_app_install:  extended_install darwin_app_noncvs darwin_app_doc_format


#------------------------------------------------------------------------------#
# check here for a reference on how to do this:
# http://cvs.sourceforge.net/viewcvs.py/tkcvs/tkcvs-proj/PackApp?rev=1.4
darwin_app_wrapper:
	test -d /Volumes/$(TCLTK) || hdiutil mount $(TCLTK).dmg
# copy Wish Shell.app from default install location
# note: use the "standalone" Wish shell to make a "standalone" pd app
	install -d "$(PD_APP_CONTENTS)/MacOS"
	install -m0755 -p \
		$(WISH_CONTENTS)/MacOS/$(WISH_NAME) \
		"$(PD_APP_CONTENTS)/MacOS"
	install -d "$(PD_APP_CONTENTS)/Resources"
	install -m0644 -p \
		$(WISH_CONTENTS)/Resources/Wish\ Shell.rsrc \
		"$(PD_APP_CONTENTS)/Resources"
	install -d "$(PD_APP_CONTENTS)/Frameworks"
	cp -Rp $(WISH_CONTENTS)/Frameworks "$(PD_APP_CONTENTS)"
# set up app wrapper
	install -d "$(PD_APP_CONTENTS)/Resources/Scripts"
	install -m0644 -p Info.plist "$(PD_APP_CONTENTS)"
	install -m0644 -p *.icns  "$(PD_APP_CONTENTS)/Resources"
	mv "$(PD_APP_CONTENTS)/MacOS/Wish Shell" \
		"$(PD_APP_CONTENTS)/MacOS/$(PD_APP_NAME)"
#	diskutil eject /Volumes/$(TCLTK)


#------------------------------------------------------------------------------#
# generate Info.plist using PD_APP_NAME and PD_VERSION
Info.plist: Info.plist.in 


# tigital's Gem window focus black magic
rez:
	install -p $(CWD)/mac.r $(BIN_DEST)
	cd $(BIN_DEST) && /Developer/tools/Rez -t APPL mac.r -o pd


#------------------------------------------------------------------------------#
darwin_app_core: darwin_app_wrapper
	cd $(PACKAGES_SRC) && \
		make $(DEST_PATHS) PD_CONFIGURE_FLAGS=--enable-jack pd_install 
	cd "$(PD_APP_CONTENTS)/Resources/Scripts" && \
		ln -s ../bin/pd.tk AppMain.tcl
# support for Info Panel Plugins mgmt
	cd "$(PD_APP_CONTENTS)" && ln -s Resources/extra Plugins
# run script to move help-*.pd files to *-help.pd according to the standard
	cd $(DOCS_DEST) && \
		$(SCRIPTS_SRC)/convert-help-to-standard.sh



darwin_app_doc_format:
# set the font to 10pt on all help patches
# the BSD/Darwin version of sed must create a backup file when doing 
# in-place replacement, so delete the unneeded backup files
	cd $(DOCS_DEST) && \
		sed -i.bak 's/^\(\#N canvas [0-9]* [0-9]* [0-9]* [0-9]*\) 12/\1 10/' \
			*/*.pd */*/*.pd */*/*/*.pd

#==============================================================================#
#
## CVS SOURCES
#
#==============================================================================#

extended_install:
	cd $(PACKAGES_SRC) && make $(DEST_PATHS) install


#------------------------------------------------------------------------------#
darwin_app_externals: darwin_app_externals_standard darwin_app_externals_c++ darwin_app_externals_flext
#darwin_app_externals: darwin_app_externals_standard darwin_app_externals_c++ darwin_app_externals_gem


#------------------------------------------------------------------------------#
# GEM
darwin_app_externals_gem:
	cd $(GEM_SRC)/Gem && xcodebuild
	install -p -m0644 $(GEM_SRC)/Gem/help/*.* $(HELP_DEST)
	install -d $(DOCS_DEST)/Gem/doc
	install -p -m0644 $(GEM_SRC)/Gem/doc/*.* $(DOCS_DEST)/gem
	install -d $(DOCS_DEST)/Gem/00.manual
	install -p -m0644 $(GEM_SRC)/Gem/manual/*.* $(DOCS_DEST)/gem/00.manual
	cp -Rfp $(GEM_SRC)/Gem/examples/*.* $(GEM_SRC)/Gem/examples/data $(DOCS_DEST)/gem


#------------------------------------------------------------------------------#
darwin_app_externals_flext:
#----------------------------------------------------------------------------
# FLEXT
# temp hack -HCS
	test -f $(EXTERNALS_SRC)/grill/flext/buildsys/mac/pd/config-gcc.def || \
		cp $(EXTERNALS_SRC)/grill/flext/buildsys/mac/pd/config-gcc.def \
			$(EXTERNALS_SRC)/grill/flext/buildsys/config-mac-pd-gcc.txt
# end temp hack
# tigital 8/30/2005 added
	cd $(EXTERNALS_SRC)/grill/flext && \
		( \
        test -f buildsys/config-mac-pd-gcc.txt || \
          ( \
            cp buildsys/mac/pd/config-gcc.def buildsys/config-mac-pd-gcc.txt && \
            echo Copied template sys config file \
          ) \
      ) && \
		( \
			cat buildsys/config-mac-pd-gcc.txt | \
				sed "s/^PDPATH=.*/PDPATH=..\/..\/..\/pd/" > buildsys/config-mac-pd-gcc.txt \
		) && \
		( \
			cat package.txt | sed "s/^PRECOMPILE=.*/PRECOMPILE=/" > package.txt \
		) && \
		( \
			cat buildsys/mac/pd/gnumake-gcc-ext.inc | \
				sed "s/^LDFLAG\S +=.*/LDFLAG\S += -bundle -bundle_loader ..\/..\/..\/pd\/bin\/pd/" > buildsys/mac/pd/gnumake-gcc-ext.inc \
		) && \
			( \
			cat buildsys/mac/pd/gnumake-gcc-flext.inc | \
				sed "s/^LDFLAG\S +=.*/LDFLAG\S += -dynamiclib -undefined dynamic_lookup /" > buildsys/mac/pd/gnumake-gcc-flext.inc \
		) && \
		( \
			test -f config.txt || \
			( \
				cp -f build/config-mac.def config.txt && \
				echo Copied template flext config file \
			) \
		) && \
		MACOSX_DEPLOYMENT_TARGET=10.3 bash build.sh pd gcc build-release-shared FLEXTLIB=@executable_path/../extra FLEXTINC=../flext/source FLEXTSYS=$(OBJECTS_DEST)
	ln -sf $(EXTERNALS_SRC)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(EXTERNALS_SRC)/grill/flext/pd-darwin/release-shared/libflext-pd.dylib
	install -p -m0444 $(EXTERNALS_SRC)/grill/flext/pd-darwin/release-shared/libflext-pd.$(FLEXT_VERSION).dylib $(OBJECTS_DEST)
	ln -sf libflext-pd.$(FLEXT_VERSION).dylib $(OBJECTS_DEST)/libflext-pd.dylib
	install -d $(DOCS_DEST)/tutorials
	cp -rp $(EXTERNALS_SRC)/grill/flext/tutorial $(DOCS_DEST)/tutorials/flext
	install -d $(DOCS_DEST)/flext
	install -p -m0644 $(EXTERNALS_SRC)/grill/flext/gpl.txt  \
		$(EXTERNALS_SRC)/grill/flext/readme.txt   \
		$(EXTERNALS_SRC)/grill/flext/license.txt  \
		$(DOCS_DEST)/flext
# FLEXTERNALS
#########
# dyn~
	cd $(EXTERNALS_SRC)/grill/dynext && bash ../flext/build.sh pd gcc build-release-shared FLEXTLIB=../flext/pd-darwin/release-shared FLEXTINC=../flext/source FLEXTSYS=$(OBJECTS_DEST)
	install -p $(EXTERNALS_SRC)/grill/dynext/pd-darwin/release-shared/*.pd_darwin $(OBJECTS_DEST)
	install -p $(EXTERNALS_SRC)/grill/dynext/pd/*.pd $(DOCS_DEST)
	install -d $(DOCS_DEST)/dynext
	install -p $(EXTERNALS_SRC)/grill/dynext/gpl.txt  \
		$(EXTERNALS_SRC)/grill/dynext/readme.txt   \
		$(EXTERNALS_SRC)/grill/dynext/license.txt  \
		$(DOCS_DEST)/dynext
#########
# pool
	cd $(EXTERNALS_SRC)/grill/pool && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(OBJECTS_DEST) FLEXTINC=../flext/source
	install -p $(EXTERNALS_SRC)/grill/pool/pd-darwin/release-shared/*.pd_darwin $(OBJECTS_DEST)
	install -p $(EXTERNALS_SRC)/grill/pool/help-pool.pd $(DOCS_DEST)
	install -d $(DOCS_DEST)/pool
	install -p $(EXTERNALS_SRC)/grill/pool/gpl.txt \
		$(EXTERNALS_SRC)/grill/pool/readme.txt   \
		$(EXTERNALS_SRC)/grill/pool/license.txt \
		$(DOCS_DEST)/pool
#########
# py/pyext
#	cd $(EXTERNALS_SRC)/grill/py && \
#		( \
#			cp -f build/config-mac.def config.txt \
#		) && \
#		bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(OBJECTS_DEST) FLEXTINC=../flext/source
#	install -p -m0444 $(EXTERNALS_SRC)/grill/py/pd-darwin/release-shared/*.pd_darwin $(OBJECTS_DEST)
# this wasn't building for me -HCS 2005-06-09
	install -d $(DOCS_DEST)/py/examples
	install -d $(DOCS_DEST)/py/scripts
	install -p $(EXTERNALS_SRC)/grill/py/pd/*.pd $(DOCS_DEST)/py/examples
	install -p $(EXTERNALS_SRC)/grill/py/scripts/*.py $(DOCS_DEST)/py/scripts
	install -p $(EXTERNALS_SRC)/grill/py/gpl.txt  \
		$(EXTERNALS_SRC)/grill/py/readme.txt $(EXTERNALS_SRC)/grill/py/license.txt \
		$(DOCS_DEST)/py
#	install -d $(INSTALL_PREFIX)/Library/Frameworks
#	cp -R /Library/Frameworks/Python.framework $(INSTALL_PREFIX)/Library/Frameworks
#########
# vasp
#  fails without the dir
#	test -d ../../vasp/pd-darwin || mkdir -p ../../vasp/pd-darwin 
#	cd $(EXTERNALS_SRC)/grill/vasp/ && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(OBJECTS_DEST) FLEXTINC=../flext/source
#	install -p -m0444 $(EXTERNALS_SRC)/grill/vasp/pd-darwin/release-shared/*.pd_darwin $(OBJECTS_DEST)
# this wasn't building for me -HCS 2005-06-09
	install -p -m0644 $(EXTERNALS_SRC)/grill/vasp/pd-help/*.pd $(DOCS_DEST)
	install -d $(DOCS_DEST)/vasp
	install -p -m0644 $(EXTERNALS_SRC)/grill/vasp/gpl.txt  \
		$(EXTERNALS_SRC)/grill/vasp/readme.txt   \
		$(EXTERNALS_SRC)/grill/vasp/license.txt  \
		$(EXTERNALS_SRC)/grill/vasp/changes.txt  \
		$(EXTERNALS_SRC)/grill/vasp/todo.txt     \
		$(DOCS_DEST)/vasp
	cp -rp $(EXTERNALS_SRC)/grill/vasp/pd-ex $(DOCS_DEST)/vasp
#########
# xsample
	cd $(EXTERNALS_SRC)/grill/xsample && bash ../flext/build.sh pd gcc build-release-shared FLEXTPREFIX=. FLEXTLIB=$(OBJECTS_DEST) FLEXTINC=../flext/source
	install -p -m0444 $(EXTERNALS_SRC)/grill/xsample/pd-darwin/release-shared/*.pd_darwin $(OBJECTS_DEST)
	install -p -m0644 $(EXTERNALS_SRC)/grill/xsample/pd/*.pd $(DOCS_DEST)
	install -d $(DOCS_DEST)/xsample
	install -p -m0644 $(EXTERNALS_SRC)/grill/xsample/gpl.txt \
		$(EXTERNALS_SRC)/grill/xsample/readme.txt \
		$(EXTERNALS_SRC)/grill/xsample/license.txt \
		$(DOCS_DEST)/xsample
########## FOOTILS #########
# syncgrain
#	cd $(EXTERNALS_SRC)/footils/syncgrain/ && $(MAKE) -f makefile.pd-darwin
#	install -p -m0444 $(EXTERNALS_SRC)/footils/syncgrain/pd-darwin/*.pd_darwin \
#		$(OBJECTS_DEST)
	install -p -m0644 $(EXTERNALS_SRC)/footils/syncgrain/pd/*.* $(DOCS_DEST)




darwin_app_externals_c++:
#----------------------------------------------------------------------------
# CREB
#	cd $(EXTERNALS_SRC)/creb && autoconf && ./configure && cd modules++ && $(MAKE)
#	install -p -m0644 $(EXTERNALS_SRC)/creb/modules++/*.pd_darwin $(OBJECTS_DEST)
#----------------------------------------------------------------------------
# gem2pdp
#	cd $(EXTERNALS_SRC)/gem2pdp && $(MAKE) -f Makefile.darwin
#	install -p -m0444 $(EXTERNALS_SRC)/gem2pdp/*.pd_darwin $(OBJECTS_DEST)
#----------------------------------------------------------------------------
# GridFlow
#	cd ../../gridflow && ./configure && $(MAKE)


darwin_app_noncvs:
	test -d noncvs/doc/5.reference && \
		install -p noncvs/doc/5.reference/*.* $(HELP_DEST)
	test -d noncvs/extra && install -p noncvs/extra/*.* $(OBJECTS_DEST)
	test -d noncvs/doc/serendipd && cp -Rp noncvs/doc/serendipd \
		$(APPLICATIONS_DEST)

darwin_app_perms:
	chmod a-x $(DOCS_DEST)/*/*.pd $(DOCS_DEST)/*/*/*.pd $(DOCS_DEST)/*/*/*/*.pd
	chmod -R a-w $(DOCS_DEST)
# serendiPd shared patch
	test -d $(APPLICATIONS_DEST)/serendipd && \
		chmod a+w $(APPLICATIONS_DEST)/serendipd/*shared_patch.pd

dmg: darwin_app_perms
	install -d "$(CWD)/$(DMG_NAME)"
	cd $(BUILD_BASE) && mv $(PD_APP_NAME).app "$(CWD)/$(DMG_NAME)/$(DMG_NAME).app"
#	install -p -m0444 $(MANUALS_DEST)/$(PD_NAME)/PD\ LICENSE.txt \
#		$(MANUALS_DEST)/*.html "$(CWD)/$(DMG_NAME)"
	install -p -m0444 org.puredata.pd.plist "$(CWD)/$(DMG_NAME)"
	cd $(CWD) && /bin/sh mkdmg "$(DMG_NAME)"


clean: darwin_app_clean darwin_app_externals_standard_clean darwin_pd_clean
clean: darwin_app_externals_gem_clean darwin_app_externals_flext_clean

darwin_pd_clean:
	cd $(PD_SRC)/src/ && make clean

darwin_app_clean:
	-sudo rm -Rf -- $(BUILD_BASE) "$(DMG_NAME)" 
	-rm -f -- *~ 1 $(README_FILE) $(WELCOME_FILE) $(LICENSE_FILE) \
		$(UNIX_PACKAGE_NAME).pkg  "$(DMG_NAME).dmg"

darwin_app_externals_standard_clean:
	cd $(EXTERNALS_SRC)/build/darwin && make clean
	cd $(EXTERNALS_SRC)/hcs/hid && make clean

darwin_app_externals_gem_clean:
	cd $(GEM_SRC)/Gem && xcodebuild clean

darwin_app_externals_flext_clean:
	cd $(EXTERNALS_SRC)/footils/syncgrain && make -f makefile.pd-darwin clean
	-cd $(EXTERNALS_SRC)/grill && \
		rm -- flext/buildsys/config-mac-pd-gcc.txt config.txt flext/config.txt \
			flext/source/libflext.a */pd-darwin/*.o */pd-darwin/*/*.o \
		 	*/pd-darwin/*/*.pd_darwin */pd-darwin/*.pd_darwin \
			*/pd-darwin/release-shared/*.dylib */pd-darwin/release-shared/*.opp



#==============================================================================#
#
## DEPRECATED TARGETS
#
#==============================================================================#

darwin_app_externals:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd $(EXTERNALS_SRC) && make install"

darwin_app_externals_standard:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd $(EXTERNALS_SRC) && make install"

darwin_patch_pd:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd .. && make patch_pd"

darwin_unpatch_pd:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd .. && make unpatch_pd"

darwin_app_docs:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd $(DOC_SRC) && make install"

darwin_app_license:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd .. && make license"

darwin_app_welcome:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd .. && make welcome"

darwin_app_readme:
	@echo " "
	@echo "Deprecated!!" 
	@echo "cd .. && make readme"

darwin_prebuilt_app:
	@echo " "
	@echo "Deprecated!!" 
	@echo "Use make extended_app_install"