Commit 5d392770 authored by Luciano Orsini's avatar Luciano Orsini
Browse files

references #122: porting to c++11 for psx package

parent 08808aa0
rpm: $(PackageListLoop)
installrpm: $(PackageListLoop)
......@@ -16,53 +15,66 @@ PWD = $(shell pwd)
ifdef Package
ifndef ProjectName
ProjectName=$(shell awk -F'"' 'BEGIN{IGNORECASE=1} /project[ \t\r\f\v]*=/ {print $$2;}' $(PackagePath)/include/$(Package)/version.h)
endif
ifndef PackageName
PackageName=$(shell awk -F'"' 'BEGIN{IGNORECASE=1} /package[ \t\r\f\v]*=/ {print $$2;}' $(PackagePath)/include/$(Package)/version.h)
endif
FullPackageName=$(ProjectName)$(PackageName)
VERSION_PREFIX=$(PackageName)
ifneq ($(ProjectName),)
VERSION_PREFIX=$(ProjectName)_$(PackageName)
endif
ifndef PACKAGE_VER_MAJOR
PACKAGE_VER_MAJOR=$(shell awk 'BEGIN{IGNORECASE=1} /define $(PackageName)_VERSION_MAJOR/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
PACKAGE_VER_MAJOR=$(shell awk 'BEGIN{IGNORECASE=1} /define $(VERSION_PREFIX)_VERSION_MAJOR/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
endif
ifndef PACKAGE_VER_MINOR
PACKAGE_VER_MINOR=$(shell awk 'BEGIN{IGNORECASE=1} /define $(PackageName)_VERSION_MINOR/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
PACKAGE_VER_MINOR=$(shell awk 'BEGIN{IGNORECASE=1} /define $(VERSION_PREFIX)_VERSION_MINOR/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
endif
ifndef PACKAGE_VER_PATCH
PACKAGE_VER_PATCH=$(shell awk 'BEGIN{IGNORECASE=1} /define $(PackageName)_VERSION_PATCH/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
PACKAGE_VER_PATCH=$(shell awk 'BEGIN{IGNORECASE=1} /define $(VERSION_PREFIX)_VERSION_PATCH/ {print $$3;}' $(PackagePath)/include/$(Package)/version.h)
endif
ifndef PACKAGE_RELEASE
include $(XDAQ_ROOT)/$(BUILD_SUPPORT)/mfRPM.release
ifndef PACKAGE_REQUIRED_PACKAGE_LIST
PACKAGE_REQUIRED_PACKAGE_LIST=$(shell awk -v pns=$(PROJECT_NAMESPACE) -v pn=$(PROJECT_NAME) 'BEGIN{IGNORECASE=1} /define TOOLBOX_REQUIRED_PACKAGE_LIST/ {split($$3,plist,","); for (i in plist) printf " %s%s-%s",pns,pn,plist[i];}' $(PackagePath)/include/$(Package)/version.h)
endif
ifndef BUILD_VERSION
BUILD_VERSION=1
endif
ifndef BUILD_DISTRIBUTION
BUILD_DISTRIBUTION := $(shell $(XDAQ_ROOT)/$(BUILD_SUPPORT)/checkos.sh)
endif
ifndef BUILD_COMPILER
BUILD_COMPILER :=$(CC)$(shell $(CC) -dumpversion | sed -e 's/\./_/g')
endif
ifndef BUILD_DISTRIBUTION
BUILD_DISTRIBUTION := $(shell $(XDAQ_ROOT)/$(BUILD_SUPPORT)/checkos.sh)
endif
VER_EXISTS=no
ifneq ($(PACKAGE_VER_MAJOR),)
ifneq ($(PACKAGE_VER_MINOR),)
ifneq ($(PACKAGE_VER_PATCH),)
ifneq ($(PACKAGE_RELEASE),)
VER_EXISTS=yes
endif
endif
endif
endif
REQUIRES_LIST=0
ifneq ($(PACKAGE_REQUIRED_PACKAGE_LIST),)
REQUIRES_LIST=1
endif
#
# Extract summary, description and authors
#
......@@ -89,9 +101,9 @@ endif
ifeq ($(VER_EXISTS),no)
_rpmall: fail
fail:
$(error Error could not find a valid version.h in package '$(Package)')
$(error Error could not find a valid version.h in package '$(Package)' or missing package release)
else
_rpmall: spec_update makerpm
_rpmall: makerpm
endif
......@@ -101,50 +113,56 @@ endif
# @echo "*** "$(Package) I am in the elese
endif
# rpmbuild -bb -bl --target $(XDAQ_PLATFORM) --define "_topdir $(PackagePath)/rpm/RPMBUILD" $(PackagePath)/rpm/$(PackageName).spec
# rpmbuild -bb -bl --target $(XDAQ_PLATFORM) --define "_topdir $(PackagePath)/rpm/RPMBUILD" $(PackagePath)/rpm/$(FullPackageName).spec || exit 1
.PHONY: makerpm
makerpm:
.ONESHELL:
makerpm: spec_update
cd $(PackagePath)/projects; tar -xf psx-$(XDAQ_PLATFORM).tar
mkdir -p $(PackagePath)/rpm/RPMBUILD/{RPMS/{$(XDAQ_PLATFORM)},SPECS,BUILD,SOURCES,SRPMS}
tar -P -X $(XDAQ_ROOT)/$(BUILD_SUPPORT)/src.exclude -zcf $(PackagePath)/rpm/RPMBUILD/SOURCES/$(PackageName)-$(PACKAGE_VER_MAJOR).$(PACKAGE_VER_MINOR).$(PACKAGE_VER_PATCH)-$(BUILD_VERSION).$(PACKAGE_RELEASE).$(BUILD_DISTRIBUTION).$(BUILD_COMPILER).tgz $(PackagePath)
rpmbuild --quiet -bb -bl --define "_topdir $(PackagePath)/rpm/RPMBUILD" $(PackagePath)/rpm/$(PackageName).spec
tar -P -X $(XDAQ_ROOT)/$(BUILD_SUPPORT)/src.exclude --exclude "*/rpm" -zcf $(PackagePath)/rpm/RPMBUILD/SOURCES/$(PackageName)-$(PACKAGE_VER_MAJOR).$(PACKAGE_VER_MINOR).$(PACKAGE_VER_PATCH)-$(BUILD_VERSION).$(PACKAGE_RELEASE).$(BUILD_DISTRIBUTION).$(BUILD_COMPILER).tgz $(PackagePath)
rpmbuild --quiet -ba -bl --define "_requires $(REQUIRES_LIST)" --define "_topdir $(PackagePath)/rpm/RPMBUILD" $(PackagePath)/rpm/$(FullPackageName).spec || exit 1
find $(PackagePath)/rpm/RPMBUILD -name "*.rpm" -exec mv {} $(PackagePath)/rpm \;
.PHONY: spec_update
spec_update:
mkdir -p $(PackagePath)/rpm
cp $(BUILD_HOME)/$(Package)/PSXSpec.template $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__release__#$(BUILD_VERSION).$(PACKAGE_RELEASE).$(BUILD_DISTRIBUTION).$(BUILD_COMPILER)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__version__#$(PACKAGE_VER_MAJOR).$(PACKAGE_VER_MINOR).$(PACKAGE_VER_PATCH)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__prefix__#$(INSTALL_PATH)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__requires__#$(PACKAGE_REQUIRED_PACKAGE_LIST)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__package__#$(Package)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__packagedir__#$(PackagePath)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__packagename__#$(PackageName)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__os__#$(XDAQ_OS)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__platform__#$(XDAQ_PLATFORM)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__project__#$(PROJECT_NAMESPACE)$(Project)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__author__#$(Authors)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__summary__#$(Summary)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__description__#$(Description)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__url__#$(Link)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__buildarch__#$(XDAQ_PLATFORM)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__includedirs__#$(IncludeDirs)#' $(PackagePath)/rpm/$(PackageName).spec
perl -p -i -e 's#__winccoaroot__#$(PVSS_II_HOME)#' $(PackagePath)/rpm/$(PackageName).spec
if [ -e $(PackagePath)/spec.template ]; then \
cp $(PackagePath)/spec.template $(PackagePath)/rpm/$(FullPackageName).spec; \
else \
cp $(XDAQ_ROOT)/$(BUILD_SUPPORT)/spec.template $(PackagePath)/rpm/$(FullPackageName).spec; \
fi
perl -p -i -e 's#__release__#$(BUILD_VERSION).$(PACKAGE_RELEASE).$(BUILD_DISTRIBUTION).$(BUILD_COMPILER)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__version__#$(PACKAGE_VER_MAJOR).$(PACKAGE_VER_MINOR).$(PACKAGE_VER_PATCH)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__prefix__#$(INSTALL_PATH)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__requires__#$(PACKAGE_REQUIRED_PACKAGE_LIST)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__package__#$(Package)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__packagedir__#$(PackagePath)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__packagename__#$(PackageName)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__os__#$(XDAQ_OS)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__platform__#$(XDAQ_PLATFORM)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__project__#$(PROJECT_NAMESPACE)$(Project)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__author__#$(Authors)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__summary__#$(Summary)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__description__#$(Description)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__url__#$(Link)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__buildarch__#$(XDAQ_PLATFORM)#' $(PackagePath)/rpm/$(FullPackageName).spec
perl -p -i -e 's#__winccoaroot__#$(PVSS_II_HOME)#' $(PackagePath)/rpm/$(FullPackageName).spec
# Check if IncludeDirs is an empty line
if [[ -z "${IncludeDirs// }" ]]; then \
perl -p -i -e 's#__includedirs__#%{nil}#' $(PackagePath)/rpm/$(FullPackageName).spec; \
else \
perl -p -i -e 's#__includedirs__#$(IncludeDirs)#' $(PackagePath)/rpm/$(FullPackageName).spec; \
fi
.PHONY: _cleanrpmall
_cleanrpmall:
-rm -rf $(PackagePath)/rpm
.PHONY: _installrpmall
_installrpmall:
mkdir -p $(INSTALL_PREFIX)/rpm
cp $(PackagePath)/rpm/*.rpm $(INSTALL_PREFIX)/rpm
.PHONY: _changelogall
_changelogall:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment