%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) Name: coccinelle Version: 1.1.1 Release: %mkrel 3 Summary: Semantic patching for Linux (spatch) Group: Development/C License: GPLv2 URL: http://coccinelle.lip6.fr/ #Source0: https://github.com/coccinelle/coccinelle/archive/%{version}/%{name}-%{version}.tar.gz #Source0: https://coccinelle.gitlabpages.inria.fr/website/distrib/coccinelle-%{version}.tar.gz # 1.1.1 was not tagged so I ran: # git reset --hard 5444e1 # git archive --format=tar --prefix=coccinelle-1.1.1/ HEAD | gzip -9 > coccinelle-1.1.1.tar.gz Source0: %{name}-%{version}.tar.gz BuildRequires: git BuildRequires: ocaml >= 3.10.0 BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-compiler-libs # These are probably bundled. Reenable them when camlp4 is working. #BuildRequires: ocaml-sexplib-devel BuildRequires: ocaml-pcre-devel BuildRequires: ocaml-extlib-devel BuildRequires: ocaml-menhir BuildRequires: ocaml-num-devel BuildRequires: ocaml-stdcompat-devel BuildRequires: ocaml-doc BuildRequires: pkgconfig(ncurses) BuildRequires: pkgconfig(python3) BuildRequires: texlive-fontsextra BuildRequires: hevea BuildRequires: chrpath # This stops the automatic dependency generator adding some bogus # OCaml dependencies. Unfortunately we have to keep adding modules to # this list every time there is some change in coccinelle. There # should be a better way, but I don't know what. %{lua: modules = { 'ANSITerminal', 'Ast0_cocci', 'Ast_c', 'Ast_cocci', 'Bytearray', 'Commands', 'Common', 'Config', 'Control_flow_c', 'Cpp_token_c', 'Danger', 'Data', 'Dumper', 'Exposed_modules', 'Externalanalysis', 'Flag', 'Flag_parsing_cocci', 'Get_constants2', 'Includes', 'Includes_cache', 'Iteration', 'Lexer_c', 'Lexer_parser', 'Lib_parsing_c', 'Mapb', 'Oassoc', 'Oassoc_buffer', 'Oassocb', 'Oassoch', 'Objet', 'Ocollection', 'Ograph2way', 'Ograph_extended', 'Oset', 'Osetb', 'Oseti', 'Parmap_utils', 'Parse_c', 'Parser_c', 'Parsing_consistency_c', 'Parsing_hacks', 'Parsing_recovery_c', 'Parsing_stat', 'Pretty_print_c', 'Regexp', 'Regexp_pcre', 'Semantic_c', 'Setcore', 'SetPt', 'Setb', 'Seti', 'Sexplib', 'Stdcompat', 'Stdcompat__init', 'Stdcompat__stdlib_s', 'Token_annot', 'Token_c', 'Token_helpers', 'Token_views_c', 'Type_annoter_c', 'Type_cocci', 'Visitor_ast', 'Visitor_c', } local arg = "__ocaml_requires_opts" for i, m in ipairs(modules) do arg = arg .. " -i " .. m .. " -x " .. m end rpm.define(arg) } # RHBZ#725415. Requires: ocaml-findlib # Bundled libraries. # # We could unbundle both of these, but it would require packaging them # in Fedora. I don't know which version of the library is included. Provides: bundled(ocaml-pycaml) Provides: bundled(ocaml-parmap) %description Coccinelle is a tool to utilize semantic patches for manipulating C code. It was originally designed to ease maintenance of device drivers in the Linux kernel. %package doc Summary: Documentation for %{name} Group: Development/C Requires: %{name} = %{version}-%{release} %description doc The %{name}-doc package contains documentation for %{name}. %package examples Summary: Examples for %{name} Group: Development/C Requires: %{name} = %{version}-%{release} %description examples The %{name}-examples package contains examples for %{name}. %prep %autosetup -n %{name}-%{version} -S git # Replace /usr/bin/env shebang with /usr/bin/python3 sed -i '1s_^#!/usr/bin/env python$_#!/usr/bin/python3_' tools/pycocci # Remove .cvsignore files. find -name .cvsignore -delete # Convert a few files to UTF-8 encoding. for f in demos/demo_rule9/sym53c8xx.res demos/demo_rule9/sym53c8xx.c; do mv $f $f.orig iconv -f iso-8859-1 -t utf-8 < $f.orig > $f rm $f.orig done # replace tabs with spaces find . -iname '*.py' | xargs -I {} sh -exc 'expand -t8 {} > tempfile && mv tempfile {}' %build autoreconf -vfi %configure \ --enable-release=yes \ --with-python=%{_bindir}/python3 \ --with-menhir=%{_bindir}/menhir %{__sed} -i \ -e 's,LIBDIR=.*,LIBDIR=%{_libdir},' \ -e 's,MANDIR=.*,MANDIR=%{_mandir},' \ -e 's,SHAREDIR=.*,SHAREDIR=%{_libdir}/%{name},' \ -e 's,DYNLINKDIR=.*,DYNLINKDIR=%{_libdir}/ocaml,' \ -e 's,BASH_COMPLETION_DIR=.*,BASH_COMPLETION_DIR=%{_datadir}/bash-completion/completions,' \ Makefile.config %if !%opt target=byte %else target=world %endif # NOTE: Do not use smp_mflags! It breaks the build. unset MAKEFLAGS make $target EXTLIBDIR=`ocamlc -where`/extlib %install mkdir -p $RPM_BUILD_ROOT%{_libdir}/python/coccilib %make_install # Remove these (they are just wrapper scripts). rm -f $RPM_BUILD_ROOT%{_bindir}/spatch.byte rm -f $RPM_BUILD_ROOT%{_bindir}/spatch.opt # Move the libdir stuff into a subdirectory. pushd $RPM_BUILD_ROOT%{_libdir} mkdir coccinelle mkdir coccinelle/ocaml for f in standard.h standard.iso spatch spatch.byte spatch.opt ocaml/{*.cmi,*.cmx}; do if [ -f $f ]; then mv $f coccinelle/$f fi done popd # Move Python libraries to python sitelib directory. mkdir -p $RPM_BUILD_ROOT%{python3_sitelib} mv $RPM_BUILD_ROOT%{_libdir}/python/coccilib \ $RPM_BUILD_ROOT%{python3_sitelib} rmdir $RPM_BUILD_ROOT%{_libdir}/python # Move OCaml libraries. pushd $RPM_BUILD_ROOT%{_libdir} mkdir ocaml/stublibs mv dllpyml_stubs.so ocaml/stublibs popd # Delete spgen - it is not meant to be packaged. rm $RPM_BUILD_ROOT%{_bindir}/spgen rm $RPM_BUILD_ROOT%{_mandir}/man1/spgen.1* install -m 0755 tools/pycocci %{buildroot}%{_bindir}/pycocci %check export COCCINELLE_HOME=$RPM_BUILD_ROOT%{_libdir}/coccinelle export LD_LIBRARY_PATH=. # Run --help to check the command works in general. $RPM_BUILD_ROOT%{_bindir}/spatch --help # Test fails with "Fatal error: Out of memory". # Seems to be a bug in coccinelle, so it's unlikely that this # package really functions properly. $RPM_BUILD_ROOT%{_bindir}/spatch -sp_file demos/simple.cocci demos/simple.c %files %license license.txt copyright.txt %doc authors.txt bugs.txt changes.txt %doc credits.txt install.txt readme.txt %{_bindir}/pycocci %{_bindir}/spatch %{_libdir}/%{name}/ %{_datadir}/bash-completion/completions/spatch %{_mandir}/man1/*.1* %{_mandir}/man3/*.3* %{python3_sitelib}/coccilib/ %{_libdir}/ocaml/stublibs/*.so %if !%opt %config(noreplace) /etc/prelink.conf.d/%{name}.conf %endif %files doc %doc docs %files examples %doc demos %changelog * Thu May 19 2022 pterjan <pterjan> 1.1.1-3.mga9 + Revision: 1859170 - Rebuild for OCaml 4.14 * Tue Apr 05 2022 umeabot <umeabot> 1.1.1-2.mga9 + Revision: 1844586 - Mageia 9 Mass Rebuild * Thu Oct 14 2021 tv <tv> 1.1.1-1.mga9 + Revision: 1751415 - New upstream verson 1.1.1 * Wed Mar 03 2021 tv <tv> 1.1.0-1.mga9 + Revision: 1697380 - New upstream version 1.1.0 - Add patch to fix OCaml 4.12 issues * Mon Jan 11 2021 pterjan <pterjan> 1.0.8-7.mga8 + Revision: 1671198 - Fix dependencies * Sun Jan 10 2021 pterjan <pterjan> 1.0.8-6.mga8 + Revision: 1670769 - Rebuild to generate ocamlx provides * Fri Feb 28 2020 umeabot <umeabot> 1.0.8-5.mga8 + Revision: 1551651 - Rebuild for ocaml 4.10.0 final * Wed Feb 19 2020 umeabot <umeabot> 1.0.8-4.mga8 + Revision: 1544388 - Mageia 8 Mass Rebuild * Sun Jan 26 2020 tv <tv> 1.0.8-3.mga8 + Revision: 1482994 - rebuild for ocaml-4.10 - new release + rebuild for ocaml-4.10 + wally <wally> - replace deprecated %%configure2_5x * Sat Sep 14 2019 daviddavid <daviddavid> 1.0.7-3.mga8 + Revision: 1440760 - rebuild for python3.8 * Tue Jan 08 2019 daviddavid <daviddavid> 1.0.7-2.mga7 + Revision: 1352711 - rebuild for new Python 3.7 * Sat Nov 03 2018 daviddavid <daviddavid> 1.0.7-1.mga7 + Revision: 1327907 - new version: 1.0.7 * Thu Oct 25 2018 daviddavid <daviddavid> 1.0.6-3.mga7 + Revision: 1325190 - rebuild for new ocaml 4.07.1 * Sun Sep 23 2018 umeabot <umeabot> 1.0.6-2.mga7 + Revision: 1296635 - Mageia 7 Mass Rebuild * Tue Feb 06 2018 daviddavid <daviddavid> 1.0.6-1.mga7 + Revision: 1199283 - new version: 1.0.6 (sync with Fedora) - add missing BR on ocaml-num-devel - reenable debug package with properly fix * Sun Sep 25 2016 pterjan <pterjan> 1.0.4-3.mga6 + Revision: 1056204 - Rebuild for fix in ocaml * Thu Feb 04 2016 umeabot <umeabot> 1.0.4-2.mga6 + Revision: 935628 - Mageia 6 Mass Rebuild * Wed Feb 03 2016 guillomovitch <guillomovitch> 1.0.4-1.mga6 + Revision: 934171 - new version 1.0.4 * Wed Oct 15 2014 umeabot <umeabot> 1.0.0-0.rc16.8.mga5 + Revision: 747797 - Second Mageia 5 Mass Rebuild * Tue Sep 23 2014 malo <malo> 1.0.0-0.rc16.7.mga5 + Revision: 722691 - fix auto requires * Thu Sep 18 2014 umeabot <umeabot> 1.0.0-0.rc16.6.mga5 + Revision: 693651 - Rebuild to fix library dependencies * Tue Sep 16 2014 umeabot <umeabot> 1.0.0-0.rc16.5.mga5 + Revision: 678460 - Mageia 5 Mass Rebuild * Sat May 31 2014 pterjan <pterjan> 1.0.0-0.rc16.4.mga5 + Revision: 628138 - Rebuild for new Python * Fri Oct 18 2013 umeabot <umeabot> 1.0.0-0.rc16.3.mga4 + Revision: 503407 - Mageia 4 Mass Rebuild * Fri Jan 11 2013 umeabot <umeabot> 1.0.0-0.rc16.2.mga3 + Revision: 347962 - Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild * Mon Dec 17 2012 neoclust <neoclust> 1.0.0-0.rc16.1.mga3 + Revision: 332117 + rebuild (emptylog) * Mon Dec 17 2012 neoclust <neoclust> 1.0.0.rc16-1.mga3 + Revision: 332106 - imported package coccinelle