summaryrefslogtreecommitdiffstats
path: root/syntaxhighlighter.spec
blob: 85c0965bb9bc1206bd372d6ba59bbf10970ffbf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# spec file for syntaxhighlighter
#
# Copyright (c) 2013-2017 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.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:      2%{?dist}
Summary:      JavaScript syntax highlighter
Group:        Applications/Internet
# Dual licensed under the MIT and GPL licenses.
License:      MIT or GPLv2
URL:          http://alexgorbatchev.com/SyntaxHighlighter/

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
BuildRequires: jre >= 1.6.0
BuildRequires: php-pear-phing


%description
SyntaxHighlighter is a fully functional self-contained code
syntax highlighter developed in JavaScript.


%package httpd
Summary:       Apache configuration for %{name}
Group:         Applications/Internet
Requires:      %{name} = %{version}-%{release}
Requires:      httpd

%description   httpd
This package provides the Apache configuration for
applications using an Alias to SyntaxHighlighter library.


%prep
%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

: Fix PHP syntax
%patch0 -p0 -b .old

: Fix revision
REV=%{version}
REV=${REV/*./}
sed -e s/@REVISION@/$REV/ \
    -i build/ext/RevisionTask.php

: License files
cp %{SOURCE2} %{SOURCE3} .


%build
cd build
phing -f build.xml

# phing don't correctly reports failure
[ -f output/scripts/shCore.js ] || exit 1


%install
rm -rf %{buildroot}

: install JavaScript
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -pr build/output/scripts %{buildroot}%{_datadir}/%{name}/scripts
cp -pr build/output/styles  %{buildroot}%{_datadir}/%{name}/styles

: install Apache configuration
mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
install -p -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc GPL-LICENSE MIT-LICENSE demos
%{_datadir}/%{name}


%files httpd
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf


%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