diff --git a/RedHat.OpenPegasus.Makefile b/RedHat.OpenPegasus.Makefile index dd9de73..8b428d5 100644 --- a/RedHat.OpenPegasus.Makefile +++ b/RedHat.OpenPegasus.Makefile @@ -9,9 +9,9 @@ # Jason Vas Dias Red Hat, Inc. April 2006 # SRCNAME ?= pegasus -RPM_BUILD_DIR ?= $(shell cd ..;pwd) -RPM_ARCH ?= $(shell uname -i) -RPM_OPT_FLAGS ?= $(shell rpm -q rpm --qf '%{OPTFLAGS}') +export RPM_BUILD_DIR ?= $(shell cd ..;pwd) +export RPM_ARCH ?= $(shell uname -i) +export RPM_OPT_FLAGS ?= $(shell rpm -q rpm --qf '%{OPTFLAGS}') ifndef PEGASUS_PLATFORM ifeq ($(RPM_ARCH),ia64) export PEGASUS_PLATFORM := LINUX_IA64_GNU @@ -73,7 +73,7 @@ BINARIES=$(SBINS) $(UBINS) PROVIDERS=$(B)/lib/Pegasus/providers/libComputerSystemProvider.so.1 $(B)/lib/Pegasus/providers/libOSProvider.so.1 $(B)/lib/Pegasus/providers/libProcessProvider.so.1 LIBRARIES=$(B)/lib/libCIMQueryCapabilitiesProvider.so.1 $(B)/lib/libCIMxmlIndicationHandler.so.1 $(B)/lib/libCMPIProviderManager.so.1 $(B)/lib/libCertificateProvider.so.1 $(B)/lib/libConfigSettingProvider.so.1 $(B)/lib/libDefaultProviderManager.so.1 $(B)/lib/libNamespaceProvider.so.1 $(B)/lib/libProviderRegistrationProvider.so.1 $(B)/lib/libUserAuthProvider.so.1 $(B)/lib/libcmpiCppImpl.so.1 $(B)/lib/libpegauthentication.so.1 $(B)/lib/libpegclient.so.1 $(B)/lib/libpegcliutils.so.1 $(B)/lib/libpegcommon.so.1 $(B)/lib/libpegcompiler.so.1 $(B)/lib/libpegconfig.so.1 $(B)/lib/libpegcql.so.1 $(B)/lib/libpegexportclient.so.1 $(B)/lib/libpegexportserver.so.1 $(B)/lib/libpeggetoopt.so.1 $(B)/lib/libpeghandlerservice.so.1 $(B)/lib/libpegindicationservice.so.1 $(B)/lib/libpeglistener.so.1 $(B)/lib/libpegprm.so.1 $(B)/lib/libpegprovider.so.1 $(B)/lib/libpegprovidermanager.so.1 $(B)/lib/libpegquerycommon.so.1 $(B)/lib/libpegqueryexpression.so.1 $(B)/lib/libpegrepository.so.1 $(B)/lib/libpegserver.so.1 $(B)/lib/libpegservice.so.1 $(B)/lib/libpeguser.so.1 $(B)/lib/libpegwql.so.1 -all: setup $(BINARIES) $(LIBRARIES) $(PROVIDERS) +all: $(BINARIES) $(LIBRARIES) $(PROVIDERS) setup: $(MAKE) -f Makefile.Release create_ProductVersionFile @@ -81,6 +81,8 @@ setup: $(MAKE) -f Makefile.Release create_ConfigProductDirectoriesInclude touch setup +$(BINARIES) $(LIBRARIES) $(PROVIDERS): setup + $(B)/bin/cimserver: $(B)/lib/libpegclient.so.1 $(B)/lib/libpegserver.so.1 $(B)/lib/libpeguser.so.1 $(B)/lib/libpegprm.so.1 $(B)/lib/libNamespaceProvider.so.1 $(B)/lib/libpegindicationservice.so.1 $(B)/lib/libpeghandlerservice.so.1 $(B)/lib/libConfigSettingProvider.so.1 $(B)/lib/libDefaultProviderManager.so.1 $(B)/lib/libProviderRegistrationProvider.so.1 $(B)/lib/libpegauthentication.so.1 $(B)/lib/libUserAuthProvider.so.1 $(B)/lib/libpegqueryexpression.so.1 $(B)/lib/libpegcql.so.1 $(B)/lib/libpegquerycommon.so.1 $(B)/lib/libpegwql.so.1 $(B)/lib/libCIMQueryCapabilitiesProvider.so.1 $(B)/lib/libpegprovidermanager.so.1 $(B)/lib/libpegprovider.so.1 $(B)/lib/libpegexportserver.so.1 $(B)/lib/libpegrepository.so.1 $(B)/lib/libpegconfig.so.1 $(B)/lib/libpegcommon.so.1 $(B)/lib/libpegservice.so.1 $(B)/lib/libCertificateProvider.so.1 $(B)/lib/Pegasus/providers/libComputerSystemProvider.so.1 $(B)/lib/Pegasus/providers/libOSProvider.so.1 $(B)/lib/Pegasus/providers/libProcessProvider.so.1 $(MAKE) -C $(R)/src/Server @@ -300,6 +302,7 @@ PEGSCHEMA= $(R)/Schemas/Pegasus/Internal/VER20/PG_SSLCertificate20.mof \ PEGMOF=$(addprefix $(D)$(share)/Pegasus/mof/Pegasus/,$(notdir $(CIMSCHEMA))) LINKED_LIBS=$(D)/$(lib)/libpegclient.so.1 $(D)/$(lib)/libpegcommon.so.1 $(D)/$(lib)/libpegprovider.so.1 $(D)/$(lib)/libDefaultProviderManager.so.1 $(D)/$(lib)/libCIMxmlIndicationHandler.so.1 $(D)/$(lib)/libCMPIProviderManager.so.1 $(D)/$(lib)/Pegasus/providers/libComputerSystemProvider.so.1 $(D)/$(lib)/Pegasus/providers/libOSProvider.so.1 $(D)/$(lib)/Pegasus/providers/libProcessProvider.so.1 export PEGASUS_STAGING_DIR := $(D) +BSX ?= install: dirs config libs lib_links bins mans mof SDK ghost_files repository @@ -351,13 +354,15 @@ $(patsubst %.so.1,%.so,$(LINKED_LIBS)): lib_links: libs $(patsubst %.so.1,%.so,$(LINKED_LIBS)) -$(patsubst $(B)/bin/%,$(D)/$(sbin)/%,$(SBINS)): - $(install) -m 0750 -o $(root_user) -g $(pegasus_user) -p $(patsubst $(D)/$(sbin)/%,$(B)/bin/%, $@) $@ +$(patsubst $(B)/bin/%,$(D)/$(sbin)/%,$(patsubst %,%$(BSX),$(SBINS))): + $(install) -m 0750 -o $(root_user) -g $(pegasus_user) -p $(patsubst %$(BSX),%,$(patsubst $(D)/$(sbin)/%,$(B)/bin/%, $@)) $@ + if [ -n "$(BSX)" ]; then /bin/ln -s $(notdir $@) $(patsubst %$(BSX),%,$@); fi -$(patsubst $(B)/bin/%,$(D)/$(bin)/%,$(UBINS)): - $(install) -m 0755 -o $(root_user) -g $(pegasus_user) -p $(patsubst $(D)/$(bin)/%,$(B)/bin/%, $@) $@ +$(patsubst $(B)/bin/%,$(D)/$(bin)/%,$(patsubst %,%$(BSX),$(UBINS))): + $(install) -m 0755 -o $(root_user) -g $(pegasus_user) -p $(patsubst %$(BSX),%,$(patsubst $(D)/$(bin)/%,$(B)/bin/%, $@)) $@ + if [ -n "$(BSX)" ]; then /bin/ln -s $(notdir $@) $(patsubst %$(BSX),%,$@); fi -bins: $(SBINS) $(UBINS) $(patsubst $(B)/bin/%,$(D)/$(sbin)/%,$(SBINS)) $(patsubst $(B)/bin/%,$(D)/$(bin)/%,$(UBINS)) +bins: $(SBINS) $(UBINS) $(patsubst $(B)/bin/%,$(D)/$(sbin)/%,$(patsubst %,%$(BSX),$(SBINS))) $(patsubst $(B)/bin/%,$(D)/$(bin)/%,$(patsubst %,%$(BSX),$(UBINS))) $(D)/$(mandir)/man8/%.8: $(install) -m 0644 -o $(root_user) -g $(root_user) -p $(R)/rpm/manLinux/man8.Z/$*.8 $@ @@ -375,6 +380,7 @@ SDK: /bin/mkdir -p $(PEGASUS_STAGING_DIR)/usr/share/doc/tog-pegasus-2.5/ $(MAKE) -f $(R)/mak/SDKMakefile stageSDK /bin/rm -rf $(PEGASUS_STAGING_DIR)/usr/share/doc/tog-pegasus-2.5/ + if [ -n "$(BSX)" ]; then mv $(D)/$(share)/Pegasus/samples/mak/config.mak $(D)/$(share)/Pegasus/samples/mak/config.mak$(BSX); /bin/ln -s config.mak$(BSX) $(D)/$(share)/Pegasus/samples/mak/config.mak; fi; touch SDK ghost_files: @@ -551,6 +557,7 @@ test_mak: test_makefile: $(MAKE) --directory=$(R) -f Makefile.ReleaseTest -s create_Makefile + if [ -n "$(BSX)" ]; then /bin/mv $(D)/$(share)/Pegasus/test/Makefile $(D)/$(share)/Pegasus/test/Makefile$(BSX); /bin/ln -s Makefile$(BSX) $(D)/$(share)/Pegasus/test/Makefile; fi; test_repository: LD_LIBRARY_PATH=$(B)/lib PATH=$(B)/bin:$$PATH $(MAKE) --directory=$(R) -f Makefile.ReleaseTest -s create_repository diff --git a/pegasus_arch_alternatives b/pegasus_arch_alternatives new file mode 100755 index 0000000..e5b0b7b --- /dev/null +++ b/pegasus_arch_alternatives @@ -0,0 +1,158 @@ +#!/bin/bash +# +# Script to manage tog-pegasus alternatives for multi-lib platforms +# +# Jason Vas Dias, Red Hat, Inc. June 2006 +# +# Usage: +# pegasus_arch_alternatives +# ( --list [pfx] | +# ( [ devel | test ] [ -64 ] [ -32 ] [ --remove ] [ --display ] ) +# ) +# no args : set up library and binary 'pegasus' alternatives +# --list : list 64/32-bit alternatives, with optional prefix pfx +# devel : set up the 'pegasus-devel' alternative +# test : set up the 'pegasus-test' alternative +# -64 : select 64-bit alternatives +# -32 : select 32-bit alternatives +# --remove : remove all pegasus alternatives +# --display: display the pegasus alternatives +# +ALT='pegasus' +LINK=/usr/sbin/cimserver +SLAVES=(/usr/{bin/{cimmof,cimmofl,cimprovider,osinfo,wbemexec},sbin/{cimauth,cimconfig,cimprovagt,cimuser,repupgrade}}) +DEVEL_LINK=/usr/share/Pegasus/samples/mak/config.mak +TEST_LINK=/usr/share/Pegasus/test/Makefile +# +# Handle listing arg: +# +if [ "$1" = '--list' ]; then + pfx=''; + if [ $# -gt 1 ]; then + pfx=$2' '; + fi; + for f in $LINK ${SLAVES[@]} $DEVEL_LINK $TEST_LINK; do + echo ${pfx}$f; + done; + exit 0; +fi +# +# Ensure that files and alternatives are correctly in-sync for architecture: +# +ARCH=`/bin/uname -i` +case $ARCH in + # return for arches that have no alternatives + ia64 ) + # nothing to be done - shipped without binary suffix + exit 0; + ;; + i386 | ppc | s390 ) + # shipped with -32 suffix, but no alternatives possible - move: + for f in $LINK ${SLAVES[@]} $DEVEL_LINK $TEST_LINK; + do + if [ -f ${f}-32 ] ; then + /bin/mv -f ${f}-32 $f; + fi; + done; + exit 0; + ;; + x86_64 | ppc64 | s390x ) + # continue + ;; + *) + # unhandled architecture + exit 1; + ;; +esac; +if [ "$1" = 'devel' ] || [ "$1" = 'test' ]; then + ALT='pegasus-'$1; + shift; + SLAVES=(); + if [ "$ALT" = 'pegasus-devel' ]; then + LINK=$DEVEL_LINK; + else + LINK=$TEST_LINK; + fi; +fi; +# +# Ensure that whatever alternatives can be installed, are installed, +# and those that can't be installed are removed: +# +alternatives="`/usr/sbin/alternatives --display $ALT 2>/dev/null`"; +slaves64='' +slaves32='' +installed64=1; +installed32=1; +for f in $LINK ${SLAVES[@]}; do + if [ $installed64 -eq 1 ] && [ -f ${f}-64 ]; then + slaves64=${slaves64}'--slave '$f' '${f##*/}' '${f}-64' '; + else + installed64=0; + continue; + fi; + if [ $installed32 -eq 1 ] && [ -f ${f}-32 ]; then + slaves32=${slaves32}'--slave '$f' '${f##*/}' '${f}-32' '; + else + installed32=0; + continue; + fi; + if [ -e $f ] && [ ! -L $f ]; then + /bin/rm -f $f; + fi; +done +if [ $installed64 -eq 0 ]; then + /usr/sbin/alternatives --remove $ALT ${LINK}-64 >/dev/null 2>&1 || :; +elif ! echo "$alternatives" | /bin/egrep -q "^${LINK}-64"; then + /usr/sbin/alternatives --install $LINK $ALT ${LINK}-64 50 $slaves64; +fi; +if [ $installed32 -eq 0 ]; then + /usr/sbin/alternatives --remove $ALT ${LINK}-32 >/dev/null 2>&1 || :; +elif ! echo "$alternatives" | /bin/egrep -q "^${LINK}-32"; then + /usr/sbin/alternatives --install $LINK $ALT ${LINK}-32 50 $slaves32; +fi; +# +# Handle optional user args +# +if [ -n "$1" ]; then + case $1 in + -64 ) + if [ $installed64 -eq 1 ]; then + /usr/sbin/alternatives --set $ALT ${LINK}-64; + if [ "$ALT" = 'pegasus' ]; then + /usr/sbin/alternatives --set pegasus-devel ${DEVEL_LINK}-64 >/dev/null 2>&1; + /usr/sbin/alternatives --set pegasus-test ${TEST_LINK}-64 >/dev/null 2>&1; + fi; + fi + ;; + -32 ) + if [ $installed32 -eq 1 ]; then + /usr/sbin/alternatives --set $ALT ${LINK}-32; + if [ "$ALT" = 'pegasus' ]; then + /usr/sbin/alternatives --set pegasus-devel ${DEVEL_LINK}-32 >/dev/null 2>&1; + /usr/sbin/alternatives --set pegasus-test ${TEST_LINK}-32 >/dev/null 2>&1; + fi; + fi + ;; + --remove ) + /usr/sbin/alternatives --remove $ALT ${LINK}-32 >/dev/null 2>&1; + /usr/sbin/alternatives --remove $ALT ${LINK}-64 >/dev/null 2>&1; + if [ "$ALT" = 'pegasus' ]; then + /usr/sbin/alternatives --remove pegasus-devel ${DEVEL_LINK}-32 >/dev/null 2>&1; + /usr/sbin/alternatives --remove pegasus-devel ${DEVEL_LINK}-64 >/dev/null 2>&1; + /usr/sbin/alternatives --remove pegasus-test ${TEST_LINK}-32 >/dev/null 2>&1; + /usr/sbin/alternatives --remove pegasus-test ${TEST_LINK}-64 >/dev/null 2>&1; + fi; + ;; + --display ) + /usr/sbin/alternatives --display $ALT; + if [ "$ALT" = 'pegasus' ]; then + /usr/sbin/alternatives --display pegasus-devel; + /usr/sbin/alternatives --display pegasus-test; + fi + ;; + *) + exit 1; + ;; + esac; +fi; +exit 0;