-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (55 loc) · 2.8 KB
/
Makefile
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
ulc = /usr/local/cpanel
tmpl = /whostmgr/docroot/templates/troglodyne
cgi = /whostmgr/docroot/cgi/troglodyne
vcp = /var/cpanel/perl
vca = /var/cpanel/apps
vct = /var/cpanel/templates
pwd = $(shell pwd)
.PHONY: all install register test uninstall rpm test-depend
all: install register
install:
mkdir -p $(DESTDIR)$(ulc)$(tmpl)/ui $(DESTDIR)$(ulc)$(tmpl)/config $(DESTDIR)$(ulc)$(cgi)/js $(DESTDIR)$(ulc)$(cgi)/img $(DESTDIR)$(vcp)/Troglodyne/CGI $(DESTDIR)$(vcp)/Troglodyne/API $(DESTDIR)$(vca) $(DESTDIR)$(vct)/troglodyne/config $(DESTDIR)$(ulc)/whostmgr/docroot/addon_plugins
install $(pwd)/templates/ui/pgupgrade.tmpl $(DESTDIR)$(ulc)$(tmpl)
install $(pwd)/templates/config/main.default $(DESTDIR)$(vct)/troglodyne/config
install $(pwd)/js/pgupgrade.js $(DESTDIR)$(ulc)$(cgi)/js
install $(pwd)/img/troglophant.png $(DESTDIR)$(ulc)$(cgi)/img
install $(pwd)/img/troglophant.png $(DESTDIR)$(ulc)/whostmgr/docroot/addon_plugins
install $(pwd)/cgi/pgupgrade.cgi $(DESTDIR)$(ulc)$(cgi)
install $(pwd)/lib/Troglodyne/CGI/PgUpgrade.pm $(DESTDIR)$(vcp)/Troglodyne/CGI
install $(pwd)/lib/Troglodyne/CpPostgreSQL.pm $(DESTDIR)$(vcp)/Troglodyne
install $(pwd)/lib/Troglodyne/API/Postgres.pm $(DESTDIR)$(vcp)/Troglodyne/API
install $(pwd)/plugin/better_postgres.conf $(DESTDIR)$(vca)
chmod 0755 $(DESTDIR)$(vca)
chmod +x $(DESTDIR)$(ulc)$(cgi)/pgupgrade.cgi
register:
$(ulc)/bin/register_appconfig ./plugin/better_postgres.conf
uninstall:
$(ulc)/bin/unregister_appconfig better_postgres
rm -f $(vcp)/Troglodyne/CpPostgreSQL.pm
rm -f $(vcp)/Troglodyne/API/Postgres.pm
rm -rf $(vct)/troglodyne
rm -rf $(ulc)$(tmpl)
rm -f $(ulc)$(cgi)/pgupgrade.cgi
rm -f $(ulc)/whostmgr/docroot/addon_plugins/troglophant.png
test-depend:
perl -MTest2::V0 -MTest::MockModule -MFile::Temp -MCapture::Tiny -e 'exit 0' || sudo cpan -i Test2::V0 Test::MockModule File::Temp Capture::Tiny
test: test-depend
prove -mv t/*.t
rpm:
rm -rf SOURCES/*
mkdir -p SOURCES/BetterPostgres4cP-1.0
ln -s $(pwd)/bin SOURCES/BetterPostgres4cP-1.0/bin
ln -s $(pwd)/cgi SOURCES/BetterPostgres4cP-1.0/cgi
ln -s $(pwd)/img SOURCES/BetterPostgres4cP-1.0/img
ln -s $(pwd)/install SOURCES/BetterPostgres4cP-1.0/install
ln -s $(pwd)/js SOURCES/BetterPostgres4cP-1.0/js
ln -s $(pwd)/lib SOURCES/BetterPostgres4cP-1.0/lib
ln -s $(pwd)/plugin SOURCES/BetterPostgres4cP-1.0/plugin
ln -s $(pwd)/t SOURCES/BetterPostgres4cP-1.0/t
ln -s $(pwd)/templates SOURCES/BetterPostgres4cP-1.0/templates
cp $(pwd)/Makefile SOURCES/BetterPostgres4cP-1.0/Makefile
cp $(pwd)/configure SOURCES/BetterPostgres4cP-1.0/configure
mkdir -p ~/rpmbuild/SOURCES
cd SOURCES && tar --exclude="*.swp" --exclude="*.swn" --exclude="*.swo" -ch BetterPostgres4cP-1.0 | gzip > ~/rpmbuild/SOURCES/BetterPostgres4cP-1.0.tar.gz
rpmbuild -ba --clean --target noarch SPECS/BetterPostgres.spec
rm -rf SOURCES/*