forked from HariSekhon/DevOps-Perl-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·132 lines (107 loc) · 3.67 KB
/
Makefile
File metadata and controls
executable file
·132 lines (107 loc) · 3.67 KB
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
132
# vim:ts=4:sts=4:sw=4:noet
#
# Author: Hari Sekhon
# Date: 2013-02-03 10:25:36 +0000 (Sun, 03 Feb 2013)
#
# https://github.com/harisekhon/tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
# to help improve or steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
export PATH := $(PATH):/usr/local/bin
CPANM = cpanm
ifdef PERLBREW_PERL
SUDO2 =
else
SUDO2 = sudo
endif
# must come after to reset SUDO2 to blank if root
# EUID / UID not exported in Make
# USER not populated in Docker
ifeq '$(shell id -u)' '0'
SUDO =
SUDO2 =
else
SUDO = sudo
endif
.PHONY: build
build:
if [ -x /sbin/apk ]; then make apk-packages; fi
if [ -x /usr/bin/apt-get ]; then make apt-packages; fi
if [ -x /usr/bin/yum ]; then make yum-packages; fi
git submodule init
git submodule update --recursive
cd lib && make
# don't track and commit your personal name, company name etc additions to scrub_custom.conf back to Git since they are personal to you
git update-index --assume-unchanged scrub_custom.conf
git update-index --assume-unchanged solr/solr-env.sh
#@ [ $$EUID -eq 0 ] || { echo "error: must be root to install cpan modules"; exit 1; }
# Module::CPANfile::Result and Module::Install::Admin are needed for Hijk which is auto-pulled by Search::Elasticsearch but doesn't auto-pull Module::CPANfile::Result
# workaround for broken pod coverage tests
#yes | $(SUDO) cpan --force XML::Validate
# auto-configure cpan for Perl 5.8 which otherwise gets stuck prompting for a region for downloads
# this doesn't work it's misaligned with the prompts, should use expect instead if I were going to do this
#(echo y;echo o conf prerequisites_policy follow;echo o conf commit) | cpan
which cpanm || { yes "" | $(SUDO2) cpan App::cpanminus; }
yes "" | $(SUDO2) $(CPANM) --notest `sed 's/#.*//; /^[[:space:]]*$$/d;' < setup/cpan-requirements.txt`
@echo
@echo "BUILD SUCCESSFUL (tools)"
.PHONY: apk-packages
apk-packages:
$(SUDO) apk update
$(SUDO) apk add `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/apk-packages.txt`
.PHONY: apk-packages-remove
apk-packages-remove:
cd lib && make apk-packages-remove
$(SUDO) apk del `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/apk-packages-dev.txt` || :
$(SUDO) rm -fr /var/cache/apk/*
.PHONY: apt-packages
apt-packages:
$(SUDO) apt-get update
$(SUDO) apt-get install -y `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/deb-packages.txt`
.PHONY: apt-packages-remove
apt-packages-remove:
cd lib && make apt-packages-remove
$(SUDO) apt-get purge -y `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/deb-packages-dev.txt`
.PHONY: yum-packages
yum-packages:
for x in `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/rpm-packages.txt`; do rpm -q $$x || $(SUDO) yum install -y $$x; done
.PHONY: yum-packages-remove
yum-packages-remove:
cd lib && make yum-packages-remove
for x in `sed 's/#.*//; /^[[:space:]]*$$/d' < setup/rpm-packages-dev.txt`; do rpm -q $$x && $(SUDO) yum remove -y $$x; done
.PHONY: test
test:
cd lib && make test
# doesn't return a non-zero exit code to test
#for x in *.pl; do perl -T -c $x; done
# TODO: add more functional tests back in here
tests/all.sh
.PHONY: install
install:
@echo "No installation needed, just add '$(PWD)' to your \$$PATH"
.PHONY: update
update:
make update2
make
@#make test
.PHONY: update2
update2:
make update-no-recompile
.PHONY: update-no-recompile
update-no-recompile:
git pull
git submodule update --init --recursive
.PHONY: update-submodules
update-submodules:
git submodule update --init --remote
.PHONY: updatem
updatem:
make update-submodules
.PHONY: clean
clean:
@echo Nothing to clean