summaryrefslogtreecommitdiffstats
path: root/apm-web.spec
blob: 389748430b50d47a6393fd0aba72a6d2acc2cbf1 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# spec file for apm-web
#
# Copyright (c) 2015 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_owner     patrickallaert
%global gh_name      php-apm-web
%global gh_commit    d7425e00f2f6b3004c21c46d1d6e097fbd78d033
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%if 0%{?fedora} >= 21
# support for apache / nginx / php-fpm
%global with_phpfpm 1
%else
%global with_phpfpm 0
%endif

Name:          apm-web
Version:       2.0.0
Release:       3%{?dist}
Summary:       APM (Alternative PHP Monitor) web frontend

Group:         Applications/Internet
License:       PHP
URL:           https://github.com/%{gh_owner}/%{gh_name}
Source0:       %{url}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz

# Webserver configuration files
Source1:        %{name}.httpd
Source2:        %{name}.nginx

# Temporary fix for https://github.com/patrickallaert/php-apm-web/issues/1
Source3:        https://raw.githubusercontent.com/patrickallaert/php-apm/master/LICENSE

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

%if %{with_phpfpm}
Requires:       webserver
Requires:       nginx-filesystem
Requires:       httpd-filesystem
Requires:       php(httpd)
%else
Requires:       httpd
Requires:       mod_php
%endif
# From phpcompatinfo analysis
Requires:       php(language) > 5.3
Requires:       php-date
Requires:       php-json
Requires:       php-pcre
Requires:       php-pdo

# This is not a library, but a web-app, so doesn't really make sense
Provides:       php-composer(patrickallaert/php-apm-web) = %{version}


%description
APM (Alternative PHP Monitor) is a monitoring extension enabling native
Application Performance Management (APM) for PHP.

This is the web frontend that enables visualizing the data gathered by
that extension.

The php-pecl-apm package provides the extension.


%prep
%setup -q -n %{gh_name}-%{gh_commit}

: Fix configuration path
sed -e 's:"config/db.php":"%{_sysconfdir}/apm-web/db.php":' \
    -i model/repository.php

: Create webserver configuration files
sed -e 's:@ALIAS@:%{name}:g' \
    -e 's:@SHARE@:%{_datadir}:g' \
    %{SOURCE1} > %{name}.httpd

%if %{with_phpfpm}
sed -e 's:@ALIAS@:%{name}:g' \
    -e 's:@SHARE@:%{_datadir}:g' \
    %{SOURCE2} > %{name}.nginx
%endif

cp %{SOURCE3} .


%build
# Nothing


%install
install -d %{buildroot}%{_datadir}/%{name}
cp -pr css img js model plugins views *php \
   %{buildroot}%{_datadir}/%{name}

# Apache config
install -D -m 644 %{name}.httpd \
   %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf

%if %{with_phpfpm}
# Nginx config
install -Dpm 0644 %{name}.nginx \
   %{buildroot}/%{_sysconfdir}/nginx/default.d/%{name}.conf
%endif

# Application config
install -D -m 644 -p config/db.php \
 %{buildroot}%{_sysconfdir}/%{name}/db.php


%files
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
# Need to restrict access, as it contains a clear password
%attr(750,root,apache) %dir %{_sysconfdir}/%{name}
%attr(640,root,apache) %config(noreplace) %{_sysconfdir}/%{name}/db.php
%{_datadir}/%{name}
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
%if %{with_phpfpm}
%config(noreplace) %{_sysconfdir}/nginx/default.d/%{name}.conf
%endif


%changelog
* Sat Feb 21 2015 Remi Collet <remi@fedoraproject.org> - 2.0.0-3
- initial package, version 2.0.0 (split off php-pecl-apm)