unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: phodina via Guix-patches via <guix-patches@gnu.org>
To: 59765@debbugs.gnu.org
Subject: [bug#59765] Add Sourcetrail
Date: Fri, 02 Dec 2022 07:18:38 +0000	[thread overview]
Message-ID: <ATA5SJyXZ9f6XKftIRk4OdQUebQ-1m-OweW3XZgoQEn_TiC_ShsXfwdZXwd66tIF_zIyIv2nkoDybLflXj3e-t7rhI1l8Fh0Yjpzu08hLTw=@protonmail.com> (raw)


[-- 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


             reply	other threads:[~2022-12-02  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02  7:18 phodina via Guix-patches via [this message]
2023-04-23 14:27 ` [bug#59765] Add Sourcetrail Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ATA5SJyXZ9f6XKftIRk4OdQUebQ-1m-OweW3XZgoQEn_TiC_ShsXfwdZXwd66tIF_zIyIv2nkoDybLflXj3e-t7rhI1l8Fh0Yjpzu08hLTw=@protonmail.com' \
    --to=guix-patches@gnu.org \
    --cc=59765@debbugs.gnu.org \
    --cc=phodina@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).