From e27346413c6de6a21060dec369aeb31b0bd17529 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Fri, 24 Oct 2025 18:39:37 +0300 Subject: [PATCH] Make the tool silent --- .gitignore | 2 ++ Makefile | 11 +++++- compile-r7rs.scm | 81 ++++++++++++++++++++++--------------------- libs/library-util.sld | 10 +++--- 4 files changed, 58 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 1a61af8..2619de4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ README.html *.import.* deps tmp +deb +*.deb diff --git a/Makefile b/Makefile index fe6adc9..b76e0a0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ PREFIX=/usr/local SCHEME=chibi +VERSION=1.0.0 R6RSTMP=tmp/${SCHEME}-r6rs R7RSTMP=tmp/${SCHEME}-r7rs DOCKERIMG=${SCHEME}:head @@ -34,6 +35,14 @@ build-chicken: -uses srfi-170 \ compile-r7rs.scm +deb: build-chicken + mkdir -p deb/bin + cp compile-r7rs deb/bin/ + mkdir -p deb/DEBIAN + printf "Package: compile-r7rs\nArchitecture: amd64\nVersion: ${VERSION}\nSection: misc\nMaintainer: Retropikzel \nDescription: SRFI 138: Compiling Scheme programs to executables - Implementation" \ + > deb/DEBIAN/control + dpkg-deb -b deb + # FIXME #build-gauche: #echo "#!/bin/sh" > compile-r7rs @@ -42,7 +51,7 @@ build-chicken: build-guile: echo "#!/bin/sh" > compile-r7rs - echo "guile --r7rs --auto-compile -I -q -L ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\" 2> /dev/null" >> compile-r7rs + echo "guile --r7rs --auto-compile -I -q -L ${PREFIX}/lib/compile-r7rs ${PREFIX}/lib/compile-r7rs/compile-r7rs.scm \"\$$@\"" >> compile-r7rs chmod +x compile-r7rs # FIXME diff --git a/compile-r7rs.scm b/compile-r7rs.scm index 65cf2a8..3cb9322 100644 --- a/compile-r7rs.scm +++ b/compile-r7rs.scm @@ -176,44 +176,41 @@ result)))))) (looper (command-line) (list)))) -(display "Scheme ") -(display scheme) -(newline) -(display "Type ") -(display scheme-type) -(newline) -(newline) +;(display "Scheme ") +;(display scheme) +;(newline) +;(display "Type ") +;(display scheme-type) +;(newline) +;(newline) ; Compile libraries (when (not (null? library-files)) - (if single-library-input-file + #;(if single-library-input-file (display "Given library file: ") (display "Found library files: ")) - (display library-files) - (newline) - (cond ((assoc 'library-command (cdr (assoc scheme data))) + ;(display library-files) + ;(newline) + (when (assoc 'library-command (cdr (assoc scheme data))) (for-each (lambda (file) (let* ((library-command (scheme-library-command file))) - (display "Compiling library ") - (display file) - (newline) + ;(display "Compiling library ") + ;(display file) + ;(newline) (for-each (lambda (command) - (display "Running ") - (write command) - (newline) - (display "Exit code ") + ;(display "Running ") + ;(write command) + ;(newline) + ;(display "Exit code ") (let ((exit-code (c-system (string->c-utf8 command)))) - (display exit-code) - (newline) + ;(display exit-code) + ;(newline) (when (not (= exit-code 0)) (exit exit-code)))) library-command))) - library-files)) - (else - (display "Implementation has no library build command, skipping library compilation.") - (newline)))) + library-files))) ; Create executable file (when (and (equal? scheme-type 'interpreter) input-file) @@ -224,9 +221,11 @@ (string-append "#!/bin/sh" (string #\newline) + "#|" + (string #\newline) "tmpfile=$(mktemp)" (string #\newline) - "tail -n+7 \"$0\" > ${tmpfile}" + "tail -n+9 \"$0\" > ${tmpfile}" (string #\newline))) ((string=? compilation-target "windows") (string-append @@ -241,16 +240,18 @@ "rm -rf ${tmpfile}" (string #\newline) "exit" + (string #\newline) + "|#" (string #\newline))) ((string=? compilation-target "windows") "")))) (scheme-program (slurp input-file))) - (display "Creating startup script ") - (display output-file) - (newline) - (display "Starting with ") - (display shebang-line) - (newline) + ;(display "Creating startup script ") + ;(display output-file) + ;(newline) + ;(display "Starting with ") + ;(display shebang-line) + ;(newline) (with-output-to-file (if (string=? compilation-target "windows") (string-append output-file ".bat") @@ -266,18 +267,18 @@ (when (and (equal? scheme-type 'compiler) input-file) (when (and output-file (file-exists? output-file)) (delete-file output-file)) - (display "Compiling file ") - (display input-file) - (newline) + ;(display "Compiling file ") + ;(display input-file) + ;(newline) (for-each (lambda (command) - (display "Running ") - (write command) - (newline) - (display "Exit code ") + ;(display "Running ") + ;(write command) + ;(newline) + ;(display "Exit code ") (let ((exit-code (c-system (string->c-utf8 command)))) - (display exit-code) - (newline) + ;(display exit-code) + ;(newline) (when (not (= exit-code 0)) (exit exit-code)))) scheme-command) diff --git a/libs/library-util.sld b/libs/library-util.sld index 74c4fcd..baa59d8 100644 --- a/libs/library-util.sld +++ b/libs/library-util.sld @@ -100,14 +100,14 @@ (define library-dependencies (lambda (implementation directories path previous-indent indent) - (for-each (lambda (item) (display " ")) indent) - (display path) + ;(for-each (lambda (item) (display " ")) indent) + ;(display path) (let ((full-path (search-library-file directories path))) (if (not (file-exists? full-path)) (begin - (display #\space) - (display "not found, ignoring") - (newline) + ;(display #\space) + ;(display "not found, ignoring") + ;(newline) (list)) (begin (newline)