From 2a73df0b055f1a7bfbe9d3f1085645393ddaa280 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 16 Jun 2013 10:19:11 +0200 Subject: syntaxhighlighter: build from github sources --- syntaxhighlighter.spec | 74 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 18 deletions(-) diff --git a/syntaxhighlighter.spec b/syntaxhighlighter.spec index 2ec1bdf..ebd2d34 100644 --- a/syntaxhighlighter.spec +++ b/syntaxhighlighter.spec @@ -1,18 +1,39 @@ +# spec file for syntaxhighlighter +# +# Copyright (c) 2013 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# + +%global gh_owner alexgorbatchev +%global gh_name SyntaxHighlighter +%global gh_commit 682bf8cfd5a0686d51ed16325b72625ddf64ae11 + Name: syntaxhighlighter Version: 3.0.83 -Release: 1%{?dist} +Release: 2%{?dist} Summary: JavaScript syntax highlighter Group: Applications/Internet # Dual licensed under the MIT and GPL licenses. -License: MIT or GPLv2 +License: MIT or GPLv2 URL: http://alexgorbatchev.com/SyntaxHighlighter/ -# http://alexgorbatchev.com/SyntaxHighlighter/download/download.php?sh_current -Source0: syntaxhighlighter_%{version}.zip +Source0: https://github.com/%{gh_owner}/%{gh_name}/archive/%{gh_commit}/%{name}-%{version}-%{gh_commit}.tar.gz Source1: %{name}.conf +# Missing in github archive +Source2: https://raw.github.com/%{gh_owner}/%{gh_name}/master/MIT-LICENSE +Source3: https://raw.github.com/%{gh_owner}/%{gh_name}/master/GPL-LICENSE + +# fix for recent PHP version +# not submitted, as upstream don't use phing anymore +Patch0: %{name}-build.patch -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildArch: noarch +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +BuildArch: noarch +BuildRequires: java-1.7.0-openjdk +BuildRequires: php-pear-phing %description @@ -32,29 +53,43 @@ applications using an Alias to SyntaxHighlighter library. %prep -%setup -q -n %{name}_%{version} +%setup -q -n %{gh_name}-%{gh_commit} + +: Create suitable examples, easy to run +sed -e 's:src="../scripts:src="/%{name}/scripts:' \ + -e 's:href="../styles:href="/%{name}/styles:' \ + -i demos/*php demos/*html -# Create a suitable example, easy to run -sed -e 's:src="scripts:src="/%{name}/scripts:' \ - -e 's:href="styles:href="/%{name}/styles:' \ - index.html >example.html +: Fix PHP syntax +%patch0 -p0 -b .old -chmod -x {scripts,styles}/* +: Fix revision +REV=%{version} +REV=${REV/*./} +sed -e s/@REVISION@/$REV/ \ + -i build/ext/RevisionTask.php + +: License files +cp %{SOURCE2} %{SOURCE3} . %build -# Nothing to build +cd build +phing -f build.xml + +# phing don't correctly reports failure +[ -f output/scripts/shCore.js ] || exit 1 %install rm -rf %{buildroot} -# JavaScript +: install JavaScript mkdir -p %{buildroot}%{_datadir}/%{name} -cp -pr scripts %{buildroot}%{_datadir}/%{name}/scripts -cp -pr styles %{buildroot}%{_datadir}/%{name}/styles +cp -pr build/output/scripts %{buildroot}%{_datadir}/%{name}/scripts +cp -pr build/output/styles %{buildroot}%{_datadir}/%{name}/styles -# Apache +: install Apache configuration mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d @@ -65,7 +100,7 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc LGPL-LICENSE MIT-LICENSE example.html +%doc GPL-LICENSE MIT-LICENSE demos %{_datadir}/%{name} @@ -75,5 +110,8 @@ rm -rf %{buildroot} %changelog +* Sun Jun 16 2013 Remi Collet - 3.0.83-2 +- build from github sources + * Tue Jan 15 2013 Remi Collet - 3.0.83-1 - initial package -- cgit