Skip to content

Commit

Permalink
removed hard-coded /Developer paths, added top-level tests.nu to more…
Browse files Browse the repository at this point in the history
… easily run tests from Xcode schemes.
  • Loading branch information
timburks committed Jun 11, 2011
1 parent b622d89 commit 8522ddb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
11 changes: 8 additions & 3 deletions Makefile
Expand Up @@ -9,21 +9,26 @@ SYSTEM = $(shell uname)
PREFIX ?= /usr/local

ifeq ($(SYSTEM), Darwin)

DEVROOT = $(shell xcode-select -print-path)

ifeq ($(shell test -e /usr/lib/libffi.dylib && echo yes), yes)
# Use the libffi that ships with OS X.
FFI_LIB = -L/usr/lib -lffi
FFI_INCLUDE = -I/usr/include/ffi
# assume that our system is at least on Leopard
LEOPARD_CFLAGS = -DLEOPARD_OBJC2
else
# Use the libffi that is distributed with Nu.
FFI_LIB = -L./libffi -lffi
FFI_INCLUDE = -I./libffi/include
# assume that our system is pre-Leopard
LEOPARD_CFLAGS =
endif

ifeq ($(shell test -e /Developer/SDKs/MacOSX10.7.sdk && echo yes), yes)
ifeq ($(shell test -e $(DEVROOT)/SDKs/MacOSX10.7.sdk && echo yes), yes)
# not a typo, we deliberatly stay back on the 10.6 SDK for now.
LION_CFLAGS = -DLION -isysroot /Developer/SDKs/MacOSX10.6.sdk
LION_CFLAGS = -DLION -isysroot $(DEVROOT)/SDKs/MacOSX10.6.sdk
else
LION_CFLAGS =
endif
Expand Down Expand Up @@ -63,7 +68,7 @@ MFLAGS = -fobjc-exceptions
CFLAGS += -DHAVE_CONFIG_H

ifeq ($(SYSTEM), Darwin)
#CC = /Developer/usr/bin/llvm-gcc-4.2
CC = $(DEVROOT)/usr/bin/llvm-gcc-4.2
CFLAGS += -DMACOSX -DDARWIN $(LEOPARD_CFLAGS) $(LION_CFLAGS) -Ipcre
else
# CFLAGS += -DLINUX
Expand Down
30 changes: 18 additions & 12 deletions Nukefile
@@ -1,5 +1,9 @@
;; Nukefile for Nu framework and nush, the Nu shell

(set DEVROOT
(ifDarwin (then (NSString stringWithShellCommand:"xcode-select -print-path"))
(else nil)))

(global VERSION '(0 9 1)) #(major minor tweak)

(task "version" is
Expand Down Expand Up @@ -84,19 +88,21 @@ END)

;; build configuration
(set @cc "gcc")
(set @cc "#{DEVROOT}/usr/bin/llvm-gcc-4.2")

(set @leopard "")
(set @sdk
(cond ((NSFileManager directoryExistsNamed:"/Developer/SDKs/MacOSX10.7.sdk")
(cond ((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.7.sdk")
(set @leopard "-DLEOPARD_OBJC2 -D__OBJC2__ -DSNOWLEOPARD -DLION")
("-isysroot /Developer/SDKs/MacOSX10.6.sdk")) ;; stay on the 10.6 SDK for now
((NSFileManager directoryExistsNamed:"/Developer/SDKs/MacOSX10.6.sdk")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.6.sdk")) ;; stay on the 10.6 SDK for now
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.6.sdk")
(set @leopard "-DLEOPARD_OBJC2 -D__OBJC2__ -DSNOWLEOPARD")
("-isysroot /Developer/SDKs/MacOSX10.6.sdk"))
((NSFileManager directoryExistsNamed:"/Developer/SDKs/MacOSX10.5.sdk")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.6.sdk"))
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.5.sdk")
(set @leopard "-DLEOPARD_OBJC2 -D__OBJC2__")
("-isysroot /Developer/SDKs/MacOSX10.5.sdk"))
((NSFileManager directoryExistsNamed:"/Developer/SDKs/MacOSX10.4u.sdk")
("-isysroot /Developer/SDKs/MacOSX10.4u.sdk"))
("-isysroot #{DEVROOT}/SDKs/MacOSX10.5.sdk"))
((NSFileManager directoryExistsNamed:"#{DEVROOT}/SDKs/MacOSX10.4u.sdk")
("-isysroot #{DEVROOT}/SDKs/MacOSX10.4u.sdk"))
(else "")))

(set @cflags "-Wall -g -std=gnu99 -fPIC")
Expand Down Expand Up @@ -186,7 +192,7 @@ END)
(SH "ruby -rtest/unit -e0 -- -v --pattern '/test_.*\.rb^/'"))

(task "test" => "framework" "nush" is
(SH "./nush tools/nutest test/test_*.nu"))
(SH "./nush tools/nutest tests.nu"))

(task "doc" is
(SH "nudoc"))
Expand Down Expand Up @@ -232,9 +238,9 @@ END)
(SH "hdiutil create -srcdir dmg '#{@framework}.dmg' -volname '#{@framework}'")
(SH "rm -rf dmg"))

(if (NSFileManager fileExistsNamed:"/Developer/usr/bin/packagemaker")
(then (set PACKAGEMAKER "/Developer/usr/bin/packagemaker"))
(else (set PACKAGEMAKER "/Developer/Tools/packagemaker")))
(if (NSFileManager fileExistsNamed:"#{DEVROOT}/usr/bin/packagemaker")
(then (set PACKAGEMAKER "#{DEVROOT}/usr/bin/packagemaker"))
(else (set PACKAGEMAKER "#{DEVROOT}/Tools/packagemaker")))

;; Build an installer and wrap it in a disk image.
(task "installer" => "framework" "nush" is
Expand Down
7 changes: 7 additions & 0 deletions tests.nu
@@ -0,0 +1,7 @@
# loads all unit tests in the test directory

(set tests ((NSString stringWithShellCommand:"ls test/test_*.nu") lines))

(tests each:
(do (test)
(load test)))

0 comments on commit 8522ddb

Please sign in to comment.