summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-06-16 10:19:11 +0200
committerRemi Collet <fedora@famillecollet.com>2013-06-16 10:19:11 +0200
commit2a73df0b055f1a7bfbe9d3f1085645393ddaa280 (patch)
tree35995f8048c20248935ebbdc4ff46957d797614b
parent57cf535a2476c3d1cf76331c6052fdf9ebbb5a0e (diff)
syntaxhighlighter: build from github sources
-rw-r--r--syntaxhighlighter.spec74
1 files 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 <remi@fedoraproject.org> - 3.0.83-2
+- build from github sources
+
* Tue Jan 15 2013 Remi Collet <remi@fedoraproject.org> - 3.0.83-1
- initial package