diff options
Diffstat (limited to 'gnu/packages/code.scm')
-rw-r--r-- | gnu/packages/code.scm | 400 |
1 files changed, 256 insertions, 144 deletions
diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm index c4c423c846..7d081e3e3f 100644 --- a/gnu/packages/code.scm +++ b/gnu/packages/code.scm @@ -23,6 +23,8 @@ ;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> ;;; Copyright © 2024 Jordan Moore <lockbox@struct.foo> ;;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr> +;;; Copyright © 2025 Ada Stevenson <adanskana@gmail.com> +;;; Copyright © 2025 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -40,15 +42,16 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (gnu packages code) + #:use-module ((guix licenses) #:prefix license:) #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix download) #:use-module (guix git-download) - #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) - #:use-module (guix build-system python) + #:use-module ((guix build-system python) #:select (pypi-uri)) + #:use-module (guix build-system pyproject) #:use-module (guix build-system trivial) #:use-module (guix build-system go) #:use-module (gnu packages) @@ -57,7 +60,9 @@ #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages bison) + #:use-module (gnu packages boost) #:use-module (gnu packages c) + #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cpp) #:use-module (gnu packages curl) @@ -71,27 +76,78 @@ #:use-module (gnu packages golang-web) #:use-module (gnu packages golang-xyz) #:use-module (gnu packages graphviz) - #:use-module (gnu packages llvm) #:use-module (gnu packages linux) + #:use-module (gnu packages llvm) + #:use-module (gnu packages logging) #:use-module (gnu packages lua) #:use-module (gnu packages ncurses) #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages perl-compression) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages pretty-print) #:use-module (gnu packages python) + #:use-module (gnu packages python-build) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages qt) #:use-module (gnu packages readline) + #:use-module (gnu packages regex) #:use-module (gnu packages serialization) #:use-module (gnu packages sqlite) #:use-module (gnu packages texinfo) #:use-module (gnu packages tls) #:use-module (gnu packages web) - #:use-module (gnu packages xml)) + #:use-module (gnu packages xml) + #:use-module (srfi srfi-1)) ;;; Tools to deal with source code: metrics, cross-references, etc. +(define-public amalgamate + (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208") + (revision "0") + (version (git-version "1.1.1" revision commit))) + (package + (name "amalgamate") + (version version) + (home-page "https://github.com/edlund/amalgamate") + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit commit))) + (sha256 + (base32 + "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb")) + (file-name (git-file-name name version)) + (modules '((guix build utils))) + (snippet + '(substitute* "test.sh" + (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all) + "test_command \"gcc -Wall -Wextra -o source.out source.c\""))))) + (build-system gnu-build-system) + (inputs (list python-wrapper)) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "amalgamate.py" bin)))) + (replace 'check + (lambda _ + (invoke "./test.sh")))))) + (synopsis "Tool for amalgamating C source and header files") + ;; The package is indeed a script file, and the term "amalgamate.py" is + ;; used by upstream. + (description "amalgamate.py aims to make it easy to use SQLite-style C +source and header amalgamation in projects.") + (license license:bsd-3)))) + (define-public automatic-component-toolkit (package (name "automatic-component-toolkit") @@ -134,14 +190,14 @@ desired software component.") (define-public cflow (package (name "cflow") - (version "1.7") + (version "1.8") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/cflow/cflow-" version ".tar.bz2")) (sha256 (base32 - "11khr78090jjyqa2l26bdz0myjx6b212lz216dhjc7h0z754c4fh")))) + "1f4s979phyjz8qss10d0fqa4paa6z3wwdz23d9zqgixnamxn48c3")))) (build-system gnu-build-system) ;; Needed to have cflow-mode.el installed. @@ -191,6 +247,35 @@ may help in learning or reviewing unfamiliar code or perhaps highlighting your own code that seemed comprehensible when you wrote it.") (license license:gpl3+))) +(define-public cscope + (package + (name "cscope") + (version "15.9") + (source + (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/cscope/cscope/" + "v" version "/cscope-" version ".tar.gz")) + (sha256 + (base32 "0ngiv4aj3rr35k3q3wjx0y19gh7i1ydqa0cqip6sjwd8fph5ll65")))) + (build-system gnu-build-system) + (inputs (list ncurses)) + (arguments + `(#:configure-flags + ;; Specify the correct ncurses directory to prevent incorrect fallback + ;; on SysV curses. + (list (string-append "--with-ncurses=" + (assoc-ref %build-inputs "ncurses"))))) + (home-page "https://cscope.sourceforge.net") + (synopsis "Tool for browsing source code") + (description + "Cscope is a text screen based source browsing tool. Although it is +primarily designed to search C code (including lex and yacc files), it can +also be used for C++ code. + +Using cscope, you can easily search for where symbols are used and defined.") + (license license:bsd-3))) + (define-public global ; a global variable (package (name "global") @@ -480,68 +565,6 @@ features that are not supported by the standard @code{stdio} implementation.") (license (license:non-copyleft "http://sourceforge.net/p/ctrio/git/ci/master/tree/README")))) -(define-public universal-ctags - (package - (name "universal-ctags") - (version "6.1.20250525.0") - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/universal-ctags/ctags") - (commit (string-append "p" version)))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0nxhmpzkxixb303bsihd5j7n0d29ak2lgnqff920q3dm33y965sy")) - (modules '((guix build utils))) - (snippet - '(begin - ;; Remove the bundled PackCC and associated build rules. - (substitute* "Makefile.am" - (("^PACKCC = .*") - "PACKCC = packcc\n") - (("\\$\\(PACKCC_FILES\\)") - "") - (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)") - "$(PEG_SRCS) $(PEG_HEADS):")) - (delete-file-recursively "misc/packcc"))))) - (build-system gnu-build-system) - (arguments - '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime. - #:configure-flags '("--enable-tmpdir=/tmp") - #:test-target "units" - #:phases (modify-phases %standard-phases - (add-after 'unpack 'make-files-writable - (lambda _ - (for-each make-file-writable (find-files ".")))) - (add-before 'bootstrap 'patch-misc - (lambda _ - ;; The autogen.sh script calls out to these scripts, so - ;; we cannot wait for the patch-source-shebangs phase. - (for-each patch-shebang (find-files "misc")))) - (add-before 'check 'patch-tests - (lambda _ - (substitute* "misc/units" - (("SHELL=/bin/sh") - (string-append "SHELL=" (which "sh")))) - (substitute* "Tmain/utils.sh" - (("/bin/echo") (which "echo")))))))) - (native-inputs - (list autoconf automake packcc perl pkg-config python-docutils)) - (inputs - (list jansson libseccomp libxml2 libyaml pcre2)) - (home-page "https://ctags.io/") - (synopsis "Generate tag files for source code") - (description - "Universal Ctags generates an index (or tag) file of language objects -found in source files for many popular programming languages. This index -makes it easy for text editors and other tools to locate the indexed items. -Universal Ctags improves on traditional ctags because of its multilanguage -support, its ability for the user to define new languages searched by regular -expressions, and its ability to generate emacs-style TAGS files.") - (license license:gpl2+))) - (define-public lcov (package (name "lcov") @@ -596,16 +619,21 @@ functionality such as HTML output.") (define-public lcov-cobertura (package - (name "python-lcov-cobertura") - (version "1.6") + (name "lcov-cobertura") + (version "2.1.1") (source (origin (method url-fetch) (uri (pypi-uri "lcov_cobertura" version)) (sha256 - (base32 - "02ar6yjazlxq4p64cz9gag08bvakmzjrp147jara9wlnlbc96j8g")))) - (build-system python-build-system) + (base32 "13xmr249c6qygm14gilb0icrsgb35ghsrr14a1zvppmxy9jf5a7g")))) + (build-system pyproject-build-system) + (native-inputs + (list python-pytest + python-setuptools + python-setuptools-scm + python-wheel + python-xmldiff)) (home-page "https://eriwen.github.io/lcov-to-cobertura-xml/") (synopsis "LCOV to Cobertura XML converter") (description @@ -683,8 +711,7 @@ possible to collect coverage information without special compiler switches.") (arguments '(#:build-type "RelWithDebInfo" #:configure-flags - '("-DRTAGS_NO_ELISP_FILES=1" - "-DBUILD_TESTING=FALSE") + '("-DRTAGS_NO_ELISP_FILES=1") #:tests? #f)) (native-inputs (list pkg-config)) @@ -923,51 +950,6 @@ extensions over the standard utility.") (properties '((lint-hidden-cves . ("CVE-2023-40305" "CVE-2024-0911"))))))) -(define-public amalgamate - (let* ((commit "c91f07eea1133aa184f652b8f1398eaf03586208") - (revision "0") - (version (git-version "1.1.1" revision commit))) - (package - (name "amalgamate") - (version version) - (home-page "https://github.com/edlund/amalgamate") - (source - (origin - (method git-fetch) - (uri (git-reference - (url home-page) - (commit commit))) - (sha256 - (base32 - "0cllaraw8mxs8q2nr28nhgzkb417gj2wcklqg59w84f4lc78k3yb")) - (file-name (git-file-name name version)) - (modules '((guix build utils))) - (snippet - '(substitute* "test.sh" - (("test_command \"cc -Wall -Wextra -o source.out source.c\"" all) - "test_command \"gcc -Wall -Wextra -o source.out source.c\""))))) - (build-system gnu-build-system) - (inputs (list python-wrapper)) - (arguments - `(#:phases - (modify-phases %standard-phases - (delete 'configure) - (delete 'build) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin"))) - (install-file "amalgamate.py" bin)))) - (replace 'check - (lambda _ - (invoke "./test.sh")))))) - (synopsis "Tool for amalgamating C source and header files") - ;; The package is indeed a script file, and the term "amalgamate.py" is - ;; used by upstream. - (description "amalgamate.py aims to make it easy to use SQLite-style C -source and header amalgamation in projects.") - (license license:bsd-3)))) - (define-public cdecl (package (name "cdecl") @@ -1050,34 +1032,157 @@ type casts and C++. It has command-line editing and history with the GNU Readline library.") (license license:public-domain))) -(define-public cscope +(define-public sourcetrail (package - (name "cscope") - (version "15.9") + (name "sourcetrail") + (version "2.0.0") (source (origin - (method url-fetch) - (uri (string-append "mirror://sourceforge/cscope/cscope/" - "v" version "/cscope-" version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/OpenSourceSourceTrail/Sourcetrail") + (commit version) + (recursive? #t))) + (patches (search-patches "sourcetrail-fix-cmakelists-and-paths.patch")) + (file-name (git-file-name name version)) (sha256 - (base32 "0ngiv4aj3rr35k3q3wjx0y19gh7i1ydqa0cqip6sjwd8fph5ll65")))) - (build-system gnu-build-system) - (inputs (list ncurses)) + "06rp9ba9lkzwm8m7agzajg550h632kqb57bs9srvbgv411bkvgdd") + (modules '((guix build utils))) + (snippet #~(begin + (for-each delete-file-recursively + '(".conan" ".devcontainer" + ".github" + "conanfile.txt" + "scripts" + "bin/app/data/install" + "bin/app/user/log")))))) + (build-system cmake-build-system) (arguments - `(#:configure-flags - ;; Specify the correct ncurses directory to prevent incorrect fallback - ;; on SysV curses. - (list (string-append "--with-ncurses=" - (assoc-ref %build-inputs "ncurses"))))) - (home-page "https://cscope.sourceforge.net") - (synopsis "Tool for browsing source code") + (let* ((split-version (string-split version + (lambda (c) + (or (eqv? c #\.) + (eqv? c #\-))))) + (major-version (first split-version)) + (minor-version (second split-version)) + (version-patch (third split-version))) + (list #:configure-flags #~(list "-DENABLE_UNIT_TEST=true" + "-DENABLE_GUI_TEST=true" + "-DENABLE_INTERGRATION_TEST=true" + (string-append "-DVERSION_MAJOR=" + #$major-version) + (string-append "-DVERSION_MINOR=" + #$minor-version) + (string-append "-DVERSION_PATCH=" + #$version-patch) + "-DLLVM_ENABLE_PROJECTS:STRING=clang" + "-DLLVM_ENABLE_RTTI:BOOL=ON" + "-DCLANG_LINK_CLANG_DYLIB:BOOL=ON" + "-DLLVM_LINK_LLVM_DYLIB:BOOL=ON" + "-DLLVM_TARGETS_TO_BUILD=host" + "-DBUILD_CXX_LANGUAGE_PACKAGE=ON" + (string-append "-DClang_DIR=" + #$clang-19 + "/lib/cmake/clang")) + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/lib_gui/tests/utilityAppTestSuite.cpp" + (("/usr/bin/bash") + (search-input-file inputs "/bin/bash"))) + (substitute* "CMakeLists.txt" + (("@OUTPUT_DIR@") + #$output)))) + (add-after 'install 'install-projects + (lambda _ + (let ((src (string-append #$output + "/share/sourcetrail/user/projects")) + (dst (string-append #$output:projects + "/share/sourcetrail/user/projects"))) + (copy-recursively src dst) + (delete-file-recursively src)))))))) + (inputs (list boost + clang-19 + expected-lite + qt5compat + qtbase + qtnetworkauth + qtsvg + qtwayland + range-v3 + spdlog-1.13 + sqlite + tinyxml)) + (native-inputs (list googletest)) + (home-page "https://github.com/OpenSourceSourceTrail/Sourcetrail") + (synopsis "Graphical cross-platform source code browser for C/C++") (description - "Cscope is a text screen based source browsing tool. Although it is -primarily designed to search C code (including lex and yacc files), it can -also be used for C++ code. + "Sourcetrail is a free and open-source cross-platform source explorer +that helps you get productive on unfamiliar source code. It includes support +for C/C++, providing a graphical means for discovering symbols and their place +in a project.") + (license license:gpl3))) -Using cscope, you can easily search for where symbols are used and defined.") - (license license:bsd-3))) +(define-public universal-ctags + (package + (name "universal-ctags") + (version "6.1.20250525.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/universal-ctags/ctags") + (commit (string-append "p" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0nxhmpzkxixb303bsihd5j7n0d29ak2lgnqff920q3dm33y965sy")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Remove the bundled PackCC and associated build rules. + (substitute* "Makefile.am" + (("^PACKCC = .*") + "PACKCC = packcc\n") + (("\\$\\(PACKCC_FILES\\)") + "") + (("\\$\\(PEG_SRCS\\) \\$\\(PEG_HEADS\\): \\$\\(PACKCC\\)") + "$(PEG_SRCS) $(PEG_HEADS):")) + (delete-file-recursively "misc/packcc"))))) + (build-system gnu-build-system) + (arguments + '(;; Don't use the build-time TMPDIR (/tmp/guix-build-...) at runtime. + #:configure-flags '("--enable-tmpdir=/tmp") + #:test-target "units" + #:phases (modify-phases %standard-phases + (add-after 'unpack 'make-files-writable + (lambda _ + (for-each make-file-writable (find-files ".")))) + (add-before 'bootstrap 'patch-misc + (lambda _ + ;; The autogen.sh script calls out to these scripts, so + ;; we cannot wait for the patch-source-shebangs phase. + (for-each patch-shebang (find-files "misc")))) + (add-before 'check 'patch-tests + (lambda _ + (substitute* "misc/units" + (("SHELL=/bin/sh") + (string-append "SHELL=" (which "sh")))) + (substitute* "Tmain/utils.sh" + (("/bin/echo") (which "echo")))))))) + (native-inputs + (list autoconf automake packcc perl pkg-config python-docutils)) + (inputs + (list jansson libseccomp libxml2 libyaml pcre2)) + (home-page "https://ctags.io/") + (synopsis "Generate tag files for source code") + (description + "Universal Ctags generates an index (or tag) file of language objects +found in source files for many popular programming languages. This index +makes it easy for text editors and other tools to locate the indexed items. +Universal Ctags improves on traditional ctags because of its multilanguage +support, its ability for the user to define new languages searched by regular +expressions, and its ability to generate emacs-style TAGS files.") + (license license:gpl2+))) (define-public xenon (package @@ -1090,9 +1195,16 @@ Using cscope, you can easily search for where symbols are used and defined.") (sha256 (base32 "1yj31bqz2bphvvyb0jkas7bxc2rw76rf1csz0mwmvah8pbc3hxaa")))) - (build-system python-build-system) - (arguments (list #:tests? #f)) ;test suite not shipped with the PyPI archive - (inputs (list python-pyyaml python-radon python-requests)) + (build-system pyproject-build-system) + ;; Test suite not shipped with the PyPI archive; tests in Git require + ;; network access. + (arguments (list #:tests? #f)) + (native-inputs + (list python-setuptools-next)) + (inputs + (list python-pyyaml + python-radon + python-requests)) (home-page "https://xenon.readthedocs.org/") (synopsis "Monitor code metrics for Python on your CI server") (description |