public
Description: The Nu programming language.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nu.git
Search Repo:
New alternate bootstrap script by Andrew Norrie.

This script builds and installs a single-architecture Nu
in one pass. Tested on Mac OS 10.5.2, this reportedly also works
with an older version of Nu (0.2.4) on Mac OS 10.4.
timburks (author)
Tue May 13 09:07:41 -0700 2008
commit  c29aa5cfeeeeb41280b3644e197a9168bdcd6573
tree    f4a7c9d4146d747b5af07cd6e98ae4a15297f9fb
parent  4f8d0b325e39e3630eea541bb46cd8a9cb47b452
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -1 +1,347 @@
0
+#!/bin/sh
0
+# Alternate bootstrap script for Nu, contributed by Andrew Norrie
0
+# Currently this is for Mac OS systems only.
0
+
0
+# INSTALLING NU
0
+# =============
0
+#
0
+# This script builds and installs a single architecture Nu framework
0
+# and nush, the nu shell.
0
+#
0
+# A univeral-binary version can then be built if required by running
0
+#
0
+# % rm -fR build/*
0
+# % nuke
0
+# % nuke install
0
+#
0
+
0
+here=`dirname "$0"`
0
+
0
+BUILD_PATH_ROOT="${here}/build"
0
+BUILD_PATH="${BUILD_PATH_ROOT}"
0
+
0
+FRAMEWORK_DESTINATION="/Library/Frameworks/"
0
+INSTALL_PREFIX="/usr/local"
0
+
0
+
0
+CFLAGS=
0
+MFLAGS=
0
+LDFLAGS=
0
+
0
+
0
+FRAMEWORK_NAME="Nu"
0
+FRAMEWORK_EXECUTABLE_NAME="${FRAMEWORK_NAME}"
0
+FRAMEWORK_IDENTIFIER="nu.programming.framework"
0
+FRAMEWORK_ICON="nu.icns"
0
+FRAMEWORK_CREATOR_CODE="????"
0
+FRAMEWORK_COPYRIGHT_STRING="Nu. Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc."
0
+
0
+FRAMEWORK_REVISION_LETTER="A"
0
+
0
+FRAMEWORK_INIT="-Wl,-init -Wl,_NuInit"
0
+
0
+
0
+#
0
+# DETERMINE CURRENT PLATFORM
0
+# --------------------------
0
+#
0
+# - To determine the current platform we test to see if it is Darwin,
0
+# a.k.a Mac OS X, or anything else. The Darwin major version number
0
+# (8 => 10.4, 9 => 10.5) is passed to the C compiler in the DARWIN
0
+# preprocessor symbol.
0
+#
0
+
0
+
0
+CFLAGS="${CFLAGS} -Wall -g -std=gnu99 -I ${here}/include -I ${here}/include/Nu -I /usr/local/include"
0
+MFLAGS="${MFLAGS} -fobjc-exceptions"
0
+
0
+
0
+if test `uname -s` = "Darwin"
0
+then
0
+ DARWIN=`uname -r | sed '/\..*/s///'`
0
+else
0
+ DARWIN=
0
+fi
0
+
0
+if test ${DARWIN}
0
+then
0
+
0
+ if test ${DARWIN} = "9"
0
+ then
0
+ LEOPARD="-DLEOPARD_OBJC2 -D__OBJC2__"
0
+ SDK="/Developer/SDKs/MacOSX10.5.sdk"
0
+ else
0
+
0
+ if test ${DARWIN} = "8"
0
+ then
0
+ SDK="/Developer/SDKs/MacOSX10.4u.sdk"
0
+ else
0
+ echo Error: SDK not found or unknown.
0
+ exit 1
0
+ fi
0
+ fi
0
+
0
+ if test ! -d "${SDK}"
0
+ then
0
+ echo Error: "SDK expected at '${SDK}' does not exist."
0
+ exit 1
0
+ fi
0
+
0
+ CFLAGS="${CFLAGS} -DMACOSX -DDARWIN=${DARWIN} -isysroot ${SDK} ${LEOPARD}"
0
+else
0
+
0
+ MFLAGS="${MFLAGS} -fconstant-string-class=NSConstantString";
0
+fi
0
+
0
+
0
+#
0
+# LOCATION OF PREREQUISITES
0
+# -------------------------
0
+#
0
+# - Nu requires PCRE, the Perl-Compatible Regular Expression Library.
0
+# Before building Nu, download and install pcre, enabling UTF-8.
0
+# Look for it at http://www.pcre.org.
0
+#
0
+# On Mac OS X, to build a universal binary with UTF-8 support,
0
+# use the following command:
0
+#
0
+# % env \
0
+# CXXFLAGS="-arch i386 -arch ppc" \
0
+# CFLAGS="-arch i386 -arch ppc" \
0
+# LDFLAGS="-arch i386 -arch ppc" \
0
+# ./configure \
0
+# --disable-dependency-tracking \
0
+# --enable-utf8
0
+#
0
+# When you install PCRE, it's best to put it in /usr/local (the default).
0
+# If you put it anywhere else, you'll have to modify the Nukefile
0
+# used to build Nu.
0
+#
0
+
0
+PCRE_PREFIX="/usr/local"
0
+PCRE_LIBRARY_PATH="${PCRE_PREFIX}/lib"
0
+PCRE_INCLUDE_PATH="${PCRE_PREFIX}/include"
0
+
0
+for file in "${PCRE_INCLUDE_PATH}/pcre.h" "${PCRE_LIBRARY_PATH}/libpcre.dylib"
0
+do
0
+ if test ! -f "${file}"
0
+ then
0
+ echo Error: "Perl-Compatible-Regualar-Expressions file '${file}' connot be found"
0
+ exit 1
0
+ fi
0
+done
0
+
0
+
0
+# - Nu requires libffi.
0
+
0
+FFI_LIBRARY_PATH="/usr/lib"
0
+FFI_INCLUDE_PATH="/usr/include"
0
+
0
+for file in "${FFI_INCLUDE_PATH}/ffi/ffi.h" "${FFI_LIBRARY_PATH}/libffi.dylib"
0
+do
0
+ if test ! -f "${file}"
0
+ then
0
+ echo Error: "Foreign-Function-Interface file '${file}' connot be found"
0
+ exit 1
0
+ fi
0
+done
0
+
0
+# CFLAGS="${CFLAGS} -I ${FFI_INCLUDE_PATH}"
0
+
0
+
0
+#
0
+# BUILD, INSTALL AND TEST NU
0
+# --------------------------
0
+#
0
+# - Make the framework structure
0
+#
0
+
0
+FRAMEWORK_STUB="${FRAMEWORK_NAME}.framework"
0
+FRAMEWORK_CONTENTS_STUB="${FRAMEWORK_STUB}/Versions/${FRAMEWORK_REVISION_LETTER}"
0
+
0
+
0
+FRAMEWORK="${BUILD_PATH}/${FRAMEWORK_STUB}"
0
+FRAMEWORK_CONTENTS="${BUILD_PATH}/${FRAMEWORK_CONTENTS_STUB}"
0
+
0
+if test ! -d "${FRAMEWORK}/Headers" -o ! -d "${FRAMEWORK}/Resources"
0
+then
0
+ mkdir -p "${FRAMEWORK_CONTENTS}/Headers" "${FRAMEWORK_CONTENTS}/Resources" && \
0
+ (cd "${FRAMEWORK}/Versions"; \
0
+ ln -sf "${FRAMEWORK_REVISION_LETTER}" Current; \
0
+ cd ..; \
0
+ ln -sf "Versions/Current/Headers" "Versions/Current/Resources" .)
0
+
0
+ if test ! -d "${FRAMEWORK}/Headers" -o ! -d "${FRAMEWORK}/Resources"
0
+ then
0
+ echo Error: "Cannot create the framework folders '${FRAMEWORK}'"
0
+ exit
0
+ fi
0
+fi
0
+
0
+#
0
+# - Add additional external libraries and frameworks
0
+#
0
+
0
+if test ${DARWIN}
0
+then
0
+
0
+ for name in "pcre" "edit" "ffi"
0
+ do
0
+ LDFLAGS="${LDFLAGS} -l${name}"
0
+ done
0
+
0
+ for name in "Cocoa"
0
+ do
0
+ LDFLAGS="${LDFLAGS} -framework ${name}"
0
+ done
0
+
0
+else
0
+
0
+ for name in "pcre" "readline" "ffi" "m"
0
+ do
0
+ LDFLAGS="${LDFLAGS} -l${name}"
0
+ done
0
+fi
0
+
0
+
0
+#
0
+# - compilation
0
+#
0
+
0
+
0
+for file in "${here}/objc/"*.m
0
+do
0
+ targ=${BUILD_PATH}/`basename "${file}" | sed -e '/\.m$/s//.o/'`
0
+
0
+ if test "${targ}" -ot "${file}"
0
+ then
0
+ rm -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+
0
+ if ! gcc ${CFLAGS} ${MFLAGS} -c -o "${targ}" "${file}"
0
+ then
0
+ exit
0
+ fi
0
+ fi
0
+done
0
+
0
+for file in "${here}/objc/"*.c
0
+do
0
+ targ=${BUILD_PATH}/`basename "${file}" | sed -e '/\.c$/s//.o/'`
0
+
0
+ if test "${targ}" -ot "${file}"
0
+ then
0
+ rm -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+
0
+ if ! gcc ${CFLAGS} -c -o "${targ}" "${file}"
0
+ then
0
+ exit
0
+ fi
0
+ fi
0
+done
0
+
0
+
0
+if test ! -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+then
0
+ if gcc \
0
+ ${CFLAGS} \
0
+ ${LDFLAGS} \
0
+ ${FRAMEWORK_INIT} \
0
+ -install_name "${FRAMEWORK_CONTENTS_STUB}/${FRAMEWORK_EXECUTABLE_NAME}" \
0
+ -dynamiclib \
0
+ -o "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}" \
0
+ "${BUILD_PATH}/"*.o
0
+ then
0
+ (cd "${FRAMEWORK}"; ln -sf "Versions/Current/${FRAMEWORK_EXECUTABLE_NAME}" .)
0
+ else
0
+ exit
0
+ fi
0
+fi
0
+
0
+
0
+for file in "${here}/include/Nu/"*
0
+do
0
+ cp "${file}" "${FRAMEWORK}/Headers"
0
+done
0
+
0
+
0
+for file in "${here}/nu/"*
0
+do
0
+ cp "${file}" "${FRAMEWORK}/Resources"
0
+done
0
+
0
+
0
+for file in "${here}/share/nu/resources/"*
0
+do
0
+ cp -PR "${file}" "${FRAMEWORK}/Resources"
0
+done
0
+
0
+
0
+cat > "${FRAMEWORK}/Resources/info.plist" <<!
0
+<?xml version="1.0" encoding="UTF-8"?>
0
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
0
+<plist version="1.0">
0
+<dict>
0
+ <key>CFBundleDevelopmentRegion</key>
0
+ <string>English</string>
0
+ <key>CFBundleExecutable</key>
0
+ <string>${FRAMEWORK_EXECUTABLE_NAME}</string>
0
+ <key>CFBundleGetInfoString</key>
0
+ <string>${FRAMEWORK_COPYRIGHT_STRING}</string>
0
+ <key>CFBundleIdentifier</key>
0
+ <string>${FRAMEWORK_IDENTIFIER}</string>
0
+ <key>CFBundleInfoDictionaryVersion</key>
0
+ <string>6.0</string>
0
+ <key>CFBundleName</key>
0
+ <string>${FRAMEWORK_NAME}</string>
0
+ <key>CFBundlePackageType</key>
0
+ <string>FMWK</string>
0
+ <key>CFBundleSignature</key>
0
+ <string>${FRAMEWORK_CREATOR_CODE}</string>
0
+ <key>CFBundleVersion</key>
0
+ <string>0.1</string>
0
+ <key>NSHumanReadableCopyright</key>
0
+ <string>${FRAMEWORK_COPYRIGHT_STRING}</string>
0
+</dict>
0
+</plist>
0
+!
0
+
0
+echo Installing Nu framework to ${FRAMEWORK_DESTINATION}
0
+
0
+# mv "${FRAMEWORK}" "${FRAMEWORK_DESTINATION}"
0
+
0
+if ! gcc \
0
+ ${CFLAGS} \
0
+ ${LDFLAGS} \
0
+ -framework Nu \
0
+ -o "${BUILD_PATH}/nush" \
0
+ main/main.m
0
+then
0
+ exit
0
+fi
0
+
0
+
0
+echo Installing Nu tools
0
+
0
+for file in "${BUILD_PATH}/nush" "${here}/tools/"*
0
+do
0
+ echo `basename ${file}`
0
+ sudo cp "${file}" "${INSTALL_PREFIX}/bin"
0
+done
0
+
0
+
0
+echo Installing Nu shared files and examples
0
+
0
+sudo mkdir -p "${INSTALL_PREFIX}/share/nu"
0
+sudo rm -rf "${INSTALL_PREFIX}/share/nu"*
0
+sudo cp -rp "${here}/share/nu" "${INSTALL_PREFIX}/share/nu"
0
+
0
+sudo ditto "${here}/examples" "${INSTALL_PREFIX}/share/nu/examples"
0
+
0
+
0
+
0
+echo Testing Nu
0
+
0
+#nutest ${here}/test/test_*.nu
0
+
0
+nutest test/test_*.nu

Comments

    No one has commented yet.