Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/jsonnet/, dev-lang/jsonnet/files/
Date: Thu, 06 Jan 2022 18:15:21
Message-Id: 1641492905.de7834746390e34af62816986e2d0608a0b0f540.chutzpah@gentoo
1 commit: de7834746390e34af62816986e2d0608a0b0f540
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 6 18:15:05 2022 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 6 18:15:05 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de783474
7
8 dev-lang/jsonnet: Version bump to 0.18.0
9
10 Unbundle nlohmann_json
11
12 Package-Manager: Portage-3.0.30, Repoman-3.0.3
13 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
14
15 dev-lang/jsonnet/Manifest | 1 +
16 .../jsonnet/files/jsonnet-0.18.0-unbundle.patch | 75 +++++++++++++++
17 dev-lang/jsonnet/jsonnet-0.18.0.ebuild | 102 +++++++++++++++++++++
18 3 files changed, 178 insertions(+)
19
20 diff --git a/dev-lang/jsonnet/Manifest b/dev-lang/jsonnet/Manifest
21 index 125cb3172b14..1ebf61717120 100644
22 --- a/dev-lang/jsonnet/Manifest
23 +++ b/dev-lang/jsonnet/Manifest
24 @@ -1,3 +1,4 @@
25 DIST jsonnet-0.15.0.tar.gz 21826038 BLAKE2B 722a844c00ec31b662d932a4481a71197adad680181c6a56a49dfa3e9b63696d29320c5278024d44c0ab3d7d80569514792f815ac7fa3a3cc08c7756fb6f08ad SHA512 b63c1bf82e4fc9ba3f1009ed4e4ba1010e3e7f81bd816a234e48d35607eae3cba95cab57813d35daa9f024e316bae5256340a6f8d6d884f9136cdbf062a2b351
26 DIST jsonnet-0.16.0.tar.gz 21828911 BLAKE2B d6e9648e259b94513507ba5a6e305f705541904d7755dc5521b7fc2940b761f413bfaba39521af54eb428337be2e75f07d12038edcf7e8a5ba95feccc8dd4a02 SHA512 80e0403ec8008cbacff8d9e8fe0e2b5d3bfa306d92c2c11d472e5721015ce4c11be745df10d25715f22f8d8594df69fabf2fe617bdded462ffc5b21f8923606f
27 DIST jsonnet-0.17.0.tar.gz 21854054 BLAKE2B 91561f2cffb5c711d4ba58aceef90bbcd654997872936bcf475d397a7b831b833d349c828271e58795cca10c915ab4ec0a517dc0fc2f563673ba7a6e74cfea3f SHA512 d3ee6947163d8abced504ff37ecf365c0311164cbf243d4c635d34944f0831ca9fce2470acf00eb9a218f82a2e553b3f885db9bd21bb9dcefbd707fa0202925d
28 +DIST jsonnet-0.18.0.tar.gz 22472162 BLAKE2B 4f931a44b0cbeea0dc7705c28ca49817e2b3abe19ba4fdcd550d5df1ce9ad6b06b1b740a9306d36caa3970c88df9d31700373e4997dd52c6c2219cdd9bf125c1 SHA512 08a64a4b132df1519292378cef93deb3c60d21636b2a71bce6c13e29cfd93cab465cad77e11f000fb984c5c75a4ca1c92504654fd2e5201343df767ea0e610d1
29
30 diff --git a/dev-lang/jsonnet/files/jsonnet-0.18.0-unbundle.patch b/dev-lang/jsonnet/files/jsonnet-0.18.0-unbundle.patch
31 new file mode 100644
32 index 000000000000..7c19e8893f12
33 --- /dev/null
34 +++ b/dev-lang/jsonnet/files/jsonnet-0.18.0-unbundle.patch
35 @@ -0,0 +1,75 @@
36 +diff --git a/CMakeLists.txt b/CMakeLists.txt
37 +index 5df20ca..9e60fae 100644
38 +--- a/CMakeLists.txt
39 ++++ b/CMakeLists.txt
40 +@@ -121,7 +121,6 @@ endif()
41 + add_subdirectory(include)
42 + add_subdirectory(stdlib)
43 + add_subdirectory(third_party/md5)
44 +-add_subdirectory(third_party/rapidyaml/rapidyaml ryml)
45 + add_subdirectory(core)
46 + add_subdirectory(cpp)
47 + add_subdirectory(cmd)
48 +diff --git a/core/vm.cpp b/core/vm.cpp
49 +index 4617363..e328df5 100644
50 +--- a/core/vm.cpp
51 ++++ b/core/vm.cpp
52 +@@ -23,7 +23,7 @@ limitations under the License.
53 +
54 + #include "desugarer.h"
55 + #include "json.h"
56 +-#include "json.hpp"
57 ++#include "nlohmann/json.hpp"
58 + #include "md5.h"
59 + #include "parser.h"
60 + #include "ryml_std.hpp" // include this before any other ryml header
61 +diff --git a/setup.py b/setup.py
62 +index 0a2748a..356915d 100644
63 +--- a/setup.py
64 ++++ b/setup.py
65 +@@ -13,6 +13,7 @@
66 + # limitations under the License.
67 +
68 + import os
69 ++import sys
70 + from setuptools import setup
71 + from setuptools import Extension
72 + from setuptools.command.build_ext import build_ext as BuildExt
73 +@@ -22,28 +23,6 @@ DIR = os.path.abspath(os.path.dirname(__file__))
74 + # NOTE: If you are editing the array below then you probably also need
75 + # to change MANIFEST.in.
76 + LIB_OBJECTS = [
77 +- 'core/desugarer.o',
78 +- 'core/formatter.o',
79 +- 'core/libjsonnet.o',
80 +- 'core/lexer.o',
81 +- 'core/parser.o',
82 +- 'core/pass.o',
83 +- 'core/static_analysis.o',
84 +- 'core/string_utils.o',
85 +- 'core/vm.o',
86 +- 'third_party/md5/md5.o',
87 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/char_traits.o',
88 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/base64.o',
89 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/language.o',
90 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/memory_util.o',
91 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/format.o',
92 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/time.o',
93 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/memory_resource.o',
94 +- 'third_party/rapidyaml/rapidyaml/ext/c4core/src/c4/error.o',
95 +- 'third_party/rapidyaml/rapidyaml/src/c4/yml/parse.o',
96 +- 'third_party/rapidyaml/rapidyaml/src/c4/yml/preprocess.o',
97 +- 'third_party/rapidyaml/rapidyaml/src/c4/yml/common.o',
98 +- 'third_party/rapidyaml/rapidyaml/src/c4/yml/tree.o',
99 + ]
100 +
101 + MODULE_SOURCES = ['python/_jsonnet.c']
102 +@@ -72,6 +51,8 @@ jsonnet_ext = Extension(
103 + '_jsonnet',
104 + sources=MODULE_SOURCES,
105 + extra_objects=LIB_OBJECTS,
106 ++ libraries = ['md5', 'jsonnet', 'ryml'],
107 ++ library_dirs = [os.environ.get('CMAKE_BUILD_DIR')],
108 + include_dirs = ['include'],
109 + language='c++'
110 + )
111
112 diff --git a/dev-lang/jsonnet/jsonnet-0.18.0.ebuild b/dev-lang/jsonnet/jsonnet-0.18.0.ebuild
113 new file mode 100644
114 index 000000000000..456f3d3e9e49
115 --- /dev/null
116 +++ b/dev-lang/jsonnet/jsonnet-0.18.0.ebuild
117 @@ -0,0 +1,102 @@
118 +# Copyright 1999-2022 Gentoo Authors
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=7
122 +
123 +DISTUTILS_OPTIONAL=1
124 +PYTHON_COMPAT=( pypy3 python3_{7..10} )
125 +
126 +inherit cmake toolchain-funcs flag-o-matic distutils-r1
127 +
128 +DESCRIPTION="A data templating language for app and tool developers"
129 +HOMEPAGE="https://jsonnet.org/"
130 +SRC_URI="https://github.com/google/jsonnet/archive/v${PV}.tar.gz -> ${P}.tar.gz"
131 +IUSE="custom-optimization doc examples python test"
132 +
133 +LICENSE="Apache-2.0"
134 +SLOT="0"
135 +KEYWORDS="~amd64 ~x86"
136 +RDEPEND="
137 + dev-cpp/rapidyaml:=
138 + dev-cpp/nlohmann_json:=
139 + python? ( ${PYTHON_DEPS} )
140 +"
141 +
142 +DEPEND="${RDEPEND}"
143 +
144 +BDEPEND="
145 + python? (
146 + ${PYTHON_DEPS}
147 + dev-python/setuptools[${PYTHON_USEDEP}]
148 + )
149 +"
150 +RESTRICT="!test? ( test )"
151 +
152 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
153 +
154 +PATCHES=(
155 + "${FILESDIR}/jsonnet-0.12.1-dont-call-make-from-setuppy.patch"
156 + "${FILESDIR}/jsonnet-0.16.0-libdir.patch"
157 + "${FILESDIR}/jsonnet-0.16.0-cp-var.patch"
158 + "${FILESDIR}/jsonnet-0.18.0-unbundle.patch"
159 +)
160 +
161 +distutils_enable_tests unittest
162 +
163 +src_prepare() {
164 + cmake_src_prepare
165 + use python && distutils-r1_src_prepare
166 +}
167 +
168 +src_configure() {
169 + use custom-optimization || replace-flags '-O*' -O3
170 + tc-export CC CXX
171 +
172 + local mycmakeargs=(
173 + -DUSE_SYSTEM_JSON=ON
174 + -DBUILD_STATIC_LIBS=OFF
175 + )
176 +
177 + if use test; then
178 + mycmakeargs+=(
179 + -DBUILD_TESTS=ON
180 + -DUSE_SYSTEM_GTEST=ON
181 + )
182 + else
183 + mycmakeargs+=(
184 + -DBUILD_TESTS=OFF
185 + )
186 + fi
187 +
188 + cmake_src_configure
189 +}
190 +
191 +src_compile() {
192 + cmake_src_compile
193 + use python && CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_compile
194 +}
195 +
196 +src_test() {
197 + cmake_src_test
198 + use python && CMAKE_BUILD_DIR="${BUILD_DIR}" distutils-r1_src_test
199 +}
200 +
201 +python_test() {
202 + LD_LIBRARY_PATH="${CMAKE_BUILD_DIR}" "${EPYTHON}" -m unittest python._jsonnet_test -v \
203 + || die "Tests failed with ${EPYTHON}"
204 +}
205 +
206 +src_install() {
207 + cmake_src_install
208 + use python && distutils-r1_src_install
209 +
210 + if use doc; then
211 + find doc -name '.gitignore' -delete || die
212 + docinto html
213 + dodoc -r doc/.
214 + fi
215 + if use examples; then
216 + docinto examples
217 + dodoc -r examples/.
218 + fi
219 +}