Merge "Standardize makefile for guest-client"

This commit is contained in:
Zuul 2019-02-27 13:29:12 +00:00 committed by Gerrit Code Review
commit 116b10b7c6
3 changed files with 40 additions and 38 deletions

View File

@ -8,7 +8,6 @@ Packager: Wind River <info@windriver.com>
URL: unknown URL: unknown
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
#Source1: guest_heartbeat_msg_defs.h
%define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk %define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk
@ -21,7 +20,7 @@ Requires(postun): systemd
BuildRequires: systemd BuildRequires: systemd
%endif %endif
%package -n guest-client-devel %package -n %{name}-devel
Summary: Guest-Client - Development files Summary: Guest-Client - Development files
Group: devel Group: devel
Provides: guest-client-dev(x86_64) = 3.0.1-r1.0 Provides: guest-client-dev(x86_64) = 3.0.1-r1.0
@ -34,8 +33,8 @@ BuildRequires: json-c-devel
%description %description
Guest-Client with heartbeat functionality. Guest-Client with heartbeat functionality.
%description -n guest-client-devel %description -n %{name}-devel
Guest-Client with heartbeat functionality. This package contains symbolic Guest-Client with heartbeat functionality. This package contains symbolic
links, header files, and related items necessary for software development. links, header files, and related items necessary for software development.
%description -n %{name}-cgts-sdk %description -n %{name}-cgts-sdk
@ -43,36 +42,19 @@ Guest-Client SDK files
%prep %prep
%setup %setup
#%build -C guest-client-3.0.1/guest_client/src/heartbeat
#tar czf %{name}-%{version}.tgz %{name}-%{version}
#find . -name "*.tgz"
#echo `pwd`
# Build for guest-client package # Build for guest-client package
make clean
make build sysconfdir=%{_sysconfdir} make build sysconfdir=%{_sysconfdir}
make sample make sample
make tar ARCHIVE_NAME=wrs-guest-heartbeat-%{version} make tar ARCHIVE_NAME=wrs-guest-heartbeat-%{version}
find build
# Install for guest-client package # Install for guest-client package
%install %install
install -m 750 -d %{buildroot}/usr make install \
install -m 750 -d %{buildroot}%{_includedir} prefix=%{buildroot}/usr \
install -m 750 -d %{buildroot}%{_includedir}/guest-client includedir=%{buildroot}%{_includedir} \
install -m 640 -p -D guest_client/src/heartbeat/guest_heartbeat_msg_defs.h %{buildroot}%{_includedir}/guest-client/guest_heartbeat_msg_defs.h SDK_DEPLOY_DIR=%{buildroot}%{cgcs_sdk_deploy_dir} \
install -d %{buildroot}%{cgcs_sdk_deploy_dir} unitdir=%{buildroot}%{_unitdir} \
install -m 640 build/wrs-guest-heartbeat-%{version}.tgz %{buildroot}%{cgcs_sdk_deploy_dir} sysconfdir=%{buildroot}%{_sysconfdir}
%if %{with systemd}
install -m 644 -p -D guest_client/scripts/guest-client.service %{buildroot}%{_unitdir}/guest-client.service
install -m 744 -p -D guest_client/scripts/guest-client.systemd %{buildroot}%{_sysconfdir}/guest-client/guest-client.systemd
%endif
install -m 750 -d %{buildroot}%{_sysconfdir}/guest-client/heartbeat
install -m 755 -p -D guest_client/scripts/guest_heartbeat.conf %{buildroot}%{_sysconfdir}/guest-client/heartbeat/guest_heartbeat.conf
install -m 755 -p -D guest_client/scripts/sample_event_handling_script %{buildroot}%{_sysconfdir}/guest-client/heartbeat/sample_event_handling_script
install -m 755 -p -D guest_client/scripts/sample_health_check_script %{buildroot}%{_sysconfdir}/guest-client/heartbeat/sample_health_check_script
install -m 640 -p -D build/guest-client %{buildroot}/usr/local/bin/guest-client
install -m 640 -p -D build/libguest_common_api.so.%{version} %{buildroot}/usr/local/lib/libguest_common_api.so.%{version}
install -m 640 -p -D build/libguest_heartbeat_api.so.%{version} %{buildroot}/usr/local/lib/libguest_heartbeat_api.so.%{version}
%files %files
%defattr(755,root,root,-) %defattr(755,root,root,-)
@ -103,9 +85,7 @@ systemctl reload
%endif %endif
%files -n guest-client-devel %files -n guest-client-devel
%defattr(644,root,root,-) %defattr(644,root,root,-)
/usr/include/guest-client/guest_heartbeat_msg_defs.h /usr/include/guest-client/guest_heartbeat_msg_defs.h
%files -n %{name}-cgts-sdk %files -n %{name}-cgts-sdk

View File

@ -1,5 +1,5 @@
# #
# Copyright(c) 2013-2016, Wind River Systems, Inc. # Copyright(c) 2013-2016, Wind River Systems, Inc.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@ -29,13 +29,16 @@
# #
SHELL = /bin/sh SHELL = /bin/sh
VERSION := 3.0.1
## Configuration Directory Variables ## Configuration Directory Variables
prefix := /usr/local prefix := /usr
exec_prefix := $(prefix) exec_prefix := $(prefix)
sysconfdir := $(prefix)/etc sysconfdir := /etc
includedir := $(prefix)/include includedir := $(prefix)/include
libdir := $(exec_prefix)/lib libdir := $(exec_prefix)/lib
bindir := $(exec_prefix)/bin bindir := $(exec_prefix)/bin
unitdir := /usr/lib/systemd/system
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) CURRENT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
@ -43,6 +46,7 @@ PARENT_DIR := $(patsubst %/,%,$(dir $(CURRENT_DIR)))
BUILD_DIR := $(CURRENT_DIR)/build BUILD_DIR := $(CURRENT_DIR)/build
PACKAGE_DIR := $(BUILD_DIR)/package PACKAGE_DIR := $(BUILD_DIR)/package
PACKAGE_ROOT_DIR := $(PACKAGE_DIR)/rootdir PACKAGE_ROOT_DIR := $(PACKAGE_DIR)/rootdir
SDK_DEPLOY_DIR := /opt/deploy/cgcs_sdk
ARCHIVE_NAME := wrs-guest-client-3.0.1 ARCHIVE_NAME := wrs-guest-client-3.0.1
ARCHIVE_PKG_NAME := wrs-guest-client-3.0.1_pkg ARCHIVE_PKG_NAME := wrs-guest-client-3.0.1_pkg
@ -110,9 +114,22 @@ package:
@(cd $(BUILD_DIR); tar -pczf $(ARCHIVE_PKG_NAME).tgz \ @(cd $(BUILD_DIR); tar -pczf $(ARCHIVE_PKG_NAME).tgz \
$(ARCHIVE_PKG_NAME)/* --directory $(PACKAGE_DIR)) $(ARCHIVE_PKG_NAME)/* --directory $(PACKAGE_DIR))
install: package install:
@(echo "Installing ...") install -m 750 -d $(prefix)
@(cd $(PACKAGE_DIR); ./guest-client.pkg install $(INIT_TYPE) $(DESTDIR)) install -m 750 -d $(includedir)
install -m 750 -d $(includedir)/guest-client
install -m 640 -p -D guest_client/src/heartbeat/guest_heartbeat_msg_defs.h $(includedir)/guest-client/guest_heartbeat_msg_defs.h
install -m 755 -d $(SDK_DEPLOY_DIR)
install -m 640 build/wrs-guest-heartbeat-$(VERSION).tgz $(SDK_DEPLOY_DIR)
install -m 644 -p -D guest_client/scripts/guest-client.service $(unitdir)/guest-client.service
install -m 744 -p -D guest_client/scripts/guest-client.systemd $(sysconfdir)/guest-client/guest-client.systemd
install -m 750 -d $(sysconfdir)/guest-client/heartbeat
install -m 755 -p -D guest_client/scripts/guest_heartbeat.conf $(sysconfdir)/guest-client/heartbeat/guest_heartbeat.conf
install -m 755 -p -D guest_client/scripts/sample_event_handling_script $(sysconfdir)/guest-client/heartbeat/sample_event_handling_script
install -m 755 -p -D guest_client/scripts/sample_health_check_script $(sysconfdir)/guest-client/heartbeat/sample_health_check_script
install -m 640 -p -D build/guest-client $(prefix)/local/bin/guest-client
install -m 640 -p -D build/libguest_common_api.so.$(VERSION) $(prefix)/local/lib/libguest_common_api.so.$(VERSION)
install -m 640 -p -D build/libguest_heartbeat_api.so.$(VERSION) $(prefix)/local/lib/libguest_heartbeat_api.so.$(VERSION)
uninstall: package uninstall: package
@(echo "Uninstalling ...") @(echo "Uninstalling ...")

View File

@ -173,9 +173,9 @@ INSTALL
This will install the default configuration file, include files, This will install the default configuration file, include files,
compiled libraries and executable into the following directories: compiled libraries and executable into the following directories:
guest_heartbeat.conf --> /usr/local/etc/guest-client/heartbeat guest_heartbeat.conf --> /etc/guest-client/heartbeat
guest_api_types.h --> /usr/local/include guest_api_types.h --> /usr/include/
guest_heartbeat_api.h --> /usr/local/include guest_heartbeat_api.h --> /usr/include
libguest_common_api.so.3.0.0 --> /usr/local/lib libguest_common_api.so.3.0.0 --> /usr/local/lib
libguest_heartbeat_api.so.3.0.0 --> /usr/local/lib libguest_heartbeat_api.so.3.0.0 --> /usr/local/lib
guest-client --> /usr/local/bin guest-client --> /usr/local/bin
@ -214,6 +214,11 @@ INSTALL
bindir - directory for installing executable programs, set to bindir - directory for installing executable programs, set to
$(exec_prefix)/bin $(exec_prefix)/bin
unitdir - directory for installing systemd unit files, set by
default to /usr/lib/systemd/system
SDK_DEPLOY_DIR - directory to store the cgcs sdk file.
Note: all directory variables must specify an absolute path. Note: all directory variables must specify an absolute path.
Usage: make <install | uninstall> <variable-name>=<variable-value> ... Usage: make <install | uninstall> <variable-name>=<variable-value> ...