forked from openxpki/openxpki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
93 lines (81 loc) · 3.13 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
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
# Makefile
#
# This makefile is an entry point for continuous integration testing systems.
# It's oriented towards Travis-CI, but is certainly adaptable to other build
# and test systems.
#
# For normal package builds, see the documentation.
#
# NOTE: The test targets make some general assumptions on the build/test
# environment. Among these assumptions are:
#
# - perlbrew is used for a local perl installation
# - cpanm is used for CPAN prerequisites
# Ubuntu uses dash, which sucks when using '.' to source an RC file.
SHELL=/bin/bash
TESTLOGDIR=logs
TESTLOG=$(TESTLOGDIR)/test-$(shell date "+%Y-%m-%d-%H%M").log
ifeq "$(TRAVIS)" "true"
PERL := /opt/myperl/bin/perl
endif
default:
@echo
@echo "Sorry, but this Makefile is for continuous integration testing."
@echo "For normal package build, see the documentation."
PERLBREW_RC := $(HOME)/perl5/perlbrew/etc/bashrc
PERLBREW_STABLE := 5.14.2
CPANM_INST := cpanm --installdeps --notest --verbose --no-interactive .
# Travis-CI provides perlbrew already, but this target may be used on other
# systems to get perlbrew installed.
perlbrew:
curl -kL http://install.perlbrew.pl | bash
. $(PERLBREW_RC) && perlbrew install $(PERLBREW_STABLE)
. $(PERLBREW_RC) && perlbrew use $(PERLBREW_STABLE)
. $(PERLBREW_RC) && perl --version
. $(PERLBREW_RC) && perlbrew install-cpanm
# Install the packages needed for building CPAN prereqs, etc.
# Note: Travis-CI does this already in the before_install target.
inst-pkgs:
sudo apt-get update -qq
sudo apt-get install -qq libxml expat-dev openssl-dev
# Travis-CI will call the command 'cpanm --installdeps --notest .' to update
# the build prereqs for the project. This 'cpanm' target may be used on other
# systems to install the dependencies. Note: it sources the perlbrew bashrc
# just in case perlbrew was installed using the above target and is not
# in the current user environment.
#
# The cpanm.err file allows us to run all tasks and report a single error if
# any failed
#
# Note: Config::Std is a prereq for running 'perl Makefile.PL'
cpanm:
. $(PERLBREW_RC) && cpanm --installdeps --notest --verbose --no-interactive Class::Std Config::Std
. $(PERLBREW_RC) && cd core/server && $(CPANM_INST)
.PHONY: clean-core
clean-core:
(cd core/server && \
rm -rf Makefile OpenXPKI.bs OpenXPKI.c OpenXPKI.o blib pm_to_blib \
)
# Travis-CI uses 'make test' as a generic entry point for Perl projects when
# it can't find Build.PL or Makefile.PL. This seems like a good spot for us
# to be called. So, 'yes', this is where Travis-CI actually starts the tests.
test: clean-core
(cd core/server && \
export PATH=/opt/myperl/bin:$$PATH && \
$(PERL) Makefile.PL && \
make test)
test-deprecated: clean-core
mkdir -p $(TESTLOGDIR)
rm -f test.err
. $(PERLBREW_RC) && \
(cd core/server && perl Makefile.PL && make test) || touch test.err 2>&1 | \
tee $(TESTLOG)
! test -f test.err
############################################################
# Workflow XML
#
# Recent workflows have been modeled (mis)using OmniGraffle. The resulting
# .plist files are then converted to XML.
############################################################
workflow:
$(MAKE) -f tools/workflow.mak