unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59765] Add Sourcetrail
@ 2022-12-02  7:18 phodina via Guix-patches via
  2023-04-23 14:27 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: phodina via Guix-patches via @ 2022-12-02  7:18 UTC (permalink / raw)
  To: 59765


[-- Attachment #1.1: Type: text/plain, Size: 113 bytes --]

Hello,

these patches add Sourcetrail code analysis tool, which unfortunately is not longer developed.

----
Petr

[-- Attachment #1.2: Type: text/html, Size: 279 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-boost-for-sourcetrail.patch --]
[-- Type: text/x-patch; name=0001-gnu-Add-boost-for-sourcetrail.patch, Size: 7029 bytes --]

From 2c2b9856f3b5af00d2d3c4c2c569ef830219c1bc Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Thu, 11 Nov 2021 19:19:18 +0100
Subject: [PATCH 1/2] gnu: Add boost-for-sourcetrail.

* gnu/packages/boost.scm (boost-for-sourcetrail): New variable.
* gnu/packages/patches/boost-fix-icu-build.patch: New file.
* gnu/local.mk: Add patch.

diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 40e4ca399e..a3899d0419 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -303,6 +303,86 @@ (define-public boost-static
                    (symlink libboost_pythonNN.a "libboost_python.a"))
                  #t)))))))))
 
+(define-public boost-for-sourcetrail
+  ;; Older version for Sourcetrail 1.1.30.
+  (package
+    (name "boost")
+    (version "1.67.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://sourceforge/boost/boost/" version "/boost_"
+                    (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
+                    ".tar.bz2"))
+              (sha256
+               (base32
+                "1fmdlmkzsrd46wwk834jsi2ypxj68w2by0rfcg2pzrafk5rck116"))
+              (patches (search-patches "boost-fix-icu-build.patch"))))
+    (build-system gnu-build-system)
+    (inputs `(("icu4c" ,icu4c)
+              ("zlib" ,zlib)))
+    (native-inputs
+     `(("perl" ,perl)
+       ("python" ,python-2)
+       ("tcsh" ,tcsh)))
+    (arguments
+     `(#:tests? #f
+       #:make-flags
+       (list "threading=multi" "link=shared"
+
+             ;; Set the RUNPATH to $libdir so that the libs find each other.
+             (string-append "linkflags=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib")
+
+             ;; Boost's 'context' library is not yet supported on mips64, so
+             ;; we disable it.  The 'coroutine' library depends on 'context',
+             ;; so we disable that too.
+             ,@(if (string-prefix? "mips64" (or (%current-target-system)
+                                                (%current-system)))
+                   '("--without-context"
+                     "--without-coroutine" "--without-coroutine2")
+                   '()))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'bootstrap)
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((icu (assoc-ref inputs "icu4c"))
+                   (out (assoc-ref outputs "out")))
+               (substitute* '("libs/config/configure"
+                              "libs/spirit/classic/phoenix/test/runtest.sh"
+                              "tools/build/doc/bjam.qbk"
+                              "tools/build/src/engine/execunix.c"
+                              "tools/build/src/engine/Jambase"
+                              "tools/build/src/engine/jambase.c")
+                 (("/bin/sh") (which "sh")))
+
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+
+               (invoke "./bootstrap.sh"
+                       (string-append "--prefix=" out)
+                       ;; Auto-detection looks for ICU only in traditional
+                       ;; install locations.
+                       (string-append "--with-icu=" icu)
+                       "--with-toolset=gcc"))))
+         (replace 'build
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "./b2"
+                    (format #f "-j~a" (parallel-job-count))
+                    make-flags)))
+         (replace 'install
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "./b2" "install" make-flags))))))
+
+    (home-page "http://www.boost.org")
+    (synopsis "Peer-reviewed portable C++ source libraries")
+    (description
+     "A collection of libraries intended to be widely useful, and usable
+across a broad spectrum of applications.")
+    (license (license:x11-style "http://www.boost.org/LICENSE_1_0.txt"
+                                "Some components have other similar licences."))))
+
 (define-public boost-for-mysql
   ;; Older version for MySQL 5.7.23.
   (package
diff --git a/gnu/packages/patches/boost-fix-icu-build.patch b/gnu/packages/patches/boost-fix-icu-build.patch
new file mode 100644
index 0000000000..556f91b8f7
--- /dev/null
+++ b/gnu/packages/patches/boost-fix-icu-build.patch
@@ -0,0 +1,53 @@
+Pass -std=c++11 when compiling files that include the ICU headers.  Without
+this flag, compilation fails and causes Boost's build system to remove ICU
+support.  Note that $(pkg-config --variable=CXXFLAGS icu-uc) includes
+"-std=c++11", but Boost's build system does not use 'pkg-config'.
+
+--- boost_1_66_0/libs/locale/build/Jamfile.v2.orig	2017-12-13 18:56:44.000000000 -0500
++++ boost_1_66_0/libs/locale/build/Jamfile.v2	2018-04-08 15:18:58.673025760 -0400
+@@ -65,8 +65,8 @@
+ 
+ if $(ICU_LINK)
+ {
+-    ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
+-    ICU64_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
++    ICU_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <runtime-link>shared ;
++    ICU64_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin64 <runtime-link>shared ;
+ }
+ else
+ {
+@@ -121,6 +121,7 @@
+     explicit icuuc icudt icuin ;
+ 
+     ICU_OPTS =   <include>$(ICU_PATH)/include 
++      <cxxflags>-std=c++11
+       <library>icuuc/<link>shared/<runtime-link>shared 
+       <library>icudt/<link>shared/<runtime-link>shared 
+       <library>icuin/<link>shared/<runtime-link>shared
+@@ -180,6 +181,7 @@
+     explicit icuuc_64 icudt_64 icuin_64 ;
+ 
+     ICU64_OPTS =   <include>$(ICU_PATH)/include 
++      <cxxflags>-std=c++11
+       <library>icuuc_64/<link>shared/<runtime-link>shared 
+       <library>icudt_64/<link>shared/<runtime-link>shared 
+       <library>icuin_64/<link>shared/<runtime-link>shared
+--- boost_1_66_0/libs/regex/build/Jamfile.v2.orig	2017-12-13 18:56:48.000000000 -0500
++++ boost_1_66_0/libs/regex/build/Jamfile.v2	2018-04-08 15:20:40.865532505 -0400
+@@ -44,7 +44,7 @@
+ 
+    if $(ICU_LINK)
+    {
+-      ICU_OPTS = <include>$(ICU_PATH)/include <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
++      ICU_OPTS = <include>$(ICU_PATH)/include <cxxflags>-std=c++11 <linkflags>$(ICU_LINK) <dll-path>$(ICU_PATH)/bin <define>BOOST_HAS_ICU=1 <runtime-link>shared ;
+    }
+    else
+    {
+@@ -78,6 +78,7 @@
+ 
+       ICU_OPTS = 
+          <include>$(ICU_PATH)/include 
++         <cxxflags>-std=c++11
+          <runtime-link>shared:<library>icuuc/<link>shared
+          <runtime-link>shared:<library>icudt/<link>shared
+          <runtime-link>shared:<library>icuin/<link>shared
-- 
2.38.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-gnu-Add-sourcetrail.patch --]
[-- Type: text/x-patch; name=0002-gnu-Add-sourcetrail.patch, Size: 2476 bytes --]

From 015a65f27f46bbdad3e07dbabc5154609ae6ec2d Mon Sep 17 00:00:00 2001
From: Petr Hodina <phodina@protonmail.com>
Date: Thu, 11 Nov 2021 19:21:44 +0100
Subject: [PATCH 2/2] gnu: Add sourcetrail.

* gnu/packages/qt.scm (sourcetrail): New variable.

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 30bf429897..540959bbbc 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -62,6 +62,7 @@ (define-module (gnu packages qt)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages boost)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cups)
@@ -4261,6 +4262,46 @@ (define-public qhexedit
 data.")
     (license license:lgpl2.1)))
 
+(define-public sourcetrail
+(package
+  (name "sourcetrail")
+  (version "2021.1.30")
+  (source (origin
+            (method git-fetch)
+            (uri (git-reference
+             (url "https://github.com/CoatiSoftware/Sourcetrail")
+             (commit version)))
+            (file-name (git-file-name name version))
+            (sha256
+             (base32
+              "0h0q2bfa6dv8hmc15rzj48bna1krzjwlcjm25dffbsi81xjcazb5"))))
+  (build-system cmake-build-system)
+  (arguments
+    (list #:configure-flags #~(list "-DBoost_USE_STATIC_LIBS=OFF" (string-append
+	"-DBOOST_ROOT=" #$(this-package-input "boost") "/lib"))
+      #:phases
+      #~(modify-phases %standard-phases
+       (replace 'install
+        (lambda* (#:key outputs #:allow-other-keys)
+		 (let* ((out #$output)
+		       (prefix (string-append out "/opt/sourcetrail"))
+			   (build (getcwd))
+			   (share (string-append prefix "/share")))
+		       (mkdir-p (string-append out "/bin"))
+			   (install-file (string-append build "/app/Sourcetrail") (string-append
+			   out "/bin"))
+			   (install-file (string-append build
+			   "/app/sourcetrail_indexer") (string-append
+			   out "/bin"))))))))
+  (native-inputs (list pkg-config))
+  (inputs (list boost-for-sourcetrail
+            qtbase-5
+            qtsvg-5))
+  (synopsis "Interactive source explorer")
+  (description "Offline source explorer that helps you get productive on unfamiliar source code with optional IDE integration.")
+  (home-page "https://www.sourcetrail.com")
+  (license license:gpl3)))
+
 (define-public soqt
   (let ((commit-ref "fb8f655632bb9c9c60e0ff9fa69a5ba22d3ff99d")
         (revision "1"))
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [bug#59765] Add Sourcetrail
  2022-12-02  7:18 [bug#59765] Add Sourcetrail phodina via Guix-patches via
@ 2023-04-23 14:27 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2023-04-23 14:27 UTC (permalink / raw)
  To: 59765; +Cc: phodina

Hello,

phodina via Guix-patches via <guix-patches@gnu.org> writes:


> these patches add Sourcetrail code analysis tool,

Thank you.

> which unfortunately is not longer developed.

This doesn't sound too good. I notice there is a somewhat active fork at
<https://github.com/OpenSourceSourceTrail/Sourcetrail>. Would it make
sense to use it instead?

> +(define-public boost-for-sourcetrail
> +  ;; Older version for Sourcetrail 1.1.30.
> +  (package
> +    (name "boost")
> +    (version "1.67.0")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "mirror://sourceforge/boost/boost/" version "/boost_"
> +                    (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
> +                    ".tar.bz2"))
> +              (sha256
> +               (base32
> +                "1fmdlmkzsrd46wwk834jsi2ypxj68w2by0rfcg2pzrafk5rck116"))
> +              (patches (search-patches "boost-fix-icu-build.patch"))))
> +    (build-system gnu-build-system)
> +    (inputs `(("icu4c" ,icu4c)
> +              ("zlib" ,zlib)))
> +    (native-inputs
> +     `(("perl" ,perl)
> +       ("python" ,python-2)

Guix has dropped support for Python 2, so this Boost package is not
really an option. Is it possible to use a more recent Boost library?

> +(define-public sourcetrail
> +(package
> +  (name "sourcetrail")
> +  (version "2021.1.30")
> +  (source (origin
> +            (method git-fetch)
> +            (uri (git-reference
> +             (url "https://github.com/CoatiSoftware/Sourcetrail")
> +             (commit version)))
> +            (file-name (git-file-name name version))
> +            (sha256
> +             (base32
> +              "0h0q2bfa6dv8hmc15rzj48bna1krzjwlcjm25dffbsi81xjcazb5"))))
> +  (build-system cmake-build-system)
> +  (arguments
> +    (list #:configure-flags #~(list "-DBoost_USE_STATIC_LIBS=OFF" (string-append
> +	"-DBOOST_ROOT=" #$(this-package-input "boost") "/lib"))

README mentions build process should also set Qt5_DIR configure flag.

> +      #:phases
> +      #~(modify-phases %standard-phases
> +       (replace 'install
> +        (lambda* (#:key outputs #:allow-other-keys)
> +		 (let* ((out #$output)
> +		       (prefix (string-append out "/opt/sourcetrail"))
> +			   (build (getcwd))
> +			   (share (string-append prefix "/share")))
> +		       (mkdir-p (string-append out "/bin"))
> +			   (install-file (string-append build "/app/Sourcetrail") (string-append
> +			   out "/bin"))
> +			   (install-file (string-append build
> +			   "/app/sourcetrail_indexer") (string-append
> +			   out "/bin"))))))))

Indentation is a bit off.

> +  (native-inputs (list pkg-config))
> +  (inputs (list boost-for-sourcetrail
> +            qtbase-5
> +            qtsvg-5))
> +  (synopsis "Interactive source explorer")
> +  (description "Offline source explorer that helps you get productive on unfamiliar source code with optional IDE integration.")

Description should consist of full sentences.

Although this review is a bit late, would you like to try sending an
updated patch?

Regards,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-23 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02  7:18 [bug#59765] Add Sourcetrail phodina via Guix-patches via
2023-04-23 14:27 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).