-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
50 lines (44 loc) · 1.65 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
MY_BUILD_NUMBER=$(or $(BUILD_NUMBER),0)
# @TODO: Set VERSION as needed
VERSION=$(shell cat $(CURDIR)/VERSION)
DEB_PACKAGE_NAME=spxops
ARCHIVE=$(DEB_PACKAGE_NAME)_$(VERSION).tgz
ARCHITECTURE=all
TEMPLATE_TO_CLEAN_DEB=$(DEB_PACKAGE_NAME)*$(VERSION)*
COMMIT=$(or $(shell git stash create),HEAD)
VERSION_NAME="$(DEB_PACKAGE_NAME)_$(VERSION).$(MY_BUILD_NUMBER)"
INSTALL_DIR="$(CURDIR)/$(DEB_PACKAGE_NAME)-$(VERSION).$(MY_BUILD_NUMBER)"
DEBIAN_DIR="$(CURDIR)/debian"
DEBFULLNAME="Thomas Gouverneur"
DISTRIBUTION ?= "spx-stretch"
ROOTDIR=/opt/spxops
build_deb_package: $(INSTALL_DIR)
cd $(INSTALL_DIR); \
export DEBEMAIL=$(DEBEMAIL); \
export DEBFULLNAME=$(DEBFULLNAME); \
fakeroot debchange --newversion $(VERSION).$(MY_BUILD_NUMBER) "New release for $(VERSION).$(MY_BUILD_NUMBER)"; \
fakeroot debchange --release "Release" --distribution "$(DISTRIBUTION)"; \
debuild -us -uc
$(INSTALL_DIR): build_archive
mkdir -p "$(INSTALL_DIR)"
cp -R "$(DEBIAN_DIR)" "$(INSTALL_DIR)/"
mkdir -p "$(INSTALL_DIR)/${ROOTDIR}"
cp -R "$(CURDIR)/app/bin" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/app/sbin" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/app/libs" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/app/plugins" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/app/tpl" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/www" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/doc" "$(INSTALL_DIR)/"
cp -R "$(CURDIR)/sql" "$(INSTALL_DIR)/"
echo "${VERSION}" > $(INSTALL_DIR)/VERSION
build_archive:
git archive --format tar.gz --output "$(ARCHIVE)" $(COMMIT)
build: build_deb_package
publish:
dput -u $(APT_REPO_HOST) $(VERSION_NAME)*.changes
clean:
rm -R -f "$(INSTALL_DIR)"
rm -R -f $(TEMPLATE_TO_CLEAN_DEB)
rm -f "$(ARCHIVE)"