Le Mon, 07 Sep 2020 16:09:01 +0200, Ludovic Courtès a écrit : > Julien Lepiller skribis: > > > * guix/build-system/composer.scm: New file. > > * guix/build/composer-build-system.scm: New file. > > * guix/build-system/findclass.php: New file. > > * Makefile.am: Add them. > > * doc/guix.texi (Build Systems): Document it. > > [...] > > > +++ b/guix/build-system/findclass.php > > @@ -0,0 +1,102 @@ > > + > +/** > > + * Extract the classes in the given file > > + * > > + * @param string $path The file to check > > + * @throws \RuntimeException > > + * @return array The found classes > > + */ > > This should rather be under gnu/packages/aux-files IMO. Also, could > you add a copyright header and possibly info as to where it > originates? > > > +(define* (create-autoload vendor composer-file inputs #:key > > dev-dependencies?) > > + (with-output-to-file (string-append vendor "/autoload.php") > > + (lambda _ > > + (format #t " > + (format #t "// autoload.php @generated by Guix~%") > > + (format #t "$map = $psr4map = $classmap = array();~%") > > + (format #t "require_once '~a/autoload_conf.php';~%" vendor) > > + (format #t "require_once > > '~a/share/web/composer/ClassLoader.php';~%" > > + (assoc-ref inputs "composer-classloader")) > > + (format #t "$loader = new > > \\Composer\\Autoload\\ClassLoader();~%") > > + (format #t "foreach ($map as $namespace => $path) {~%") > > + (format #t " $loader->set($namespace, $path);~%") > > + (format #t "}~%") > > + (format #t "foreach ($psr4map as $namespace => $path) {~%") > > + (format #t " $loader->setPsr4($namespace, $path);~%") > > + (format #t "}~%") > > + (format #t "$loader->addClassMap($classmap);~%") > > + (format #t "$loader->register();~%"))) > > I think it’d be clearer as a single string: > > (display "\ > // autoload.php …") > > Ludo’. Thanks, here's a new version