0
@@ -34,28 +34,38 @@ END)
0
(set @nib_files '("share/nu/resources/English.lproj/MainMenu.nib"))
0
-(set @frameworks '("Cocoa"))
0
-(set @libs '("edit" "ffi" ))
0
+(if (eq (uname) "Darwin")
0
+ (then (set @frameworks '("Cocoa"))
0
+ (set @libs '("edit" "ffi" ))
0
+ (set @lib_dirs (NSMutableArray arrayWithObject:"/usr/lib")))
0
+ (else (set @frameworks nil)
0
+ (set @libs (list "readline" "ffi" "m" ))
0
+ (set @lib_dirs (NSMutableArray arrayWithList:(list "../lib")))))
0
-(set @lib_dirs (NSMutableArray arrayWithObject:"/usr/lib"))
0
(if (NSFileManager directoryExistsNamed:"#{@prefix}/lib") (@lib_dirs addObject:"#{@prefix}/lib"))
0
+(if (eq (uname) "Darwin")
0
+ (then (set @includes ""))
0
+ (else (set @includes " -I/usr/local/include")))
0
(if (NSFileManager directoryExistsNamed:"#{@prefix}/include") (@includes appendString:" -I #{@prefix}/include"))
0
-(if (NSFileManager fileExistsNamed:"/usr/lib/libffi.dylib")
0
- (then ;; Use the libffi that ships with OS X.
0
- (@includes appendString:" -I /usr/include"))
0
- (else ;; Use the libffi that is distributed with Nu.
0
- (@includes appendString:" -I ./libffi/include")
0
- (@lib_dirs addObject:"./libffi")))
0
+(if (eq (uname) "Darwin")
0
+ (then (if (NSFileManager fileExistsNamed:"/usr/lib/libffi.dylib")
0
+ (then ;; Use the libffi that ships with OS X.
0
+ (@includes appendString:" -I /usr/include"))
0
+ (else ;; Use the libffi that is distributed with Nu.
0
+ (@includes appendString:" -I ./libffi/include")
0
+ (@lib_dirs addObject:"./libffi"))))
0
+ (else ;; Use the libffi that ships with Linux
0
+ (@includes appendString:" -I /usr/include")))
0
;; framework description
0
(set @framework_identifier "nu.programming.framework")
0
(set @framework_icon_file "nu.icns")
0
-(
set @framework_initializer "NuInit")
0
+(
if (eq (uname) "Darwin") (then (set @framework_initializer "NuInit")))
0
(set @framework_creator_code "????")
0
@@ -68,24 +78,39 @@ END)
0
((NSFileManager directoryExistsNamed:"/Developer/SDKs/MacOSX10.4u.sdk")
0
(" -isysroot /Developer/SDKs/MacOSX10.4u.sdk"))
0
-(set @cflags "-Wall -g -DDARWIN -DMACOSX #{@sdk} #{@leopard} -std=gnu99")
0
-(set @mflags "-fobjc-exceptions") ;; Want to try Apple's new GC? Add this: "-fobjc-gc"
0
-;; use this to build a universal binary
0
-(set @arch '("ppc" "i386"))
0
-;; or this to just build for your current platform
0
- (cond ;; statically link in pcre since most people won't have it..
0
- ((NSFileManager fileExistsNamed:"#{@prefix}/lib/libpcre.a") ("#{@prefix}/lib/libpcre.a"))
0
- (else (NSException raise:"NukeBuildError" format:"Can't find static pcre library (libpcre.a).")))
0
- ((@frameworks map: (do (framework) " -framework #{framework}")) join)
0
- ((@libs map: (do (lib) " -l#{lib}")) join)
0
- ((@lib_dirs map: (do (libdir) " -L#{libdir}")) join))
0
+(if (eq (uname) "Darwin")
0
+ (then (set @cflags "-Wall -g -DDARWIN -DMACOSX #{@sdk} #{@leopard} -std=gnu99")
0
+ (set @mflags "-fobjc-exceptions")) ;; Want to try Apple's new GC? Add this: "-fobjc-gc"
0
+ (else (set @cflags "-Wall -DLINUX -g -std=gnu99 ")
0
+ (set @mflags "-fobjc-exceptions -fconstant-string-class=NSConstantString")))
0
+(if (eq (uname) "Darwin")
0
+ ;; use this to build a universal binary
0
+ (then (set @arch '("ppc" "i386")))
0
+ ;; or this to just build for your current platform
0
+ (else (set @arch '("i386"))))
0
+(if (eq (uname) "Darwin")
0
+ (cond ;; statically link in pcre since most people won't have it..
0
+ ((NSFileManager fileExistsNamed:"#{@prefix}/lib/libpcre.a") ("#{@prefix}/lib/libpcre.a"))
0
+ (else (NSException raise:"NukeBuildError" format:"Can't find static pcre library (libpcre.a).")))
0
+ ((@frameworks map: (do (framework) " -framework #{framework}")) join)
0
+ ((@libs map: (do (lib) " -l#{lib}")) join)
0
+ ((@lib_dirs map: (do (libdir) " -L#{libdir}")) join))
0
+ "-lNuFoundation -L/usr/local/lib -lobjc -Wl,--rpath -Wl,/usr/local/lib"
0
+ (cond ;; statically link in pcre since most people won't have it..
0
+ ((NSFileManager fileExistsNamed:"/usr/lib/libpcre.a") "/usr/lib/libpcre.a")
0
+ ((NSFileManager fileExistsNamed:"#{@prefix}/lib/libpcre.a") ("#{@prefix}/lib/libpcre.a"))
0
+ (else (NSException raise:"NukeBuildError" format:"Can't find static pcre library (libpcre.a).")))
0
+ ((@frameworks map: (do (framework) " -framework #{framework}")) join)
0
+ ((@libs map: (do (lib) " -l#{lib}")) join))
0
;; Setup the tasks for compilation and framework-building.
0
;; These are defined in the nuke application source file.
0
(task "clobber" => "clean" is
0
(SH "rm -rf nush #{@framework_dir} doc")
0
((filelist "^examples/[^/]*$") each:
0
@@ -109,11 +133,18 @@ END)
0
(set nush_thin_binary "build/#{architecture}/nush")
0
(nush_thin_binaries addObject:nush_thin_binary)
0
- (file nush_thin_binary => "framework" "build/#{architecture}/main.o" is
0
- (SH "#{@cc} #{@cflags} -arch #{architecture} -F. -framework Nu build/#{architecture}/main.o #{@ldflags} -o #{(target name)}"))))
0
+ (if (eq (uname) "Darwin")
0
+ (file nush_thin_binary => "framework" "build/#{architecture}/main.o" is
0
+ (SH "#{@cc} #{@cflags} -arch #{architecture} -F. -framework Nu build/#{architecture}/main.o #{@ldflags} -o #{(target name)}")))
0
+ (file nush_thin_binary => (@c_objects objectForKey:architecture) (@m_objects objectForKey:architecture) is
0
+ (SH "#{@cc} #{@cflags} -F. build/#{architecture}/nu.o /usr/lib/libNu.so #{@ldflags} -o #{(target name)}"))))))
0
(file "nush" => "framework" nush_thin_binaries is
0
- (SH "lipo -create #{(nush_thin_binaries join)} -output #{(target name)}"))
0
+ (if (eq (uname) "Darwin")
0
+ (then (SH "lipo -create #{(nush_thin_binaries join)} -output #{(target name)}"))
0
+ (else (SH "cp '#{(nush_thin_binaries objectAtIndex:0)}' '#{(target name)}'"))))
0
;; These tests were the first sanity tests for Nu. They require RubyObjC.
0
(task "test.rb" => "framework" is
Comments
No one has commented yet.