forked from rabbitmq/erlang-rpm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (52 loc) · 2.03 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
# Copyright Pivotal Software, Inc. 2012-2019. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with this software. If not, it can be
# retrieved online at https://www.erlang.org/.
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
# the License for the specific language governing rights and limitations
# under the License.
FINAL_OUTPUT_DIR=FINAL_RPMS
OTP_RELEASE=22.0
# Where official Erlang distribution files come from...
OTP_SRC_TGZ_FILE=OTP-$(OTP_RELEASE).tar.gz
ERLANG_DISTPOINT=https://github.com/erlang/otp/archive/OTP-$(OTP_RELEASE).tar.gz
# Where we will pull tarballs to
TARBALL_DIR=dist
TOP_DIR=$(shell pwd)
DEFINES=--define '_topdir $(TOP_DIR)' --define '_tmppath $(TOP_DIR)/tmp' --define '_sysconfdir /etc' --define '_localstatedir /var'
rpms: clean erlang
prepare:
mkdir -p BUILD SOURCES SPECS SRPMS RPMS tmp dist
wget -O $(TARBALL_DIR)/$(OTP_SRC_TGZ_FILE) $(ERLANG_DISTPOINT)#
tar -zxf $(TARBALL_DIR)/$(OTP_SRC_TGZ_FILE) -C dist
cp $(TARBALL_DIR)/$(OTP_SRC_TGZ_FILE) SOURCES
rm $(TARBALL_DIR)/$(OTP_SRC_TGZ_FILE)
cp *.patch SOURCES
cp erlang.spec SPECS
cp Erlang_ASL2_LICENSE.txt SOURCES
yum install -y util-linux
if test -f /etc/os-release; then \
. /etc/os-release; \
if test "$$ID" = 'centos' && test "$$VERSION_ID" -ge 7; then \
yum install -y rpm-sign; \
fi; \
fi
erlang: prepare
mkdir -p $(FINAL_OUTPUT_DIR)
rpmbuild -vv -bb --nodeps SPECS/erlang.spec $(DEFINES)
ifneq ($(SIGNING_KEY_ID),)
setsid \
rpm --addsign \
--define '_signature gpg' \
--define '_gpg_name $(SIGNING_KEY_ID)' \
RPMS/*/*.rpm \
< /dev/null
endif
find RPMS -name "*.rpm" -exec sh -c 'mv {} `echo {} | sed 's#^RPMS\/noarch#$(FINAL_OUTPUT_DIR)#'`' ';'
clean:
rm -rf BUILDROOT BUILD SOURCES SPECS SRPMS RPMS tmp $(FINAL_OUTPUT_DIR) dist