Skip to content

Commit 3068d2b

Browse files
committed
Build: fixes #1
1 parent c52ac7c commit 3068d2b

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

automation/Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ MK_CMAKE:=1
66
MK_CMAKE_INSTALL:=1
77

88
define HELP
9-
make fetch # download and prepare dependant modules
10-
make build # compile and link
11-
make clean # remove build artifacts
12-
make pack # create installation packages
13-
make test # run tests
9+
make setup # install prerequisited (CAUTION: THIS WILL MODIFY YOUR SYSTEM)
10+
make fetch # download and prepare dependant modules
11+
make build # compile and link
12+
make clean # remove build artifacts
13+
make pack # create installation packages
14+
make test # run tests
15+
make deploy # copy packages to S3
16+
make release # release a version
1417
endef
1518

1619
#----------------------------------------------------------------------------------------------
@@ -40,7 +43,7 @@ CMAKE_FLAGS += \
4043
-DDEPS_PATH=$(realpath $(ROOT)/deps) \
4144
-DDEVICE=$(DEVICE)
4245

43-
include readies/mk/defs
46+
include $(MK)/defs
4447

4548
#----------------------------------------------------------------------------------------------
4649

@@ -50,7 +53,10 @@ include $(MK)/rules
5053

5154
#----------------------------------------------------------------------------------------------
5255

53-
$(TARGET): $(MK_MAKEFILES) $(DEPS)
56+
prebuild:
57+
@if [ -d $(ROOT)/deps ]; then echo $$'Dependencies are not in place.\nPlease run \'make fetch\'.'; exit 1; fi
58+
59+
$(TARGET): prebuild $(MK_MAKEFILES) $(DEPS)
5460
$(MAKE) -C $(BINDIR)
5561
$(MAKE) -C $(BINDIR) install
5662
cd $(ROOT) ;\

automation/readies/bin/getpy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ fi
1616

1717
[ ! -z $(command -v python3) ] && exit 0
1818

19+
[[ $CHECK == 1 ]] && exit 1
20+
1921
if [ ! -z $(command -v apt-get) ]; then
2022
runn apt-get -qq update
2123
runn apt-get -qq install -y python3

automation/readies/bin/getpy2

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22

33
[ "$VERBOSE" = "1" ] && set -x
44

5-
show_if_error() {
6-
{ "${@:1}"; } > /tmp/py2.log 2>&1
7-
[ $? != 0 ] && cat /tmp/py2.log
8-
rm -f /tmp/py2.log
5+
runn() {
6+
[[ $NOP == 1 ]] && { echo "${@:1}"; return; }
7+
__runn_log=$(mktemp /tmp/run.XXXXX)
8+
{ "${@:1}"; } > $__runn_log 2>&1
9+
[ $? != 0 ] && cat $__runn_log
10+
rm -f $__runn_log
911
}
1012

1113
if [ ! -z $(command -v python) ]; then
1214
[ "$(python --version 2>&1 | cut -d" " -f2 | cut -d. -f1)" = "2" ] && exit 0
1315
fi
1416

1517
[ ! -z $(command -v python2) ] && exit 0
18+
[ ! -z $(command -v python2.7) ] && exit 0
19+
20+
[[ $CHECK == 1 ]] && exit 1
1621

1722
if [ ! -z $(command -v apt-get) ]; then
18-
show_if_error apt-get -qq update
19-
show_if_error apt-get -qq install -y python
23+
runn apt-get -qq update
24+
runn apt-get -qq install -y python
2025
elif [ ! -z $(command -v dnf) ]; then
21-
show_if_error dnf install -y python2
26+
runn dnf install -y python2
2227
elif [ ! -z $(command -v yum) ]; then
23-
show_if_error yum install -y python2
28+
runn yum install -y python2
2429
elif [ ! -z $(command -v apk) ]; then
25-
show_if_error apk update
26-
show_if_error apk add python2
30+
runn apk update
31+
runn apk add python2
2732
elif [ ! -z $(command -v brew) ]; then
28-
show_if_error brew install python2
33+
runn brew install python2
2934
fi
3035

3136
if [ -z $(command -v python) ]; then

automation/readies/mk/main

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11

2+
SHELL=/bin/bash
3+
4+
ifneq ($(shell { CHECK=1 $(ROOT)/automation/readies/bin/getpy; echo $$?; }),0)
5+
$(error It seems prerequisites have not been installed: please run 'make setup'.)
6+
endif
7+
28
MK=$(ROOT)/automation/readies/mk
39

410
MK_ALL_TARGETS:=bindirs build

0 commit comments

Comments
 (0)