Fix O_APPEND for Linux 3.15 and older kernels
[zfs.git] / config / rpm.am
blob13bd54a625b0876fe8f739210a2359d1018e14b1
1 ###############################################################################
2 # Copyright (C) 2007-2013 Lawrence Livermore National Security, LLC.
3 # Copyright (C) 2007 The Regents of the University of California.
4 # Written by Brian Behlendorf <behlendorf1@llnl.gov>.
5 ###############################################################################
6 # Build targets for RPM packages.
7 ###############################################################################
9 PHONY += srpm srpms srpm-kmod srpm-dkms srpm-utils
10 PHONY += rpm rpms rpm-kmod rpm-dkms rpm-utils rpm-utils-initramfs
11 PHONY += srpm-common rpm-common rpm-local
13 srpm-kmod srpm-dkms srpm-utils: dist
15 srpm-kmod:
16         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
17                 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_KMOD}' srpm-common
19 srpm-dkms:
20         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
21                 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_DKMS}' srpm-common
23 srpm-utils:
24         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
25                 def='${SRPM_DEFINE_COMMON} ${SRPM_DEFINE_UTIL}' srpm-common
27 srpm: srpm-kmod srpm-dkms srpm-utils
28 srpms: srpm-kmod srpm-dkms srpm-utils
30 rpm-kmod: srpm-kmod
31         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-kmod" \
32                 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_KMOD}' rpm-common
34 rpm-dkms: srpm-dkms
35         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}-dkms" \
36                 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_DKMS}' rpm-common
38 # The rpm-utils and rpm-utils-initramfs targets are identical except for the
39 # zfs-initramfs package: rpm-utils never includes it, rpm-utils-initramfs
40 # includes it if detected at configure time. The zfs-initramfs package does
41 # not work on any known RPM-based distribution and the resulting RPM is only
42 # used to create a Debian package. The rpm-utils-initramfs target is not
43 # intended to be specified by the user directly, it is provided as a
44 # dependency of the deb-utils target.
46 rpm-utils: srpm-utils
47         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
48                 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL}' rpm-common
50 rpm-utils-initramfs: srpm-utils
51         $(MAKE) $(AM_MAKEFLAGS) pkg="${PACKAGE}" \
52                 def='${RPM_DEFINE_COMMON} ${RPM_DEFINE_UTIL} ${RPM_DEFINE_INITRAMFS}' rpm-common
54 rpm: rpm-kmod rpm-dkms rpm-utils
55 rpms: rpm-kmod rpm-dkms rpm-utils
57 rpm-local:
58         @(if test "${HAVE_RPMBUILD}" = "no"; then \
59                 echo -e "\n" \
60         "*** Required util ${RPMBUILD} missing.  Please install the\n" \
61         "*** package for your distribution which provides ${RPMBUILD},\n" \
62         "*** re-run configure, and try again.\n"; \
63                 exit 1; \
64         fi; \
65         mkdir -p $(rpmbuild)/TMP && \
66         mkdir -p $(rpmbuild)/BUILD && \
67         mkdir -p $(rpmbuild)/RPMS && \
68         mkdir -p $(rpmbuild)/SRPMS && \
69         mkdir -p $(rpmbuild)/SPECS && \
70         cp ${RPM_SPEC_DIR}/$(rpmspec) $(rpmbuild)/SPECS && \
71         mkdir -p $(rpmbuild)/SOURCES && \
72         cp $(top_srcdir)/scripts/kmodtool $(rpmbuild)/SOURCES && \
73         cp $(distdir).tar.gz $(rpmbuild)/SOURCES)
75 srpm-common:
76         @(dist=`$(RPM) --eval %{?dist}`; \
77         rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
78         rpmspec=$(pkg).spec; \
79         rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
80         $(MAKE) $(AM_MAKEFLAGS) \
81                 rpmbuild="$$rpmbuild" \
82                 rpmspec="$$rpmspec" \
83                 rpm-local || exit 1; \
84         LANG=C $(RPMBUILD) \
85                 --define "_tmppath $$rpmbuild/TMP" \
86                 --define "_topdir $$rpmbuild" \
87                 $(def) -bs $$rpmbuild/SPECS/$$rpmspec || exit 1; \
88         cp $$rpmbuild/SRPMS/$$rpmpkg . || exit 1; \
89         rm -R $$rpmbuild)
91 rpm-common: 
92         @(dist=`$(RPM) --eval %{?dist}`; \
93         rpmpkg=$(pkg)-$(VERSION)-$(RELEASE)$$dist*src.rpm; \
94         rpmspec=$(pkg).spec; \
95         rpmbuild=`mktemp -t -d $(PACKAGE)-build-$$USER-XXXXXXXX`; \
96         $(MAKE) $(AM_MAKEFLAGS) \
97                 rpmbuild="$$rpmbuild" \
98                 rpmspec="$$rpmspec" \
99                 rpm-local || exit 1; \
100         LANG=C ${RPMBUILD} \
101                 --define "_tmppath $$rpmbuild/TMP" \
102                 --define "_topdir $$rpmbuild" \
103                 $(def) --rebuild $$rpmpkg || exit 1; \
104         cp $$rpmbuild/RPMS/*/* . || exit 1; \
105         rm -R $$rpmbuild)