From d80117032c11a6a7213ab0ace169c241fa66be39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Mon, 4 Apr 2016 16:26:00 +0200
Subject: 0.5.0 bump

---
 .gitignore                                         |  1 +
 ...sh-CFC-0.4.2-Use-system-lemon-if-possible.patch | 51 ------------
 ...sh-CFC-0.5.0-Use-system-lemon-if-possible.patch | 52 ++++++++++++
 ...CFC-0.5.0-Use-system-libcmark-if-possible.patch | 93 ++++++++++++++++++++++
 perl-Clownfish-CFC.spec                            | 25 ++++--
 sources                                            |  2 +-
 6 files changed, 167 insertions(+), 57 deletions(-)
 delete mode 100644 Clownfish-CFC-0.4.2-Use-system-lemon-if-possible.patch
 create mode 100644 Clownfish-CFC-0.5.0-Use-system-lemon-if-possible.patch
 create mode 100644 Clownfish-CFC-0.5.0-Use-system-libcmark-if-possible.patch

diff --git a/.gitignore b/.gitignore
index 76e7792..c721cf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /Clownfish-CFC-0.4.2.tar.gz
 /Clownfish-CFC-0.4.3.tar.gz
 /Clownfish-CFC-0.4.4.tar.gz
+/Clownfish-CFC-0.5.0.tar.gz
diff --git a/Clownfish-CFC-0.4.2-Use-system-lemon-if-possible.patch 
b/Clownfish-CFC-0.4.2-Use-system-lemon-if-possible.patch
deleted file mode 100644
index 7c8f92d..0000000
--- a/Clownfish-CFC-0.4.2-Use-system-lemon-if-possible.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 4065b384bd46fcd9617f5dfb8ef4f1dcb7ef615e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
-Date: Thu, 17 Sep 2015 17:14:52 +0200
-Subject: [PATCH] Use system lemon if possible
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-If lemon tool is already available on the system, use that instead of
-building it from bundled code.
-
-Signed-off-by: Petr Písař <ppi...@redhat.com>
----
- buildlib/Clownfish/CFC/Build.pm | 14 +++++++++++++-
- 1 file changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/buildlib/Clownfish/CFC/Build.pm b/buildlib/Clownfish/CFC/Build.pm
-index b7617f0..696f1de 100644
---- a/buildlib/Clownfish/CFC/Build.pm
-+++ b/buildlib/Clownfish/CFC/Build.pm
-@@ -55,7 +55,15 @@ else {
-     $LEMON_DIR      = catdir( updir(), updir(), 'lemon' );
-     $CFC_SOURCE_DIR = catdir( updir(), 'src' );
- }
--my $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
-+
-+# Prefer lemon from system
-+my $LEMON_EXE_PATH = "lemon$Config{_exe}";
-+if (system( $LEMON_EXE_PATH, '-x')) {
-+    $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
-+} else {
-+    $LEMON_DIR = undef;
-+}
-+
- my $PPPORT_H_PATH  = catfile( $INCLUDE,   'ppport.h' );
- 
- sub new {
-@@ -114,6 +122,10 @@ sub ACTION_ppport {
- # Build the Lemon parser generator.
- sub ACTION_lemon {
-     my $self = shift;
-+    if (!defined $LEMON_DIR) {
-+        print "Using system Lemon parser generator...\n\n";
-+        return;
-+    }
-     print "Building the Lemon parser generator...\n\n";
-     $self->_run_make(
-         dir  => $LEMON_DIR,
--- 
-2.4.3
-
diff --git a/Clownfish-CFC-0.5.0-Use-system-lemon-if-possible.patch 
b/Clownfish-CFC-0.5.0-Use-system-lemon-if-possible.patch
new file mode 100644
index 0000000..6216780
--- /dev/null
+++ b/Clownfish-CFC-0.5.0-Use-system-lemon-if-possible.patch
@@ -0,0 +1,52 @@
+From 22e7ab7e16c8c00c08a7a45c7b31dce6bf573869 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
+Date: Thu, 17 Sep 2015 17:14:52 +0200
+Subject: [PATCH] Use system lemon if possible
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If lemon tool is already available on the system, use that instead of
+building it from bundled code.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ buildlib/Clownfish/CFC/Build.pm | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/buildlib/Clownfish/CFC/Build.pm b/buildlib/Clownfish/CFC/Build.pm
+index dd67a0b..69a7603 100644
+--- a/buildlib/Clownfish/CFC/Build.pm
++++ b/buildlib/Clownfish/CFC/Build.pm
+@@ -59,9 +59,16 @@ else {
+     $MODULES_DIR    = catdir( updir(), 'modules' );
+ }
+ my $CMARK_SOURCE_DIR = catdir( $MODULES_DIR, 'CommonMark', 'src' );
+-my $LEMON_EXE_PATH   = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
+ my $PPPORT_H_PATH    = catfile( $INCLUDE,   'ppport.h' );
+ 
++# Prefer lemon from system
++my $LEMON_EXE_PATH = "lemon$Config{_exe}";
++if (system( $LEMON_EXE_PATH, '-x')) {
++    $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
++} else {
++    $LEMON_DIR = undef;
++}
++
+ sub new {
+     my ( $class, %args ) = @_;
+     $args{c_source} = [ $CFC_SOURCE_DIR, $CMARK_SOURCE_DIR ];
+@@ -119,6 +126,10 @@ sub ACTION_ppport {
+ # Build the Lemon parser generator.
+ sub ACTION_lemon {
+     my $self = shift;
++    if (!defined $LEMON_DIR) {
++        print "Using system Lemon parser generator...\n\n";
++        return;
++    }
+     print "Building the Lemon parser generator...\n\n";
+     $self->_run_make(
+         dir  => $LEMON_DIR,
+-- 
+2.5.5
+
diff --git a/Clownfish-CFC-0.5.0-Use-system-libcmark-if-possible.patch 
b/Clownfish-CFC-0.5.0-Use-system-libcmark-if-possible.patch
new file mode 100644
index 0000000..170b4c0
--- /dev/null
+++ b/Clownfish-CFC-0.5.0-Use-system-libcmark-if-possible.patch
@@ -0,0 +1,93 @@
+From 2482a33f6871f5e561ed8171b6727699a824f93f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
+Date: Mon, 4 Apr 2016 17:00:29 +0200
+Subject: [PATCH] Use system libcmark if possible
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If system has libcmark available, link CFC to it instead of building
+bundled libcmark code.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ Build.PL                        |  1 +
+ buildlib/Clownfish/CFC/Build.pm | 28 +++++++++++++++++++++++++---
+ 2 files changed, 26 insertions(+), 3 deletions(-)
+
+diff --git a/Build.PL b/Build.PL
+index 783971f..ae572be 100644
+--- a/Build.PL
++++ b/Build.PL
+@@ -32,6 +32,7 @@ my $builder = Clownfish::CFC::Build->new(
+         'Module::Build'      => 0.280801,
+         'ExtUtils::CBuilder' => 0.18,
+         'ExtUtils::ParseXS'  => 2.16,
++        'ExtUtils::PkgConfig'=> 0,
+         'Devel::PPPort'      => 3.14,
+     },
+     meta_merge => { keywords => [qw( clownfish )], },
+diff --git a/buildlib/Clownfish/CFC/Build.pm b/buildlib/Clownfish/CFC/Build.pm
+index 69a7603..ba2d3a2 100644
+--- a/buildlib/Clownfish/CFC/Build.pm
++++ b/buildlib/Clownfish/CFC/Build.pm
+@@ -34,6 +34,7 @@ use File::Find qw( find );
+ use Config;
+ use Cwd qw( getcwd );
+ use Carp;
++use ExtUtils::PkgConfig;
+ 
+ # Establish the filepaths for various assets.  If the file `LICENSE` is found
+ # in the current working directory, this is a CPAN distribution rather than a
+@@ -58,9 +59,17 @@ else {
+     $CFC_SOURCE_DIR = catdir( updir(), 'src' );
+     $MODULES_DIR    = catdir( updir(), 'modules' );
+ }
+-my $CMARK_SOURCE_DIR = catdir( $MODULES_DIR, 'CommonMark', 'src' );
+ my $PPPORT_H_PATH    = catfile( $INCLUDE,   'ppport.h' );
+ 
++# Prefer cmark from system
++my %CMARK = eval { ExtUtils::PkgConfig->find('libcmark') };
++if ($@) {
++    $CMARK{source_dir} = catdir( $MODULES_DIR, 'CommonMark', 'src' );
++    print "Using bundled CommonMark library...\n";
++} else {
++    print "Using system CommonMark library...\n";
++}
++
+ # Prefer lemon from system
+ my $LEMON_EXE_PATH = "lemon$Config{_exe}";
+ if (system( $LEMON_EXE_PATH, '-x')) {
+@@ -71,14 +80,27 @@ if (system( $LEMON_EXE_PATH, '-x')) {
+ 
+ sub new {
+     my ( $class, %args ) = @_;
+-    $args{c_source} = [ $CFC_SOURCE_DIR, $CMARK_SOURCE_DIR ];
++    if (defined $CMARK{cflags}) {
++        $args{extra_compiler_flags} ||= [];
++        push @{ $args{extra_compiler_flags} }, $CMARK{cflags};
++    }
++    if (defined $CMARK{libs}) {
++        $args{extra_linker_flags} ||= [];
++        push @{ $args{extra_linker_flags} }, $CMARK{libs};
++    }
++    $args{c_source} = [ $CFC_SOURCE_DIR ];
++    if (defined $CMARK{soure_dir}) {
++        push @{ $args{c_source} }, $CMARK{source_dir};
++    }
+     $args{include_dirs} ||= [];
+     my @aux_include = (
+         $INCLUDE,
+         $CFC_SOURCE_DIR,
+-        $CMARK_SOURCE_DIR,
+         curdir(),    # for charmony.h
+     );
++    if (defined $CMARK{source_dir}) {
++       push @aux_include, $CMARK{source_dir};
++    }
+     push @{ $args{include_dirs} }, @aux_include;
+     return $class->SUPER::new(
+         %args,
+-- 
+2.5.5
+
diff --git a/perl-Clownfish-CFC.spec b/perl-Clownfish-CFC.spec
index 6ea35b2..741936d 100644
--- a/perl-Clownfish-CFC.spec
+++ b/perl-Clownfish-CFC.spec
@@ -1,20 +1,26 @@
 Name:           perl-Clownfish-CFC
-Version:        0.4.4
+Version:        0.5.0
 Release:        1%{?dist}
 Summary:        Compiler for Apache Clownfish
-# Unbundled lemon:  ASL 2.0
+# other files:          ASL 2.0
+## Unbundled
+# lemon:                ASL 2.0
+# modules/CommonMark:   BSD and MIT
 License:        ASL 2.0
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Clownfish-CFC/
 Source0:        
http://www.cpan.org/authors/id/N/NW/NWELLNHOF/Clownfish-CFC-%{version}.tar.gz
 # Use system lemon, <https://issues.apache.org/jira/browse/CLOWNFISH-60>
-Patch0:         Clownfish-CFC-0.4.2-Use-system-lemon-if-possible.patch
+Patch0:         Clownfish-CFC-0.5.0-Use-system-lemon-if-possible.patch
+# Use system libcmark
+Patch1:         Clownfish-CFC-0.5.0-Use-system-libcmark-if-possible.patch
 # There is charmonizer.c which is becoming a separate project
 # <git://git.apache.org/lucy-charmonizer.git>. However, lucy-charmonizer has
 # not yet been released <http://lucy.apache.org/download.html>. Also
 # Clownfish-CFC'c lib/Clownfish/CFC/Perl/Build/Charmonic.pm still relies on
 # the local location. charmonizer.c is used only at build time.
 # Therefore I'm not going to unbudle the charmonizer.c now.
+BuildRequires:  cmark-devel
 BuildRequires:  coreutils
 BuildRequires:  findutils
 # gcc for standard library headers
@@ -22,6 +28,7 @@ BuildRequires:  gcc
 BuildRequires:  lemon
 BuildRequires:  perl
 BuildRequires:  perl-devel
+BuildRequires:  perl-generators
 # Modules from buildlib and Clownfish::CFC::Perl::Build::Charmonic from lib
 # are used for building 
 BuildRequires:  perl(base)
@@ -29,6 +36,7 @@ BuildRequires:  perl(Carp)
 BuildRequires:  perl(Config)
 BuildRequires:  perl(Cwd)
 BuildRequires:  perl(Devel::PPPort) >= 3.14
+BuildRequires:  perl(ExtUtils::PkgConfig)
 BuildRequires:  perl(File::Copy)
 BuildRequires:  perl(File::Find)
 BuildRequires:  perl(File::Path)
@@ -54,7 +62,7 @@ BuildRequires:  perl(File::stat)
 BuildRequires:  perl(Test::More)
 Requires:       perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
 # Clownfish not used. I believe it's used only when Clownfish-CFC is called
-# from the Clownfish. Adding symetric dependenc between Clownfish-CFC and
+# from the Clownfish. Adding symetric dependency between Clownfish-CFC and
 # Clownfish would create a cycle which is not desired for bulding and
 # idempotent at run-time.
 Requires:       perl(Devel::PPPort) >= 3.14
@@ -74,9 +82,13 @@ This is a compiler for Apache Clownfish.
 %prep
 %setup -q -n Clownfish-CFC-%{version}
 %patch0 -p1
+%patch1 -p1
 # Unbundle lemon
 rm -rf lemon
 sed -i -e '/^lemon\//d' MANIFEST
+# Unbundle cmark
+rm -rf modules/CommonMark
+sed -i -e '/^modules\/CommonMark\//d' MANIFEST
 
 %build
 perl Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS"
@@ -92,12 +104,15 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm 
-f {} \;
 
 %files
 %license LICENSE
-%doc CONTRIBUTING NOTICE README
+%doc CONTRIBUTING.md NOTICE README.md
 %{perl_vendorarch}/auto/*
 %{perl_vendorarch}/Clownfish*
 %{_mandir}/man3/*
 
 %changelog
+* Mon Apr 04 2016 Petr Pisar <ppi...@redhat.com> - 0.5.0-1
+- 0.5.0 bump
+
 * Thu Feb 04 2016 Petr Pisar <ppi...@redhat.com> - 0.4.4-1
 - 0.4.4 bump
 
diff --git a/sources b/sources
index 1042329..14571ec 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-80a04552f7465a81a38449591cc63173  Clownfish-CFC-0.4.4.tar.gz
+748115eb30e09d510a7df620e91e3bab  Clownfish-CFC-0.5.0.tar.gz
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl-Clownfish-CFC.git/commit/?h=master&id=d80117032c11a6a7213ab0ace169c241fa66be39
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org

Reply via email to