-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.no_source
89 lines (69 loc) · 2.13 KB
/
Makefile.no_source
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
#SERIAL 201511022215
# Base the name of the software on the spec file
PACKAGE := $(shell basename *.spec .spec)
# Override this arch if the software is arch specific
ARCH = noarch
# Variables for clean build directory tree under repository
BUILDDIR = ./build
ARTIFACTDIR = ./artifacts
SDISTDIR = ${ARTIFACTDIR}/sdist
RPMBUILDDIR = ${BUILDDIR}/rpm-build
RPMDIR = ${ARTIFACTDIR}/rpms
DEBBUILDDIR = ${BUILDDIR}/deb-build
DEBDIR = ${ARTIFACTDIR}/debs
# base rpmbuild command that utilizes the local buildroot
# not using the above variables on purpose.
# if you can make it work, PRs are welcome!
RPMBUILD = rpmbuild --define "_topdir %(pwd)/build" \
--define "_sourcedir %(pwd)/artifacts/sdist" \
--define "_builddir %{_topdir}/rpm-build" \
--define "_srcrpmdir %{_rpmdir}" \
--define "_rpmdir %(pwd)/artifacts/rpms"
GET_SDIST = spectool -g -C ${SDISTDIR} ${PACKAGE}.spec
all: rpms
clean:
rm -rf ${BUILDDIR}/ *~
rm -rf docs/*.gz
clean_all: clean
rm -rf ${ARTIFACTDIR}/
install_rpms: rpms
yum install ${RPMDIR}/${ARCH}/${PACKAGE}*.${ARCH}.rpm
reinstall: uninstall install
uninstall: clean
rm -f /usr/bin/${PACKAGE}
uninstall_rpms: clean
rpm -e ${PACKAGE}
sdist:
mkdir -p ${SDISTDIR}
cp *.patch ${SDISTDIR}
cp *.default ${SDISTDIR}
${GET_SDIST}
prep_rpmbuild: prep_build
mkdir -p ${RPMBUILDDIR}
mkdir -p ${RPMDIR}
cp ${SDISTDIR}/*gz ${RPMBUILDDIR}/
rpms: prep_rpmbuild
${RPMBUILD} -ba ${PACKAGE}.spec
srpm: prep_rpmbuild
${RPMBUILD} -bs ${PACKAGE}.spec
mock: srpm
mock ${MOCK_OPTIONS} ${RPMDIR}/${PACKAGE}*.src.rpm
prep_build: sdist
mkdir -p ${BUILDDIR}
prep_debbuild: prep_build
mkdir -p ${DEBBUILDDIR}
mkdir -p ${DEBDIR}
SDISTPACKAGE=`ls ${SDISTDIR}`; \
BASE=`basename $$SDISTPACKAGE .tar.gz`; \
DEBBASE=`echo $$BASE | sed 's/-/_/'`; \
TARGET=${DEBBUILDDIR}/$$DEBBASE.orig.tar.gz; \
ln -f -s ../../${SDISTDIR}/$$SDISTPACKAGE $$TARGET; \
tar -xz -f $$TARGET -C ${DEBBUILDDIR}; \
rm -rf ${DEBBUILDDIR}/$$BASE/debian; \
cp -pr debian/ ${DEBBUILDDIR}/$$BASE
debs: prep_debbuild
SDISTPACKAGE=`ls ${SDISTDIR}`; \
BASE=`basename $$SDISTPACKAGE .tar.gz`; \
cd ${DEBBUILDDIR}/$$BASE; \
debuild -uc -us
mv ${DEBBUILDDIR}/*.deb ${DEBDIR}/