Gentoo Archives: gentoo-commits

From: Alessandro Barbieri <lssndrbarbieri@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-mathematics/clingo/files/, sci-mathematics/clingo/
Date: Thu, 28 Apr 2022 05:57:45
Message-Id: 1651125451.3820d604d8ff4840b528a9ec38406ffcdf87d1be.Alessandro-Barbieri@gentoo
1 commit: 3820d604d8ff4840b528a9ec38406ffcdf87d1be
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Thu Apr 28 05:37:18 2022 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Thu Apr 28 05:57:31 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3820d604
7
8 sci-mathematics/clingo: new package, add 5.5.1
9
10 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
11
12 sci-mathematics/clingo/Manifest | 1 +
13 sci-mathematics/clingo/clingo-5.5.1.ebuild | 79 ++++++++++++++++++++++
14 .../clingo/files/clingo-5.5.1-system-clasp.patch | 56 +++++++++++++++
15 sci-mathematics/clingo/metadata.xml | 16 +++++
16 4 files changed, 152 insertions(+)
17
18 diff --git a/sci-mathematics/clingo/Manifest b/sci-mathematics/clingo/Manifest
19 new file mode 100644
20 index 000000000..f65222b9f
21 --- /dev/null
22 +++ b/sci-mathematics/clingo/Manifest
23 @@ -0,0 +1 @@
24 +DIST clingo-5.5.1.tar.gz 3031728 BLAKE2B 5d938f5974184b4dff63a8b6ae746059c8a3682c2b7ca3dfbecc020462a656608de3845b83fc1c55fe74be33d7641d4d3bc961026679c7a6b264481bbad81c89 SHA512 b142a869d25a188d9ecf4c62940bc73328dacd249dbcdf611c0b6fd7a15b6bb15357cef3ce9b52b863c51f2a79efd65ae405957fc6074023b0c48807d27c0e03
25
26 diff --git a/sci-mathematics/clingo/clingo-5.5.1.ebuild b/sci-mathematics/clingo/clingo-5.5.1.ebuild
27 new file mode 100644
28 index 000000000..f49bad27d
29 --- /dev/null
30 +++ b/sci-mathematics/clingo/clingo-5.5.1.ebuild
31 @@ -0,0 +1,79 @@
32 +# Copyright 1999-2022 Gentoo Foundation
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +LUA_COMPAT=( lua5-{3..4} )
38 +PYTHON_COMPAT=( python3_{8..10} ) # IDK how to pass pypy3
39 +
40 +inherit cmake lua-single python-single-r1 toolchain-funcs
41 +
42 +DESCRIPTION="Integrated grounder and solver for answer set logic programs"
43 +HOMEPAGE="
44 + https://github.com/potassco/clingo
45 + https://potassco.org/clingo
46 +"
47 +SRC_URI="https://github.com/potassco/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
48 +
49 +LICENSE="MIT"
50 +SLOT="0"
51 +KEYWORDS="~amd64"
52 +
53 +IUSE="examples lua python test +tools"
54 +
55 +RDEPEND="
56 + sci-mathematics/clasp:=[tools]
57 + sci-mathematics/libpotassco:=
58 + lua? ( ${LUA_DEPS} )
59 + python? ( ${PYTHON_DEPS} )
60 +"
61 +DEPEND="${RDEPEND}"
62 +BDEPEND="
63 + >=dev-util/re2c-0.13.5
64 + >=sys-devel/bison-2.5
65 + virtual/pkgconfig
66 +"
67 +
68 +PATCHES=( "${FILESDIR}/${P}-system-clasp.patch" )
69 +RESTRICT="!test? ( test )"
70 +REQUIRED_USE="
71 + lua? ( ${LUA_REQUIRED_USE} )
72 + python? ( ${PYTHON_REQUIRED_USE} )
73 +"
74 +
75 +pkg_setup() {
76 + use lua && lua-single_pkg_setup
77 + use python && python-single-r1_pkg_setup
78 +}
79 +
80 +src_prepare() {
81 + rm -r clasp || die
82 + cmake_src_prepare
83 +}
84 +
85 +src_configure() {
86 + local mycmakeargs=(
87 + -DCLINGO_BUILD_APPS=$(usex tools)
88 + -DCLINGO_BUILD_EXAMPLES=$(usex examples)
89 + -DCLINGO_BUILD_TESTS=$(usex test)
90 + -DCLINGO_BUILD_WITH_LUA=$(usex lua)
91 + -DCLINGO_BUILD_WITH_PYTHON=$(usex python)
92 +
93 + -DCLINGO_BUILD_STATIC=OFF
94 + -DCLINGO_BUILD_WEB=OFF
95 + -DCLINGO_CMAKE_AR="$(tc-getAR)"
96 + -DCLINGO_CMAKE_RANLIB="$(tc-getRANLIB)"
97 + -DCLINGO_INSTALL_LIB=ON
98 + -DCLINGO_USE_LIB=OFF
99 + )
100 + if use lua; then
101 + mycmakeargs+=( "-DCLINGO_LUA_VERSION:LIST=$(lua_get_version);EXACT" )
102 + mycmakeargs+=( "-DLUACLINGO_INSTALL_DIR=$(lua_get_cmod_dir)" )
103 + fi
104 + if use python; then
105 + local pyversion="${EPYTHON/python/}"
106 + mycmakeargs+=( "-DCLINGO_PYTHON_VERSION:LIST=${pyversion};EXACT" )
107 + mycmakeargs+=( "-DPYCLINGO_INSTALL_DIR=$(python_get_sitedir)" )
108 + fi
109 + cmake_src_configure
110 +}
111
112 diff --git a/sci-mathematics/clingo/files/clingo-5.5.1-system-clasp.patch b/sci-mathematics/clingo/files/clingo-5.5.1-system-clasp.patch
113 new file mode 100644
114 index 000000000..0eadf4fda
115 --- /dev/null
116 +++ b/sci-mathematics/clingo/files/clingo-5.5.1-system-clasp.patch
117 @@ -0,0 +1,56 @@
118 +diff '--color=auto' -ru /var/tmp/portage/sci-mathematics/clingo-5.5.1/work/clingo-5.5.1/CMakeLists.txt clingo-5.5.1/CMakeLists.txt
119 +--- /var/tmp/portage/sci-mathematics/clingo-5.5.1/work/clingo-5.5.1/CMakeLists.txt 2022-04-28 06:09:26.673973864 +0200
120 ++++ clingo-5.5.1/CMakeLists.txt 2022-04-28 06:27:47.090303346 +0200
121 +@@ -232,20 +232,15 @@
122 +
123 + enable_testing()
124 +
125 +-# NOTE: assumes that submodule has been initialized
126 +-set(CLASP_BUILD_APP ${CLINGO_BUILD_APPS} CACHE BOOL "")
127 + if (CLINGO_USE_LIB)
128 + set(clingo_library_targets)
129 + add_library(libclingo INTERFACE IMPORTED)
130 + set_property(TARGET libclingo PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CLINGO_SOURCE_DIR}/libclingo")
131 + set_property(TARGET libclingo PROPERTY INTERFACE_LINK_LIBRARIES "clingo")
132 + else()
133 ++ find_package(Potassco REQUIRED)
134 ++ find_package(Clasp REQUIRED)
135 + set(clingo_library_targets libgringo libpotassco libclasp libreify)
136 +- set(CLASP_USE_LOCAL_LIB_POTASSCO ON CACHE BOOL "" FORCE)
137 +- if (NOT CLINGO_BUILD_SHARED AND CLINGO_INSTALL_LIB)
138 +- set(CLASP_INSTALL_LIB ${CLINGO_INSTALL_LIB} CACHE BOOL "" FORCE)
139 +- endif()
140 +- add_subdirectory(clasp)
141 + add_subdirectory(libreify)
142 + add_subdirectory(libgringo)
143 + add_subdirectory(libclingo)
144 +diff '--color=auto' -ru /var/tmp/portage/sci-mathematics/clingo-5.5.1/work/clingo-5.5.1/libclingo/CMakeLists.txt clingo-5.5.1/libclingo/CMakeLists.txt
145 +--- /var/tmp/portage/sci-mathematics/clingo-5.5.1/work/clingo-5.5.1/libclingo/CMakeLists.txt 2022-04-28 06:09:26.590972375 +0200
146 ++++ clingo-5.5.1/libclingo/CMakeLists.txt 2022-04-28 07:12:59.047212489 +0200
147 +@@ -37,9 +37,6 @@
148 + ${source-group})
149 + # ]]]
150 +
151 +-list(APPEND header "${CLASP_SOURCE_DIR}/app/clasp_app.h")
152 +-list(APPEND source "${CLASP_SOURCE_DIR}/app/clasp_app.cpp")
153 +-
154 + set(clingo_public_scope_ PUBLIC)
155 + set(clingo_private_scope_ PRIVATE)
156 + if (CLINGO_BUILD_SHARED)
157 +@@ -56,13 +53,14 @@
158 +
159 + add_library(libclingo ${clingo_lib_type})
160 + target_sources(libclingo ${clingo_private_scope_} ${header} ${source})
161 +-target_link_libraries(libclingo ${clingo_private_scope_} libgringo libclasp)
162 ++target_link_libraries(libclingo ${clingo_private_scope_} libgringo libclasp -lclasp_app)
163 + target_include_directories(libclingo
164 + ${clingo_public_scope_}
165 + "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
166 + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
167 + ${clingo_private_scope_}
168 +- "$<BUILD_INTERFACE:${CLASP_SOURCE_DIR}/app>")
169 ++ "/usr/include/clasp/app"
170 ++)
171 + target_compile_definitions(libclingo ${clingo_private_scope_} CLINGO_BUILD_LIBRARY)
172 +
173 + if (NOT CLINGO_BUILD_SHARED)
174
175 diff --git a/sci-mathematics/clingo/metadata.xml b/sci-mathematics/clingo/metadata.xml
176 new file mode 100644
177 index 000000000..f20bd00a3
178 --- /dev/null
179 +++ b/sci-mathematics/clingo/metadata.xml
180 @@ -0,0 +1,16 @@
181 +<?xml version="1.0" encoding="UTF-8"?>
182 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
183 +<pkgmetadata>
184 + <maintainer type="person">
185 + <description>co-maintainers welcome</description>
186 + <email>lssndrbarbieri@×××××.com</email>
187 + <name>Alessandro Barbieri</name>
188 + </maintainer>
189 + <use>
190 + <flag name="tools">whether or not to build the clingo tool</flag>
191 + </use>
192 + <upstream>
193 + <bugs-to>https://github.com/potassco/clingo/issues</bugs-to>
194 + <remote-id type="github">potassco/clingo</remote-id>
195 + </upstream>
196 +</pkgmetadata>