-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·296 lines (277 loc) · 13.5 KB
/
configure
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
#!/bin/bash
# -----------------------------------------------
# configure
#
# an autoconf-like configure script to allow the standard
# > ./configure; make commands to be used to build PDG
#
# Written by Ed Zavada, 2012
# Copyright (c) 2012, Dream Rock Studios, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the
# following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
# USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# -----------------------------------------------
PLATFORM=`uname -s | awk '{print tolower($0)}'`
if [ "$1" == "--help" ]; then
echo "Configure Options: "
echo " --help - this page"
echo " --with-glfw-mac - use GLFW to manage windows on Mac OS X builds"
exit 0
fi
USE_GLFW="yes"
GLFW_TARG="glfw"
BUILD_JAVASCRIPTCORE="no"
BUILD_IOS="no"
CMAKE_OPTIONS=""
if [ "$PDG_ROOT" == "" ]; then
PDG_ROOT=`pwd`
fi
if [ "$PLATFORM" == "darwin" ]; then
if [ "$1" == "--with-glfw-mac" ]; then
CMAKE_OPTIONS="-D USE_GLFW_MAC=ON"
else
USE_GLFW="no"
GLFW_TARG=""
fi
if [ -d "deps/javascriptcore" ]; then
BUILD_JAVASCRIPTCORE="yes"
fi
if [ -d "ios/pdg.xcodeproj" ]; then
BUILD_IOS="yes"
fi
fi
command_exists () {
type "$1" &> /dev/null ;
}
if command_exists bcpp ; then
CAN_BUILD_INTERFACES="yes"
CMAKE_OPTIONS="-D CAN_BUILD_INTERFACES=ON $CMAKE_OPTIONS"
else
CAN_BUILD_INTERFACES="no"
fi
echo "Cleaning up old junk..."
rm -rf test/node_modules
echo "Setting up Paths..."
echo "# This file automatically generated by configure script" > .pdgrc
echo "" >> .pdgrc
echo "export PDG_ROOT=$PDG_ROOT" >> .pdgrc
echo "export PDG_NODE=$PDG_ROOT/tools/node" >> .pdgrc
echo "export PDG_NODE_GYP=$PDG_ROOT/tools/node-gyp" >> .pdgrc
echo "export PDG_NPM=$PDG_ROOT/tools/npm" >> .pdgrc
echo "export PDG_JASMINE_NODE=$PDG_ROOT/tools/jasmine-node" >> .pdgrc
echo "export PDG_NODE_INSPECTOR=$PDG_ROOT/tools/node-inspector" >> .pdgrc
echo "export PATH=$PDG_ROOT/tools:\$PATH" >> .pdgrc
echo "source $PDG_ROOT/tools/colors.sh" >> .pdgrc
echo "-- created .pdgrc"
echo "# This file automatically generated by configure script" > .pdgrc.mak
echo "" >> .pdgrc.mak
echo "export PDG_ROOT=$PDG_ROOT" >> .pdgrc.mak
echo "PDG_NODE=$PDG_ROOT/tools/node" >> .pdgrc.mak
echo "PDG_NODE_GYP=$PDG_ROOT/tools/node-gyp" >> .pdgrc.mak
echo "PDG_NPM=$PDG_ROOT/tools/npm" >> .pdgrc.mak
echo "PDG_JASMINE_NODE=$PDG_ROOT/tools/jasmine-node" >> .pdgrc.mak
echo "PDG_NODE_INSPECTOR=$PDG_ROOT/tools/node-inspector" >> .pdgrc.mak
echo "export PATH:=$PDG_ROOT/tools:\$(PATH)" >> .pdgrc.mak
echo "-- created .pdgrc.mak"
CMAKE_INFO=`cmake -version`
CMAKE_INFO=(${CMAKE_INFO// / })
CMAKE_VERS=${CMAKE_INFO[2]}
CMAKE_PATH=`which cmake`
if [ "$CMAKE_INFO" == "cmake" ]; then
echo "Configuring PDG..."
echo "-- Found CMake v$CMAKE_VERS: $CMAKE_PATH - OK"
rm -rf build/$PLATFORM
mkdir -p build/$PLATFORM/chipmunk
mkdir -p build/$PLATFORM/glfw
cp LICENSE tools/node-pdg/LICENSE
if [ "$CAN_BUILD_INTERFACES" == "yes" ]; then
BCPP_PATH=`which bcpp`
echo "-- Checking for C++ Pretty Print: $BCPP_PATH - OK"
else
echo "-- Checking for C++ Pretty Print - NOT FOUND"
echo " (Build and install tools/bcpp.tar.zip to support rebuilding JavaScript bindings)"
fi
echo "Configuring Chipmunk Library..."
cd build/$PLATFORM/chipmunk
cmake -D BUILD_DEMOS=OFF ../../../deps/chipmunk
cd ../../../
# if [ "$USE_GLFW" == "yes" ]; then
echo "Configuring GLFW Library..."
cd build/$PLATFORM/glfw
cmake -D GLFW_BUILD_EXAMPLES=OFF -D GLFW_BUILD_TESTS=OFF ../../../deps/glfw
cd ../../../
# fi
echo "Configuring Node.js Library..."
cd deps/node
./configure
cd ../../
# mkdir -p node_modules
echo "Building Master Makefile..."
echo "# This file automatically generated by configure script" > Makefile
echo "" >> Makefile
echo "include .pdgrc.mak" >> Makefile
echo "" >> Makefile
# if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
# echo "all: pdg node-pdg jsc" >> Makefile
# else
echo "all: pdg pdg-node" >> Makefile
# fi
echo "" >> Makefile
echo "pdg: $GLFW_TARG chipmunk node" >> Makefile
echo " cd \$(PDG_ROOT)/build; make" >> Makefile
if [ "$PLATFORM" == "darwin" ]; then
echo " ln -sf \$(PDG_ROOT)/build/src/pdg.app/Contents/MacOS/pdg \$(PDG_ROOT)/pdg" >> Makefile
echo " ln -sf \$(PDG_ROOT)/build/src/pdg.app/Contents/MacOS/pdg \$(PDG_ROOT)/test/pdg" >> Makefile
echo " cp -f \$(PDG_ROOT)/tools/debug.html \$(PDG_ROOT)/build/src/pdg.app/Contents/MacOS/" >> Makefile
# echo " ln -sf \$(PDG_ROOT)/test/js \$(PDG_ROOT)/build/src/pdg.app/Contents/MacOS/js" >> Makefile
else
echo " ln -sf \$(PDG_ROOT)/build/src/pdg \$(PDG_ROOT)/pdg" >> Makefile
echo " ln -sf \$(PDG_ROOT)/build/src/pdg \$(PDG_ROOT)/test/pdg" >> Makefile
echo " cp -f \$(PDG_ROOT)/tools/debug.html \$(PDG_ROOT)/build/src/" >> Makefile
# echo " ln -sf \$(PDG_ROOT)/test/js \$(PDG_ROOT)/build/src/js" >> Makefile
fi
if [ "$CAN_BUILD_INTERFACES" == "yes" ]; then
echo " \$(PDG_ROOT)/tools/make-idl-javascript.sh" >> Makefile
fi
echo "" >> Makefile
echo "pdg-node: node-modules" >> Makefile
echo " \$(PDG_ROOT)/tools/copy-node-module-source.sh \$(PDG_ROOT)/build/node-pdg" >> Makefile
echo " cd \$(PDG_ROOT)/build/node-pdg; \$(PDG_NPM) pack" >> Makefile
echo " @ls -al \$(PDG_ROOT)/build/node-pdg/pdg*.tgz" >> Makefile
echo " cd \$(PDG_ROOT); \$(PDG_NPM) install \$(shell ls \$(PDG_ROOT)/build/node-pdg/pdg*.tgz)" >> Makefile
echo " cd \$(PDG_ROOT); \$(PDG_NPM) list pdg" >> Makefile
echo "" >> Makefile
if [ "$BUILD_IOS" == "yes" ]; then
echo "#!/bin/bash" > test/ios
echo "open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\\ Simulator.app -F -a \$(PDG_ROOT)/ios/pdg-js-sim.app" >> test/ios
chmod 755 test/ios
if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
echo "pdg-ios: jsc" >> Makefile
else
echo "pdg-ios:" >> Makefile
fi
echo " @\$(PDG_ROOT)/tools/pretty_xcodebuild.py -configuration Debug -project \$(PDG_ROOT)/ios/pdg.xcodeproj -target pdg-js -sdk iphonesimulator" >> Makefile
echo " @\$(PDG_ROOT)/tools/pretty_xcodebuild.py -project \$(PDG_ROOT)/ios/pdg.xcodeproj -target pdg-js -sdk iphoneos -arch \"armv6 armv7\" CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO" >> Makefile
echo " @ln -sf \$(PDG_ROOT)/build/Debug-iphonesimulator/pdg-js.app \$(PDG_ROOT)/ios/pdg-js-sim.app" >> Makefile
echo " @ln -sf \$(PDG_ROOT)/build/Release-iphoneos/pdg-js.app \$(PDG_ROOT)/ios/pdg-js.app" >> Makefile
echo "" >> Makefile
fi
if [ "$CAN_BUILD_INTERFACES" == "yes" ]; then
echo "js-interfaces:" >> Makefile
echo " cd \$(PDG_ROOT)/build; make pdg_js2native" >> Makefile
echo " cd \$(PDG_ROOT)/build; make pdg_common_interfaces" >> Makefile
echo " cd \$(PDG_ROOT)/build; make pdg_v8_interfaces" >> Makefile
if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
echo " cd \$(PDG_ROOT)/build; make pdg_jsc_interfaces" >> Makefile
fi
fi
echo "" >> Makefile
echo "fix-interface-timestamps:" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/v8/pdg_script_impl.h" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/v8/pdg_script_impl.cpp" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/v8/pdg_interfaces.cpp" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/v8/pdg_script_interface.h" >> Makefile
if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
echo " touch \$(PDG_ROOT)/src/bindings/javascript/jsc/pdg_script_impl.h" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/jsc/pdg_script_impl.cpp" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/jsc/pdg_interfaces.cpp" >> Makefile
echo " touch \$(PDG_ROOT)/src/bindings/javascript/jsc/pdg_script_interface.h" >> Makefile
fi
echo "" >> Makefile
if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
echo "jsc:" >> Makefile
echo " @\$(PDG_ROOT)/tools/pretty_xcodebuild.py -configuration Debug -project \$(PDG_ROOT)/deps/javascriptcore/JavaScriptCore.xcodeproj -target iOSJavaScriptCore -sdk iphoneos" >> Makefile
echo " @\$(PDG_ROOT)/tools/pretty_xcodebuild.py -configuration Debug -project \$(PDG_ROOT)/deps/javascriptcore/JavaScriptCore.xcodeproj -target iOSJavaScriptCore -sdk iphonesimulator" >> Makefile
echo " @\$(PDG_ROOT)/tools/pretty_xcodebuild.py -project \$(PDG_ROOT)/deps/javascriptcore/JavaScriptCore.xcodeproj -target iOSJavaScriptCore -sdk iphoneos -arch \"armv6 armv7\"" >> Makefile
echo " @tools/pretty_xcodebuild.py -project \$(PDG_ROOT)/deps/javascriptcore/JavaScriptCore.xcodeproj -target iOSJavaScriptCore -sdk iphonesimulator" >> Makefile
echo " @cd \$(PDG_ROOT)/build/javascriptcore; lipo -create Production-iphoneos/libiOSJavaScriptCore.a Production-iphonesimulator/libiOSJavaScriptCore.a -output libiOSJavaScriptCore.a" >> Makefile
echo " @cd \$(PDG_ROOT)/build/javascriptcore; lipo -create Debug-iphoneos/libiOSJavaScriptCore.a Debug-iphonesimulator/libiOSJavaScriptCore.a -output libiOSJavaScriptCore-Debug.a" >> Makefile
echo " @ln -sf Production-iphoneos/JavaScriptCore \$(PDG_ROOT)/build/javascriptcore/JavaScriptCore" >> Makefile
echo " @echo \"JavaScriptCore Libraries Built in \$(PDG_ROOT)/build/javascriptcore/:\"" >> Makefile
echo " @ls -al \$(PDG_ROOT)/build/javascriptcore/libiOSJavaScriptCore*.a" >> Makefile
echo "" >> Makefile
fi
echo "node:" >> Makefile
echo " cd \$(PDG_ROOT)/deps/node; V=\"\" make node; V=\"\" make -C out nodelib" >> Makefile
echo " cp \$(PDG_ROOT)/deps/node/out/Release/node \$(PDG_ROOT)/tools/" >> Makefile
echo "" >> Makefile
echo "node-modules: node" >> Makefile
echo " \$(PDG_ROOT)/tools/install-node-modules.sh " >> Makefile
echo "" >> Makefile
echo "chipmunk:" >> Makefile
echo " cd \$(PDG_ROOT)/build/$PLATFORM/chipmunk; make chipmunk_static" >> Makefile
echo "" >> Makefile
echo "glfw:" >> Makefile
echo " cd \$(PDG_ROOT)/build/$PLATFORM/glfw; make glfw" >> Makefile
echo "" >> Makefile
echo "superclean:" >> Makefile
echo " rm -rf \$(PDG_ROOT)/build \$(PDG_ROOT)/xcode \$(PDG_ROOT)/msvc \$(PDG_ROOT)/package \$(PDG_ROOT)/Makefile \$(PDG_ROOT)/pdg" >> Makefile
echo " rm -rf \$(PDG_ROOT)/tools/node \$(PDG_ROOT)/node_modules \$(PDG_ROOT)/.pdg*" >> Makefile
echo " rm -rf \$(PDG_ROOT)tools/jasmine-node \$(PDG_ROOT)tools/node-gyp" >> Makefile
echo " rm -rf \$(PDG_ROOT)tools/node-inspector \$(PDG_ROOT)tools/npm \$(PDG_ROOT)tools/repl" >> Makefile
if [ "$BUILD_IOS" == "yes" ]; then
echo " rm -rf \$(PDG_ROOT)/ios/build" >> Makefile
fi
echo " cd \$(PDG_ROOT)/deps/node; make distclean" >> Makefile
echo "" >> Makefile
echo "clean:" >> Makefile
echo " @mkdir -p \$(PDG_ROOT)/build/node-pdg" >> Makefile
echo " cd \$(PDG_ROOT)/build/; make clean" >> Makefile
echo " cd \$(PDG_ROOT)/build/node-pdg; make clean" >> Makefile
echo "" >> Makefile
echo "xcode:" >> Makefile
echo " @mkdir -p \$(PDG_ROOT)/xcode" >> Makefile
echo " cd \$(PDG_ROOT)/xcode; cmake -G Xcode .." >> Makefile
echo "" >> Makefile
echo "help:" >> Makefile
echo " @echo \"Targets:\"" >> Makefile
echo " @echo \"help - this information \"" >> Makefile
echo " @echo \"pdg - PDG app with Node.js JavaScript support\"" >> Makefile
if [ "$BUILD_IOS" == "yes" ]; then
echo " @echo \"pdg-ios - PDG for iOS\"" >> Makefile
fi
echo " @echo \"pdg-node - PDG engine as a Node.js plugin\"" >> Makefile
echo " @echo \"chipmunk - Chipmunk physic library \"" >> Makefile
echo " @echo \"glfw - GLFW low level OpenGL graphics library \"" >> Makefile
if [ "$BUILD_JAVASCRIPTCORE" == "yes" ]; then
echo " @echo \"jsc - JavaScriptCore libraries (used by iOS)\"" >> Makefile
fi
if [ "$CAN_BUILD_INTERFACES" == "yes" ]; then
echo " @echo \"js-interfaces - interface files for JavaScript bindings \"" >> Makefile
fi
echo " @echo \"node - Node.js as a library and executable tool\"" >> Makefile
echo " @echo \"node-modules - Setup supporting Node.js modules\"" >> Makefile
echo " @echo \"superclean - clean everything, even this Makefile! Must use ./configure to continue afterwards \"" >> Makefile
echo " @echo \"clean - clean everything except Node.js \"" >> Makefile
echo " @echo \"xcode - create an Xcode project \"" >> Makefile
echo "" >> Makefile
echo ".PHONY : all config pdg chipmunk glfw jsc pdg-ios js-interfaces fix-interface-timestamps node node-modules superclean clean xcode pdg-node help" >> Makefile
echo "-- created ./Makefile (in $PDG_ROOT)"
# make fix-interface-timestamps
echo "Using CMake to configure build files..."
echo "-- CMake options: $CMAKE_OPTIONS"
cd build; cmake $CMAKE_OPTIONS ..
echo "Done."
echo "Add 'source $PDG_ROOT/.pdgrc' to your bash profile to use pdg's version of Node.js tools."
echo "Type 'make' to build, or 'make help' to get a list of possible targets."
else
echo "Missing CMake"
echo "Please install CMake v2.6 or later from http://www.cmake.org/cmake/resources/software.html"
fi