[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#42338] [PATCH 03/34] guix: Add composer-build-system.
From: |
Ludovic Courtès |
Subject: |
[bug#42338] [PATCH 03/34] guix: Add composer-build-system. |
Date: |
Mon, 07 Sep 2020 16:09:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Julien Lepiller <julien@lepiller.eu> 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 @@
> +<?php
> +/**
> + * 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 "<?php~%")
> + (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 "\
<?php
// autoload.php …")
Ludo’.
- [bug#42338] [PATCH 03/34] guix: Add composer-build-system.,
Ludovic Courtès <=