[PATCH 0/2] gnu: Fix bundling in rtags, and change rct to do that.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Fis Trivial
Owner
unassigned
Submitted by
Fis Trivial
Severity
normal

Debbugs page

F
F
Fis Trivial wrote on 21 Jan 2018 11:27
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
MWHPR16MB0063876C4239BC3FB0892CA592ED0@MWHPR16MB0063.namprd16.prod.outlook.com
The bundling issue(1) in rtags is resolved with these patches.
Rct is changed to add missing headers from installation and to enable keeping
RTTI in compilation.
Due to the fact that the original recursive structure is basically hard coded,
patch to cmake file is added. And the substitution in source is to make the
headers from rct as system headers(headers in system path, not sure about the
phase), which is not necessary, just an attempt to make a cleaner break.
I also enabled keeping debug infomation while building rtags by telling cmake
explicitly.
I'm not sure about whether have I written the commit messages in the right way,
please help fixing them.
fis (2):
gnu: rct: Add missing headers, enable RTTI.
gnu: rtags: Fix the bundling issue.
gnu/packages/code.scm | 53 ++++++++-----
gnu/packages/cpp.scm | 6 +-
gnu/packages/patches/rct-add-missing-headers.patch | 43 ++++++++++
gnu/packages/patches/rtags-separate-rct.patch | 92 ++++++++++++++++++++++
4 files changed, 174 insertions(+), 20 deletions(-)
create mode 100644 gnu/packages/patches/rct-add-missing-headers.patch
create mode 100644 gnu/packages/patches/rtags-separate-rct.patch
--
2.13.6
F
F
Fis Trivial wrote on 21 Jan 2018 11:31
[PATCH 1/2] gnu: rct: Add missing headers, enable RTTI.
(name . 30200@debbugs.gnu.org)(address . 30200@debbugs.gnu.org)
MWHPR16MB00635A0E0EA55F9414AB757492ED0@MWHPR16MB0063.namprd16.prod.outlook.com
* gnu/packages/patches/rct-add-missing-headers.patch: New file.
* gnu/packages/cpp.scm (rct): Use the patch, enable RTTI.
[source]: Use the patch to add missing headers from installation.
[arguments]: Enable RTTI in configure-flags.
---
gnu/packages/cpp.scm | 6 ++-
gnu/packages/patches/rct-add-missing-headers.patch | 43 ++++++++++++++++++++++
2 files changed, 47 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/rct-add-missing-headers.patch
Toggle diff (79 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 7f711d554..95e82fcb6 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -68,7 +68,7 @@ operating system functions.")
(define-public rct
(let* ((commit "b3e6f41d9844ef64420e628e0c65ed98278a843a")
- (revision "1")
+ (revision "2")
(version (git-version "0.0.0" revision commit)))
(package
(name "rct")
@@ -82,11 +82,13 @@ operating system functions.")
(sha256
(base32
"1m2931jacka27ghnpgf1z1plkkr64z0pga4r4zdrfpp2d7xnrdvb"))
+ (patches (search-patches "rct-add-missing-headers.patch"))
(file-name (git-file-name name version))))
(build-system cmake-build-system)
(arguments
'(#:configure-flags
- '("-DWITH_TESTS=ON"))) ; To run the test suite
+ '("-DWITH_TESTS=ON" ; To run the test suite
+ "-DRCT_RTTI_ENABLED=ON")))
(native-inputs
`(("cppunit" ,cppunit)
("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/patches/rct-add-missing-headers.patch b/gnu/packages/patches/rct-add-missing-headers.patch
new file mode 100644
index 000000000..8a06197b1
--- /dev/null
+++ b/gnu/packages/patches/rct-add-missing-headers.patch
@@ -0,0 +1,43 @@
+From: fis <ybbs.daans@hotmail.com>
+Date: Sat, 20 Jan 2018 07:42:38 +0800
+Subject: [PATCH] rct.cmake: Add missing headers.
+
+---
+ rct.cmake | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/rct.cmake b/rct.cmake
+index 323e7b9..3e0ac6b 100644
+--- a/rct.cmake
++++ b/rct.cmake
+@@ -339,7 +339,27 @@ if (NOT RCT_NO_INSTALL)
+ rct/Timer.h
+ rct/Value.h
+ rct/WriteLocker.h
++ rct/CpuUsage.h
++ rct/DataFile.h
++ rct/Date.h
++ rct/EmbeddedLinkedList.h
++ rct/FinishMessage.h
++ rct/Flags.h
++ rct/Hash.h
++ rct/LinkedList.h
++ rct/Map.h
++ rct/MemoryMappedFile.h
++ rct/OnDestruction.h
++ rct/QuitMessage.h
++ rct/ResponseMessage.h
++ rct/ScriptEngine.h
++ rct/StackBuffer.h
++ rct/WindowsUnicodeConversion.h
+ DESTINATION include/rct)
+
++ install(FILES
++ json/json.hpp
++ DESTINATION include/rct/json)
++
+ install(EXPORT "rct" DESTINATION lib/cmake)
+ endif ()
+--
+2.13.6
+
--
2.13.6
F
F
Fis Trivial wrote on 21 Jan 2018 11:32
[PATCH 2/2] gnu: rtags: Fix the bundling issue.
(name . 30200@debbugs.gnu.org)(address . 30200@debbugs.gnu.org)
MWHPR16MB0063000E6D4E6B034D3F773692ED0@MWHPR16MB0063.namprd16.prod.outlook.com
* gnu/packages/patches/rtags-separate-rct.patch: New file.
* gnu/packages/code.scm (rtags): Dependencies no longer bundled.
[source]: Use tar ball release.
Use the patch to link rct.
Substitute corresponding headers.
[native-inputs]: Add new dependencies.
[inputs]: Likewise.
---
gnu/packages/code.scm | 53 +++++++++------
gnu/packages/patches/rtags-separate-rct.patch | 92 +++++++++++++++++++++++++++
2 files changed, 127 insertions(+), 18 deletions(-)
create mode 100644 gnu/packages/patches/rtags-separate-rct.patch
Toggle diff (188 lines)
diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm
index 042ea73a8..5d2d176eb 100644
--- a/gnu/packages/code.scm
+++ b/gnu/packages/code.scm
@@ -26,12 +26,14 @@
(define-module (gnu packages code)
#:use-module (guix packages)
#:use-module (guix download)
- #:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix build utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
+ #:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages databases)
#:use-module (gnu packages emacs)
#:use-module (gnu packages gcc)
@@ -43,6 +45,7 @@
#:use-module (gnu packages ncurses)
#:use-module (gnu packages autotools)
#:use-module (gnu packages llvm)
+ #:use-module (gnu packages lua)
#:use-module (gnu packages bash))
;;; Tools to deal with source code: metrics, cross-references, etc.
@@ -393,28 +396,42 @@ functionality such as HTML output.")
(name "rtags")
(version "2.16")
(home-page "https://github.com/Andersbakken/rtags")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url home-page)
- (commit "8ef7554852541eced514c56d5e39d6073f7a2ef9")
-
- ;; FIXME: This fetches bundled copies of Lua, RCT, and
- ;; Selene.
- (recursive? #t)))
- (sha256
- (base32
- "12r7lsqdmcbs9864a6dpblvifqvmfxhvxippyhfnnm2ai5ra80nc"))
- (file-name (git-file-name name version))))
+ (source
+ (origin
+ (method url-fetch)
+ (uri
+ (string-append home-page "/archive/v" version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (patches (search-patches "rtags-separate-rct.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Part of spliting rct with rtags.
+ ;; Substitute #include "rct/header.h" with #include <rct/header.h>.
+ '(with-directory-excursion "src"
+ (let ((files (find-files "." ".*\\.cpp|.*\\.h")))
+ (substitute* files
+ (("#include ?\"rct/(.*.h)\"" all header)
+ (string-append "#include <rct/" header ">"))))))
+ (sha256
+ (base32
+ "17rkci3mmiw93qc32b9x76pg57b0lx80avr6wnmh190jx8n3v3wy"))))
(build-system cmake-build-system)
(arguments
- '(#:configure-flags '("-DBUILD_TESTING=FALSE"
- "-DRTAGS_NO_ELISP_FILES=1")
+ '(#:configure-flags
+ '("-DRTAGS_NO_ELISP_FILES=1"
+ "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
+ "-DCMAKE_CXX_FLAGS=-std=c++11"
+ "-DBUILD_TESTING=FALSE")
#:tests? #f))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
(inputs
- `(("clang" ,clang)
+ `(("bash-completion" ,bash-completion)
+ ("clang" ,clang)
("llvm" ,llvm)
- ("bash-completion" ,bash-completion)))
+ ("lua" ,lua)
+ ("rct" ,rct)
+ ("selene" ,selene)))
(synopsis "Indexer for the C language family with Emacs integration")
(description
"RTags is a client/server application that indexes C/C++ code and keeps a
diff --git a/gnu/packages/patches/rtags-separate-rct.patch b/gnu/packages/patches/rtags-separate-rct.patch
new file mode 100644
index 000000000..3e54a09fc
--- /dev/null
+++ b/gnu/packages/patches/rtags-separate-rct.patch
@@ -0,0 +1,92 @@
+From: fis <ybbs.daans@hotmail.com>
+Date: Sat, 20 Jan 2018 08:55:00 +0800
+Subject: [PATCH] src/CMakelists.txt: Fix include and link rct.
+
+---
+ src/CMakeLists.txt | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index ff4f11f0..e4838e0a 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -105,12 +105,13 @@ if (LUA_ENABLED)
+ CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
+ endif ()
+
+-set(RCT_RTTI_ENABLED 1)
+-set(RCT_NO_INSTALL 1)
+-set(RCT_NO_LIBRARY 1)
++# set(RCT_RTTI_ENABLED 1)
++# set(RCT_NO_INSTALL 1)
++# set(RCT_NO_LIBRARY 1)
++
+ # Everyting which as been set either in rct/rct.cmake or rct/compiler.cmake
+ # doesn't need to be set in this file again.
+-include(rct/rct.cmake)
++# include(rct/rct.cmake)
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
+@@ -128,8 +129,8 @@ add_definitions(
+ "-DRTAGS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-DCLANG_LIBDIR=${LIBCLANG_LIBDIR}"
+ "-DCLANG_VERSION=${LIBCLANG_VERSION_STRING}"
+- "-DOS_${CMAKE_SYSTEM_NAME}"
+- ${RCT_DEFINITIONS})
++ "-DOS_${CMAKE_SYSTEM_NAME}")
++ # ${RCT_DEFINITIONS})
+
+ if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ add_definitions(-D__LONG_LONG_SUPPORTED)
+@@ -172,8 +173,8 @@ set(RTAGS_SOURCES
+ Symbol.cpp
+ SymbolInfoJob.cpp
+ Token.cpp
+- TokensJob.cpp
+- ${RCT_SOURCES})
++ TokensJob.cpp)
++ # ${RCT_SOURCES})
+
+ if (LUA_ENABLED)
+ list(APPEND RTAGS_SOURCES AST.cpp)
+@@ -195,10 +196,11 @@ endif ()
+
+ include_directories(
+ ${CMAKE_CURRENT_LIST_DIR}
+- ${RCT_INCLUDE_DIRS}
++ # ${RCT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_LIST_DIR}/selene/include
+ ${CMAKE_CURRENT_BINARY_DIR}/lua-prefix/src/lua-build
+- ${CMAKE_CURRENT_LIST_DIR}/lua/src)
++ ${CMAKE_CURRENT_LIST_DIR}/lua/src
++ ${CMAKE_CURRENT_BINARY_DIR}/include)
+
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ set(START_GROUP "")
+@@ -223,17 +225,18 @@ else ()
+ endif()
+
+ # RCT_LIBRARIES and stdc++ library must be at the end
+-set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES})
++# set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES})
++set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++)
+ add_executable(rc rc.cpp)
+-target_link_libraries(rc ${RTAGS_LIBRARIES})
++target_link_libraries(rc ${RTAGS_LIBRARIES} rct)
+
+ add_executable(rdm rdm.cpp)
+-target_link_libraries(rdm ${RTAGS_LIBRARIES})
++target_link_libraries(rdm ${RTAGS_LIBRARIES} rct)
+
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+
+ add_executable(rp rp.cpp)
+-target_link_libraries(rp ${RTAGS_LIBRARIES})
++target_link_libraries(rp ${RTAGS_LIBRARIES} rct)
+
+ if (CYGWIN)
+ EnsureLibraries(rdm rct)
+--
+2.13.6
+
--
2.13.6
L
L
Ludovic Courtès wrote on 23 Jan 2018 01:29
Re: [bug#30200] [PATCH 1/2] gnu: rct: Add missing headers, enable RTTI.
(name . Fis Trivial)(address . ybbs.daans@hotmail.com)(name . 30200@debbugs.gnu.org)(address . 30200@debbugs.gnu.org)
87tvvc7wk0.fsf@gnu.org
Fis Trivial <ybbs.daans@hotmail.com> skribis:

Toggle quote (5 lines)
> * gnu/packages/patches/rct-add-missing-headers.patch: New file.
> * gnu/packages/cpp.scm (rct): Use the patch, enable RTTI.
> [source]: Use the patch to add missing headers from installation.
> [arguments]: Enable RTTI in configure-flags.

I added the patch to gnu/local.mk and committed.

It would be nice if you could report the issue with missing headers
upstream.

Ludo’.
L
L
Ludovic Courtès wrote on 23 Jan 2018 01:43
Re: [bug#30200] [PATCH 2/2] gnu: rtags: Fix the bundling issue.
(name . Fis Trivial)(address . ybbs.daans@hotmail.com)(name . 30200-done@debbugs.gnu.org)(address . 30200@debbugs.gnu.org)
87po607vwf.fsf@gnu.org
Fis Trivial <ybbs.daans@hotmail.com> skribis:

Toggle quote (8 lines)
> * gnu/packages/patches/rtags-separate-rct.patch: New file.
> * gnu/packages/code.scm (rtags): Dependencies no longer bundled.
> [source]: Use tar ball release.
> Use the patch to link rct.
> Substitute corresponding headers.
> [native-inputs]: Add new dependencies.
> [inputs]: Likewise.

I slightly tweaked the commit message, but overall it was good. :-)

I applied the changes below, mostly to clarify the patch by removing
lines instead of commenting them out.

Thanks!

Ludo’.
Toggle diff (138 lines)
diff --git a/gnu/packages/code.scm b/gnu/packages/code.scm
index 5d2d176eb..a26768862 100644
--- a/gnu/packages/code.scm
+++ b/gnu/packages/code.scm
@@ -27,7 +27,6 @@
#:use-module (guix packages)
#:use-module (guix download)
#:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix build utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
#:use-module (gnu packages)
@@ -408,6 +407,7 @@ functionality such as HTML output.")
;; Part of spliting rct with rtags.
;; Substitute #include "rct/header.h" with #include <rct/header.h>.
'(with-directory-excursion "src"
+ (delete-file-recursively "rct") ;remove bundled copy
(let ((files (find-files "." ".*\\.cpp|.*\\.h")))
(substitute* files
(("#include ?\"rct/(.*.h)\"" all header)
diff --git a/gnu/packages/patches/rtags-separate-rct.patch b/gnu/packages/patches/rtags-separate-rct.patch
index b2e496d8c..533e28b02 100644
--- a/gnu/packages/patches/rtags-separate-rct.patch
+++ b/gnu/packages/patches/rtags-separate-rct.patch
@@ -1,92 +1,72 @@
-From: fis <ybbs.daans@hotmail.com>
-Date: Sat, 20 Jan 2018 08:55:00 +0800
-Subject: [PATCH] src/CMakelists.txt: Fix include and link rct.
+Unbundle RCT and use our own copy.
----
- src/CMakeLists.txt | 31 +++++++++++++++++--------------
- 1 file changed, 17 insertions(+), 14 deletions(-)
-
-diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index ff4f11f0..e4838e0a 100644
---- a/src/CMakeLists.txt
-+++ b/src/CMakeLists.txt
-@@ -105,12 +105,13 @@ if (LUA_ENABLED)
+--- rtags-2.16/src/CMakeLists.txt 2018-01-23 10:36:17.645855140 +0100
++++ rtags-2.16/src/CMakeLists.txt 2018-01-23 10:38:14.605234740 +0100
+@@ -105,12 +105,6 @@ if (LUA_ENABLED)
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DCMAKE_GENERATOR=${CMAKE_GENERATOR})
endif ()
-
+
-set(RCT_RTTI_ENABLED 1)
-set(RCT_NO_INSTALL 1)
-set(RCT_NO_LIBRARY 1)
-+# set(RCT_RTTI_ENABLED 1)
-+# set(RCT_NO_INSTALL 1)
-+# set(RCT_NO_LIBRARY 1)
-+
- # Everyting which as been set either in rct/rct.cmake or rct/compiler.cmake
- # doesn't need to be set in this file again.
+-# Everyting which as been set either in rct/rct.cmake or rct/compiler.cmake
+-# doesn't need to be set in this file again.
-include(rct/rct.cmake)
-+# include(rct/rct.cmake)
-
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-aliasing=2 -Wcast-qual -fPIC")
-@@ -128,8 +129,8 @@ add_definitions(
+@@ -128,8 +122,7 @@ add_definitions(
"-DRTAGS_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
"-DCLANG_LIBDIR=${LIBCLANG_LIBDIR}"
"-DCLANG_VERSION=${LIBCLANG_VERSION_STRING}"
- "-DOS_${CMAKE_SYSTEM_NAME}"
- ${RCT_DEFINITIONS})
+ "-DOS_${CMAKE_SYSTEM_NAME}")
-+ # ${RCT_DEFINITIONS})
-
+
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-D__LONG_LONG_SUPPORTED)
-@@ -172,8 +173,8 @@ set(RTAGS_SOURCES
+@@ -172,8 +165,7 @@ set(RTAGS_SOURCES
Symbol.cpp
SymbolInfoJob.cpp
Token.cpp
- TokensJob.cpp
- ${RCT_SOURCES})
+ TokensJob.cpp)
-+ # ${RCT_SOURCES})
-
+
if (LUA_ENABLED)
list(APPEND RTAGS_SOURCES AST.cpp)
-@@ -195,10 +196,11 @@ endif ()
-
+@@ -195,10 +187,10 @@ endif ()
+
include_directories(
${CMAKE_CURRENT_LIST_DIR}
- ${RCT_INCLUDE_DIRS}
-+ # ${RCT_INCLUDE_DIRS}
${CMAKE_CURRENT_LIST_DIR}/selene/include
${CMAKE_CURRENT_BINARY_DIR}/lua-prefix/src/lua-build
- ${CMAKE_CURRENT_LIST_DIR}/lua/src)
+ ${CMAKE_CURRENT_LIST_DIR}/lua/src
+ ${CMAKE_CURRENT_BINARY_DIR}/include)
-
+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(START_GROUP "")
-@@ -223,17 +225,18 @@ else ()
+@@ -223,17 +215,17 @@ else ()
endif()
-
+
# RCT_LIBRARIES and stdc++ library must be at the end
-set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES})
-+# set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++ ${RCT_LIBRARIES})
+set(RTAGS_LIBRARIES ${RTAGS_LIBRARIES} -lstdc++)
add_executable(rc rc.cpp)
-target_link_libraries(rc ${RTAGS_LIBRARIES})
+target_link_libraries(rc ${RTAGS_LIBRARIES} rct)
-
+
add_executable(rdm rdm.cpp)
-target_link_libraries(rdm ${RTAGS_LIBRARIES})
+target_link_libraries(rdm ${RTAGS_LIBRARIES} rct)
-
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
-
+
add_executable(rp rp.cpp)
-target_link_libraries(rp ${RTAGS_LIBRARIES})
+target_link_libraries(rp ${RTAGS_LIBRARIES} rct)
-
+
if (CYGWIN)
EnsureLibraries(rdm rct)
---
-2.13.6
-
L
L
Ludovic Courtès wrote on 31 Jan 2018 14:56
control message for bug #30200
(address . control@debbugs.gnu.org)
87a7wtr61t.fsf@gnu.org
tags 30200 fixed
close 30200
?
Your comment

This issue is archived.

To comment on this conversation send an email to 30200@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 30200
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch