1 RPM_NAME
:= $(PACKAGE_NAME
)
2 UPSTREAM_VER
:= $(subst -,~
,$(subst RELEASE-
,,$(DIST_LBL
)))
4 RPM_ARCH
:= $(shell rpm
--eval
'%{_arch}')
5 RPM_PACKAGE_NAME
:= $(RPM_NAME
)-$(UPSTREAM_VER
)-$(RPM_REL
)$(shell rpm
--eval
'%{?dist}').
$(RPM_ARCH
).rpm
6 RPM_PACKAGE_FILE
:= $(PACKAGE_DIR
)/RPMS
/$(RPM_ARCH
)/$(RPM_PACKAGE_NAME
)
7 RPM_PACKAGE_SRC
:= $(PACKAGE_DIR
)/SRPMS
/$(RPM_PACKAGE_NAME
).src.rpm
9 SED_SCRIPT
:= sed
-i
-e
' \
10 s/<VERSION>/$(UPSTREAM_VER)/g; \
11 s/<NAME>/$(RPM_NAME)/g; \
12 s/<RELEASE>/$(RPM_REL)/g; \
13 s/<SOURCE0>/$(notdir $(DIST_TAR_GZ))/g; \
14 s/<SOURCE1>/$(notdir $(FW_DIST_TAR_GZ))/g; \
15 s/<ARCHIVE_PREFIX>/$(PACKAGE_NAME)/g; \
18 RPM_DIRS
:= $(addprefix $(PACKAGE_DIR
)/,BUILD RPMS SOURCES SPECS SRPMS
)
21 SPEC_FILE
:= $(PACKAGE_DIR
)/SPECS
/$(RPM_NAME
).spec
22 SPEC_FILE_IN
:= $(ROOT_DIR
)/package
/linux
/rpmspec.in
27 $(SPEC_FILE
): $(SPEC_FILE_IN
) |
$(RPM_DIRS
)
28 $(V1
) cp
-f
$(SPEC_FILE_IN
) $(SPEC_FILE
)
29 $(V1
) $(SED_SCRIPT
) $(SPEC_FILE
)
33 package
: $(RPM_PACKAGE_FILE
)
34 $(RPM_PACKAGE_FILE
): RPMBUILD_OPTS
:= -bb
37 package_src
: $(RPM_PACKAGE_SRC
)
38 $(RPM_PACKAGE_SRC
): RPMBUILD_OPTS
:= -bs
40 $(RPM_PACKAGE_FILE
) $(RPM_PACKAGE_SRC
): $(SPEC_FILE
) $(DIST_TAR_GZ
) $(FW_DIST_TAR_GZ
) |
$(RPM_DIRS
)
41 @
$(ECHO
) "Building $(call toprel,$@), please wait..."
42 $(V1
) ln
-sf
$(DIST_TAR_GZ
) $(PACKAGE_DIR
)/SOURCES
43 $(V1
) ln
-sf
$(FW_DIST_TAR_GZ
) $(PACKAGE_DIR
)/SOURCES
44 $(V1
) rpmbuild
$(RPMBUILD_OPTS
) --define "_topdir $(PACKAGE_DIR)" $(SPEC_FILE
)