[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] always use temporary filenames in csc
From: |
.alyn.post. |
Subject: |
Re: [Chicken-hackers] [PATCH] always use temporary filenames in csc |
Date: |
Wed, 7 Nov 2012 13:00:11 -0700 |
Hmmm... I already find the build process pretty noisy: nearly any
error causes me to have to pipe to less and/or scroll my terminal
up. So I'm inclined personally to suggest this isn't a good idea
and suggest the original patch, but my threshold for such a thing
has already been passed with current output volume.
-Alan
On Wed, Nov 07, 2012 at 02:44:33PM -0500, Mario domenech Goulart wrote:
> On Wed, 7 Nov 2012 12:29:34 -0700 ".alyn.post." <address@hidden> wrote:
>
> > It would nice if create-temporary-file also accepted a prefix
> > option, so that file.scm compiled to something like file-XXXXX.scm,
> > rather than XXXXX.scm.
> >
> > Such a thing shouldn't hold up this patch, but it would make it
> > easier to sort out the results from the -k (keep) option and others
> > flags like it.
>
> How about just showing what files were generated? Something like:
>
> $ git diff
> diff --git a/csc.scm b/csc.scm
> index 7bc2a48..28adbec 100644
> --- a/csc.scm
> +++ b/csc.scm
> @@ -880,9 +880,13 @@ EOF
> (set! ofiles (cons fo ofiles))))
> rc-files)
> (set! object-files (append (reverse ofiles) object-files)) ; put
> generated object files first
> - (unless keep-files
> - (for-each $delete-file generated-c-files)
> - (for-each $delete-file generated-rc-files))))
> + (cond (keep-files
> + (print "The following files have been generated:")
> + (for-each print generated-c-files)
> + (for-each print generated-rc-files))
> + (else
> + (for-each $delete-file generated-c-files)
> + (for-each $delete-file generated-rc-files)))))
>
> (define (compiler-options)
> (string-intersperse
>
>
> Attached is Felix's patch amended in case you think that suggestion
> makes sense.
>
> Best wishes.
> Mario
> --
> http://parenteses.org/mario
> From 2d2aa4b29eb719427c4e344d2e9ccf91e148f069 Mon Sep 17 00:00:00 2001
> From: felix <address@hidden>
> Date: Tue, 6 Nov 2012 21:29:33 +0100
> Subject: [PATCH] use temporary files in csc where possible
>
> This fixes #946
> ---
> csc.scm | 56 ++++++++++++++++++++++++++++++++++++--------------------
> 1 files changed, 36 insertions(+), 20 deletions(-)
>
> diff --git a/csc.scm b/csc.scm
> index 21c416e..28adbec 100644
> --- a/csc.scm
> +++ b/csc.scm
> @@ -802,13 +802,15 @@ EOF
> (define (run-translation)
> (for-each
> (lambda (f)
> - (let ([fc (pathname-replace-extension
> - (if (= 1 (length scheme-files))
> - target-filename
> - f)
> - (cond (cpp-mode "cpp")
> + (let ((ext (cond (cpp-mode "cpp")
> (objc-mode "m")
> - (else "c") ) ) ] )
> + (else "c") ) )
> + (fc #f))
> + (cond (translate-only
> + (set! fc (pathname-replace-extension f ext)))
> + (else
> + (set! fc (create-temporary-file ext))
> + (set! generated-c-files (cons fc generated-c-files))))
> (command
> (string-intersperse
> (cons* translator (quotewrap f)
> @@ -827,9 +829,7 @@ EOF
> (objc-mode '("-feature" "chicken-scheme-to-objc"))
> (else '()))
> translation-optimization-options)) ) )
> - " ") )
> - (set! c-files (append (list fc) c-files))
> - (set! generated-c-files (append (list fc) generated-c-files))))
> + " ") )))
> scheme-files))
>
>
> @@ -838,8 +838,19 @@ EOF
> (define (run-compilation)
> (let ((ofiles '()))
> (for-each
> - (lambda (f)
> - (let ([fo (pathname-replace-extension f object-extension)])
> + (lambda (p)
> + (let ((f (car p))
> + (fo #f))
> + (cond (compile-only
> + (set! fo
> + (pathname-replace-extension
> + (if (cdr p)
> + f
> + target-filename)
> + object-extension)))
> + (else
> + (set! fo (create-temporary-file object-extension))
> + (set! generated-object-files (cons fo generated-object-files))))
> (command
> (string-intersperse
> (list (cond (cpp-mode c++-compiler)
> @@ -850,10 +861,10 @@ EOF
> (if (and cpp-mode (string=? "g++" c++-compiler))
> "-Wno-write-strings"
> "")
> - (compiler-options) ) ) )
> - (set! generated-object-files (cons fo generated-object-files))
> - (set! ofiles (cons fo ofiles))))
> - c-files)
> + (compiler-options) ) ) )))
> + (append
> + (map (cut cons <> #f) generated-c-files)
> + (map (cut cons <> #t) c-files)))
> (when (and generate-manifest (eq? 'windows (software-type)))
> (let ((rcf (pathname-replace-extension target-filename "rc")))
> (create-win-manifest (pathname-file target-filename) rcf)
> @@ -869,9 +880,13 @@ EOF
> (set! ofiles (cons fo ofiles))))
> rc-files)
> (set! object-files (append (reverse ofiles) object-files)) ; put
> generated object files first
> - (unless keep-files
> - (for-each $delete-file generated-c-files)
> - (for-each $delete-file generated-rc-files))))
> + (cond (keep-files
> + (print "The following files have been generated:")
> + (for-each print generated-c-files)
> + (for-each print generated-rc-files))
> + (else
> + (for-each $delete-file generated-c-files)
> + (for-each $delete-file generated-rc-files)))))
>
> (define (compiler-options)
> (string-intersperse
> @@ -885,7 +900,7 @@ EOF
> ;;; Link object files and libraries:
>
> (define (run-linking)
> - (let* ((files (map quotewrap object-files))
> + (let* ((files (map quotewrap (append generated-object-files object-files)))
> (target (quotewrap target-filename))
> (targetdir #f))
> (when deploy
> @@ -938,7 +953,8 @@ EOF
> (create-mac-bundle
> (pathname-file target-filename)
> targetdir)))
> - (unless keep-files (for-each $delete-file generated-object-files)) ) )
> + (unless keep-files
> + (for-each $delete-file generated-object-files)) ) )
>
> (define (lib-path)
> (prefix ""
> --
> 1.7.2.5
>
> _______________________________________________
> Chicken-hackers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-hackers
--
.i ma'a lo bradi cu penmi gi'e du
Re: [Chicken-hackers] [PATCH] always use temporary filenames in csc, Felix, 2012/11/10