0
+# Alternate bootstrap script for Nu, contributed by Andrew Norrie
0
+# Currently this is for Mac OS systems only.
0
+# This script builds and installs a single architecture Nu framework
0
+# and nush, the nu shell.
0
+# A univeral-binary version can then be built if required by running
0
+BUILD_PATH_ROOT="${here}/build"
0
+BUILD_PATH="${BUILD_PATH_ROOT}"
0
+FRAMEWORK_DESTINATION="/Library/Frameworks/"
0
+INSTALL_PREFIX="/usr/local"
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
+FRAMEWORK_REVISION_LETTER="A"
0
+FRAMEWORK_INIT="-Wl,-init -Wl,_NuInit"
0
+# DETERMINE CURRENT PLATFORM
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
+CFLAGS="${CFLAGS} -Wall -g -std=gnu99 -I ${here}/include -I ${here}/include/Nu -I /usr/local/include"
0
+MFLAGS="${MFLAGS} -fobjc-exceptions"
0
+if test `uname -s` = "Darwin"
0
+ DARWIN=`uname -r | sed '/\..*/s///'`
0
+ if test ${DARWIN} = "9"
0
+ LEOPARD="-DLEOPARD_OBJC2 -D__OBJC2__"
0
+ SDK="/Developer/SDKs/MacOSX10.5.sdk"
0
+ if test ${DARWIN} = "8"
0
+ SDK="/Developer/SDKs/MacOSX10.4u.sdk"
0
+ echo Error: SDK not found or unknown.
0
+ echo Error: "SDK expected at '${SDK}' does not exist."
0
+ CFLAGS="${CFLAGS} -DMACOSX -DDARWIN=${DARWIN} -isysroot ${SDK} ${LEOPARD}"
0
+ MFLAGS="${MFLAGS} -fconstant-string-class=NSConstantString";
0
+# LOCATION OF PREREQUISITES
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
+# On Mac OS X, to build a universal binary with UTF-8 support,
0
+# use the following command:
0
+# CXXFLAGS="-arch i386 -arch ppc" \
0
+# CFLAGS="-arch i386 -arch ppc" \
0
+# LDFLAGS="-arch i386 -arch ppc" \
0
+# --disable-dependency-tracking \
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
+PCRE_PREFIX="/usr/local"
0
+PCRE_LIBRARY_PATH="${PCRE_PREFIX}/lib"
0
+PCRE_INCLUDE_PATH="${PCRE_PREFIX}/include"
0
+for file in "${PCRE_INCLUDE_PATH}/pcre.h" "${PCRE_LIBRARY_PATH}/libpcre.dylib"
0
+ if test ! -f "${file}"
0
+ echo Error: "Perl-Compatible-Regualar-Expressions file '${file}' connot be found"
0
+# - Nu requires libffi.
0
+FFI_LIBRARY_PATH="/usr/lib"
0
+FFI_INCLUDE_PATH="/usr/include"
0
+for file in "${FFI_INCLUDE_PATH}/ffi/ffi.h" "${FFI_LIBRARY_PATH}/libffi.dylib"
0
+ if test ! -f "${file}"
0
+ echo Error: "Foreign-Function-Interface file '${file}' connot be found"
0
+# CFLAGS="${CFLAGS} -I ${FFI_INCLUDE_PATH}"
0
+# BUILD, INSTALL AND TEST NU
0
+# --------------------------
0
+# - Make the framework structure
0
+FRAMEWORK_STUB="${FRAMEWORK_NAME}.framework"
0
+FRAMEWORK_CONTENTS_STUB="${FRAMEWORK_STUB}/Versions/${FRAMEWORK_REVISION_LETTER}"
0
+FRAMEWORK="${BUILD_PATH}/${FRAMEWORK_STUB}"
0
+FRAMEWORK_CONTENTS="${BUILD_PATH}/${FRAMEWORK_CONTENTS_STUB}"
0
+if test ! -d "${FRAMEWORK}/Headers" -o ! -d "${FRAMEWORK}/Resources"
0
+ mkdir -p "${FRAMEWORK_CONTENTS}/Headers" "${FRAMEWORK_CONTENTS}/Resources" && \
0
+ (cd "${FRAMEWORK}/Versions"; \
0
+ ln -sf "${FRAMEWORK_REVISION_LETTER}" Current; \
0
+ ln -sf "Versions/Current/Headers" "Versions/Current/Resources" .)
0
+ if test ! -d "${FRAMEWORK}/Headers" -o ! -d "${FRAMEWORK}/Resources"
0
+ echo Error: "Cannot create the framework folders '${FRAMEWORK}'"
0
+# - Add additional external libraries and frameworks
0
+ for name in "pcre" "edit" "ffi"
0
+ LDFLAGS="${LDFLAGS} -l${name}"
0
+ LDFLAGS="${LDFLAGS} -framework ${name}"
0
+ for name in "pcre" "readline" "ffi" "m"
0
+ LDFLAGS="${LDFLAGS} -l${name}"
0
+for file in "${here}/objc/"*.m
0
+ targ=${BUILD_PATH}/`basename "${file}" | sed -e '/\.m$/s//.o/'`
0
+ if test "${targ}" -ot "${file}"
0
+ rm -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+ if ! gcc ${CFLAGS} ${MFLAGS} -c -o "${targ}" "${file}"
0
+for file in "${here}/objc/"*.c
0
+ targ=${BUILD_PATH}/`basename "${file}" | sed -e '/\.c$/s//.o/'`
0
+ if test "${targ}" -ot "${file}"
0
+ rm -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+ if ! gcc ${CFLAGS} -c -o "${targ}" "${file}"
0
+if test ! -f "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}"
0
+ -install_name "${FRAMEWORK_CONTENTS_STUB}/${FRAMEWORK_EXECUTABLE_NAME}" \
0
+ -o "${FRAMEWORK_CONTENTS}/${FRAMEWORK_EXECUTABLE_NAME}" \
0
+ (cd "${FRAMEWORK}"; ln -sf "Versions/Current/${FRAMEWORK_EXECUTABLE_NAME}" .)
0
+for file in "${here}/include/Nu/"*
0
+ cp "${file}" "${FRAMEWORK}/Headers"
0
+for file in "${here}/nu/"*
0
+ cp "${file}" "${FRAMEWORK}/Resources"
0
+for file in "${here}/share/nu/resources/"*
0
+ cp -PR "${file}" "${FRAMEWORK}/Resources"
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
+ <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
+ <key>CFBundleName</key>
0
+ <string>${FRAMEWORK_NAME}</string>
0
+ <key>CFBundlePackageType</key>
0
+ <key>CFBundleSignature</key>
0
+ <string>${FRAMEWORK_CREATOR_CODE}</string>
0
+ <key>CFBundleVersion</key>
0
+ <key>NSHumanReadableCopyright</key>
0
+ <string>${FRAMEWORK_COPYRIGHT_STRING}</string>
0
+echo Installing Nu framework to ${FRAMEWORK_DESTINATION}
0
+# mv "${FRAMEWORK}" "${FRAMEWORK_DESTINATION}"
0
+ -o "${BUILD_PATH}/nush" \
0
+echo Installing Nu tools
0
+for file in "${BUILD_PATH}/nush" "${here}/tools/"*
0
+ echo `basename ${file}`
0
+ sudo cp "${file}" "${INSTALL_PREFIX}/bin"
0
+echo Installing Nu shared files and examples
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
+sudo ditto "${here}/examples" "${INSTALL_PREFIX}/share/nu/examples"
0
+#nutest ${here}/test/test_*.nu
Comments
No one has commented yet.