Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/coccinelle/files/, dev-util/coccinelle/
Date: Sat, 29 Oct 2022 18:26:15
Message-Id: 1667067954.027818aade360d64a45ab7f9c5f7e278eccb9949.sam@gentoo
1 commit: 027818aade360d64a45ab7f9c5f7e278eccb9949
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 29 18:10:43 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 29 18:25:54 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=027818aa
7
8 dev-util/coccinelle: new package, add 1.1.1
9
10 It was removed in the past because of no Python 3 support, but
11 it supports Python 3 now.
12
13 Bug: https://bugs.gentoo.org/734630
14 Signed-off-by: Sam James <sam <AT> gentoo.org>
15
16 dev-util/coccinelle/Manifest | 1 +
17 dev-util/coccinelle/coccinelle-1.1.1.ebuild | 126 +++++++++++++++++++++++
18 dev-util/coccinelle/files/50coccinelle-gentoo.el | 6 ++
19 dev-util/coccinelle/metadata.xml | 11 ++
20 4 files changed, 144 insertions(+)
21
22 diff --git a/dev-util/coccinelle/Manifest b/dev-util/coccinelle/Manifest
23 new file mode 100644
24 index 000000000000..55489c38c940
25 --- /dev/null
26 +++ b/dev-util/coccinelle/Manifest
27 @@ -0,0 +1 @@
28 +DIST coccinelle-1.1.1.tar.bz2 2118055 BLAKE2B 7efb0c86432c88daa1bce2710acdf2f62b6210c69245b4896ea8c5e39a0b28c538d94deae6ed1544e0ced66b2baa6edf8670f5e02dad40c2d1f5562326ce23e3 SHA512 fcb83203c91dae18122cf95f7db931d2e1576559b74a7a1c664c795437904acdffa005a8b9e732c1d99c8f0ab1c5f529d143eafe79c6397d28c4879848afca45
29
30 diff --git a/dev-util/coccinelle/coccinelle-1.1.1.ebuild b/dev-util/coccinelle/coccinelle-1.1.1.ebuild
31 new file mode 100644
32 index 000000000000..4affa4aee5a6
33 --- /dev/null
34 +++ b/dev-util/coccinelle/coccinelle-1.1.1.ebuild
35 @@ -0,0 +1,126 @@
36 +# Copyright 1999-2022 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=8
40 +
41 +PYTHON_COMPAT=( python3_{8..11} )
42 +inherit autotools bash-completion-r1 elisp-common python-single-r1
43 +
44 +DESCRIPTION="Program matching and transformation engine"
45 +HOMEPAGE="http://coccinelle.lip6.fr/"
46 +SRC_URI="https://gitlab.inria.fr/coccinelle/coccinelle/-/archive/${PV}/${P}.tar.bz2"
47 +
48 +LICENSE="GPL-2"
49 +SLOT="0"
50 +KEYWORDS="~amd64 ~x86"
51 +IUSE="doc emacs +ocamlopt pcre python test"
52 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
53 +RESTRICT="strip !test? ( test )"
54 +
55 +RDEPEND="
56 + >=dev-lang/ocaml-3.12:=[ocamlopt?]
57 + dev-ml/sexplib:=[ocamlopt(+)?]
58 + dev-ml/menhir:=[ocamlopt?]
59 + dev-ml/camlp4:=[ocamlopt?]
60 + dev-ml/parmap:=[ocamlopt?]
61 + dev-ml/findlib:=[ocamlopt?]
62 + emacs? ( >=app-editors/emacs-23.1:* )
63 + pcre? (
64 + dev-libs/libpcre
65 + dev-ml/pcre-ocaml:=[ocamlopt?]
66 + )
67 + python? ( ${PYTHON_DEPS} )
68 +"
69 +DEPEND="${RDEPEND}"
70 +# dev-texlive/texlive-fontsextra contains 'ifsym.sty'
71 +BDEPEND="
72 + virtual/pkgconfig
73 + doc? (
74 + virtual/latex-base
75 + dev-texlive/texlive-latexextra
76 + dev-texlive/texlive-fontsextra
77 + )
78 +"
79 +
80 +DOCS=( authors.txt bugs.txt changes.txt credits.txt readme.txt )
81 +
82 +SITEFILE=50coccinelle-gentoo.el
83 +
84 +pkg_setup() {
85 + use python && python-single-r1_pkg_setup
86 +}
87 +
88 +src_prepare() {
89 + default
90 +
91 + eautoreconf
92 +
93 + if use python ; then
94 + # Fix python install location
95 + sed -e "s:\$(LIBDIR)/python:$(python_get_sitedir):" \
96 + -i Makefile || die
97 + fi
98 +}
99 +
100 +src_configure() {
101 + local myeconfargs=(
102 + --enable-ocaml
103 + --with-bash-completion="$(get_bashcompdir)"
104 + --with-python="${EPYTHON}"
105 +
106 + $(use_enable python)
107 + $(use_enable pcre)
108 + $(use_enable pcre pcre-syntax)
109 + $(use_enable ocamlopt opt)
110 + )
111 +
112 + CONFIG_SHELL="${BROOT}"/bin/bash econf "${myeconfargs[@]}"
113 +}
114 +
115 +src_compile() {
116 + export TARGET_SPATCH=$(usev !ocamlopt 'byte-only')
117 +
118 + emake VERBOSE=yes -j1 $(usex ocamlopt 'all.opt' 'all-dev')
119 +
120 + if use doc ; then
121 + VARTEXFONTS="${T}"/fonts emake VERBOSE=yes docs
122 + fi
123 +
124 + if use emacs ; then
125 + elisp-compile editors/emacs/cocci.el || die
126 + fi
127 +}
128 +
129 +src_test() {
130 + emake VERBOSE=yes check $(usev python pycocci-check)
131 +}
132 +
133 +src_install() {
134 + emake DESTDIR="${D}" PREFIX="${EPREFIX}" VERBOSE=yes install
135 +
136 + if use python ; then
137 + python_optimize
138 + else
139 + rm -rf "${ED}/usr/$(get_libdir)/${PN}/python" || die
140 + fi
141 +
142 + if use emacs ; then
143 + elisp-install ${PN} editors/emacs/*
144 + elisp-site-file-install "${FILESDIR}"/${SITEFILE}
145 + fi
146 +
147 + use doc && dodoc docs/manual/*.pdf
148 +
149 + newdoc editors/vim/README README-vim
150 + rm editors/vim/README || die
151 + insinto /usr/share/vim/vimfiles
152 + doins -r editors/vim/*
153 +}
154 +
155 +pkg_postinst() {
156 + use emacs && elisp-site-regen
157 +}
158 +
159 +pkg_postrm() {
160 + use emacs && elisp-site-regen
161 +}
162
163 diff --git a/dev-util/coccinelle/files/50coccinelle-gentoo.el b/dev-util/coccinelle/files/50coccinelle-gentoo.el
164 new file mode 100644
165 index 000000000000..6721b3c5e5a1
166 --- /dev/null
167 +++ b/dev-util/coccinelle/files/50coccinelle-gentoo.el
168 @@ -0,0 +1,6 @@
169 +
170 +;;; site-lisp configuration for coccinelle
171 +
172 +(add-to-list 'load-path "@SITELISP@")
173 +
174 +(autoload 'cocci-mode "cocci" "Major mode for editing cocci code." t)
175
176 diff --git a/dev-util/coccinelle/metadata.xml b/dev-util/coccinelle/metadata.xml
177 new file mode 100644
178 index 000000000000..313e852a9cce
179 --- /dev/null
180 +++ b/dev-util/coccinelle/metadata.xml
181 @@ -0,0 +1,11 @@
182 +<?xml version="1.0" encoding="UTF-8"?>
183 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
184 +<pkgmetadata>
185 + <maintainer type="project">
186 + <email>ml@g.o</email>
187 + <name>ML</name>
188 + </maintainer>
189 + <upstream>
190 + <remote-id type="github">coccinelle/coccinelle</remote-id>
191 + </upstream>
192 +</pkgmetadata>