From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: Re: [PATCH] build: Speed up .go compilation. Date: Sun, 10 Jan 2016 18:27:02 +0100 Message-ID: <87pox9s5uh.fsf@gnu.org> References: <87lha3rx04.fsf@T420.taylan> <87mvsgxpef.fsf@T420.taylan> <87ziwgf1b4.fsf@gnu.org> <87egdqy24m.fsf@T420.taylan> <87bn8u76tl.fsf@gnu.org> <87pox9wjsz.fsf@T420.taylan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIJm0-0005r2-PX for guix-devel@gnu.org; Sun, 10 Jan 2016 12:27:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIJlz-0005u0-Gv for guix-devel@gnu.org; Sun, 10 Jan 2016 12:27:24 -0500 In-Reply-To: <87pox9wjsz.fsf@T420.taylan> ("Taylan Ulrich \=\?utf-8\?Q\?\=5C\=22Bay\=C4\=B1rl\=C4\=B1\=2FKammer\=5C\=22\=22's\?\= message of "Sun, 10 Jan 2016 16:11:56 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Taylan Ulrich =?utf-8?Q?=22Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer=22?= Cc: guix-devel@gnu.org Let me say first that I found this an amazing work! taylanbayirli@gmail.com (Taylan Ulrich "Bay=C4=B1rl=C4=B1/Kammer") writes: > -AM_V_GUILEC =3D $(AM_V_GUILEC_$(V)) > -AM_V_GUILEC_ =3D $(AM_V_GUILEC_$(AM_DEFAULT_VERBOSITY)) > -AM_V_GUILEC_0 =3D @echo " GUILEC" $@; > - > -# Flags passed to 'guild compile'. > -GUILD_COMPILE_FLAGS =3D \ > - -Wformat -Wunbound-variable -Warity-mismatch > - It would make sense to me to keep compile options in Makefile.am and pass them as a command line argument to compile-all.scm. Maybe renaming it GUILECFLAGS or GUILEC_FLAGS or GUILE_COMPILE_FLAGS would be better (I think Automake won't like GUILE_CFLAGS). > # Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwis= e, if > # $GUILE_LOAD_COMPILED_PATH contains $(moduledir), we may find .go files= in > # there that are newer than the local .scm files (for instance because t= he > @@ -358,14 +346,16 @@ GUILD_COMPILE_FLAGS =3D \ > # > # XXX: Use the C locale for when Guile lacks > # . ^^^ > -.scm.go: > - $(AM_V_GUILEC)$(MKDIR_P) `dirname "$@"` ; \ > +%.go: make-go ; @: > +make-go: $(MODULES) guix/config.scm guix/tests.scm > + @echo "Compiling Scheme modules..." ; \ > unset GUILE_LOAD_COMPILED_PATH ; \ > LC_ALL=3DC \ ^^^ This is present because (scripts compile) from "old" Guile doesn't do it automatically. What about copying the code from the link above in compile-all.scm and removing this from Makefile.am ? > + host=3D$(host) srcdir=3D"$(top_srcdir)" \ > $(top_builddir)/pre-inst-env \ > - $(GUILD) compile -L "$(top_builddir)" -L "$(top_srcdir)" \ > - $(GUILD_COMPILE_FLAGS) --target=3D"$(host)" \ > - -o "$@" "$<" > + $(GUILE) -L "$(top_builddir)" -L "$(top_srcdir)" \ > + --no-auto-compile \ > + -s "$(top_srcdir)"/build-aux/compile-all.scm $^ >=20=20 > SUFFIXES =3D .go >=20=20 > @@ -457,6 +447,6 @@ assert-final-inputs-self-contained: > $(top_builddir)/pre-inst-env "$(GUILE)" \ > "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm" >=20=20 > -.PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go > +.PHONY: sync-descriptions gen-ChangeLog gen-AUTHORS clean-go make-go > .PHONY: assert-no-store-file-names assert-binaries-available > .PHONY: assert-final-inputs-self-contained > diff --git a/build-aux/compile-all.scm b/build-aux/compile-all.scm > new file mode 100644 > index 0000000..924ec39 > --- /dev/null > +++ b/build-aux/compile-all.scm [...] > +;;; To work around (FIXME), we want to load = all > +;;; files to be compiled first. We do this via resolve-interface so tha= t the > +;;; top-level of each file (module) is only executed once. > +(define (load-module-file file) > + (let ((module (file->module file))) > + (format #t " LOAD ~a~%" module) ^^^ > + (resolve-interface module))) > + > +(define (compile-file* file output-mutex) > + (let ((go (scm->go file))) > + (with-mutex output-mutex > + (format #t " GUILEC ~a~%" go) ^^^ I know this was already aligned this way before, but IMO It would look cleaner to use the same alignment as Automake default silent rules (CC, GEN, MAKEINFO...) with 11 characters including space before =E2=80=98~A=E2= =80=99: (format #t " LOAD ~A~%" source) (format #t " GUILEC ~A~%" source) Thanks, -- Mathieu Lirzin