Commits

Moritz Heidkamp committed a49ef53

chicken-build: add -c/--chicken for selecting a compilation CHICKEN from the coop by name

Comments (0)

Files changed (1)

   -b, --bootstrap
     build and use a bootstrap Chicken
 
+  -c, --chicken CHICKEN_NAME
+    use $CHICKENS/CHICKEN_NAME/bin/chicken for compiling
+
   -d, --debug
     make a debug build
 
 (define build-boot-chicken? #f)
 (define debug-build? #f)
 (define chicken-name #f)
+(define chicken-bin #f)
 
 (when (null? (command-line-arguments))
   (usage fail))
     (((or "-d" "--debug") rest ...)
      (set! debug-build? #t)
      (loop rest))
+    (((or "-c" "--chicken") rest ...)
+     (when (null? rest)
+       (printf-error "Missing argument for -c~%")
+       (usage fail))
+     (set! chicken-bin (make-pathname chicken-coop (car rest)))
+     (loop (cdr rest)))
     (((or "-h" "--help") rest ...)
      (usage)
      (exit))
-    ((name)
-     (set! chicken-name name))
+    ((name) (=> skip)
+     (if (equal? #\- (string-ref name 0))
+         (skip)
+         (set! chicken-name name)))
     (rest
-     (printf-error "Invalid arguments: ~S" rest)
-     (usage fail))))
+     (unless (null? rest)
+       (printf-error "Invalid arguments: ~S~%" rest)
+       (usage fail)))))
 
 (assert-chicken-coop-exists)
 
 (unless chicken-name
+  (printf-error "Missing NAME~%")
   (usage fail))
 
+(when (and build-boot-chicken? chicken-bin)
+  (printf-error "Can't set both -b and -c at the same time ")
+  (exit 1))
+
 (when (equal? chicken-link chicken-name)
   (printf-error "Invalid installation name: ~S" chicken-name)
   (exit 1))
   (run "make" "boot-chicken")
   (setenv "CHICKEN" "./chicken-boot"))
 
+(when chicken-bin
+  (setenv "CHICKEN" chicken-bin))
+
 (when debug-build?
   (setenv "DEBUGBUILD" "1"))