From 2cea13a650684abb79b1e359d7fe08df10e8faae Mon Sep 17 00:00:00 2001 From: Erich Cordoba Date: Wed, 6 Feb 2019 12:43:36 -0600 Subject: [PATCH] Standardize makefile for guest-client Changes done: - The install instructions were moved into the makefile. - Unused install instructions were removed. - Cleanup in the spec file. Change-Id: I9167f039c87360917de2d620fad718ab4e4cbaff Story: 2004043 Task: 27555 Signed-off-by: Erich Cordoba --- guest-client/centos/guest-client.spec | 38 +++++--------------- guest-client/guest-client-3.0.1/Makefile | 29 +++++++++++---- guest-client/guest-client-3.0.1/README.build | 11 ++++-- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/guest-client/centos/guest-client.spec b/guest-client/centos/guest-client.spec index 317fa7c1..300deb52 100644 --- a/guest-client/centos/guest-client.spec +++ b/guest-client/centos/guest-client.spec @@ -8,7 +8,6 @@ Packager: Wind River URL: unknown Source0: %{name}-%{version}.tar.gz -#Source1: guest_heartbeat_msg_defs.h %define cgcs_sdk_deploy_dir /opt/deploy/cgcs_sdk @@ -21,7 +20,7 @@ Requires(postun): systemd BuildRequires: systemd %endif -%package -n guest-client-devel +%package -n %{name}-devel Summary: Guest-Client - Development files Group: devel Provides: guest-client-dev(x86_64) = 3.0.1-r1.0 @@ -34,8 +33,8 @@ BuildRequires: json-c-devel %description Guest-Client with heartbeat functionality. -%description -n guest-client-devel -Guest-Client with heartbeat functionality. This package contains symbolic +%description -n %{name}-devel +Guest-Client with heartbeat functionality. This package contains symbolic links, header files, and related items necessary for software development. %description -n %{name}-cgts-sdk @@ -43,36 +42,19 @@ Guest-Client SDK files %prep %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 -make clean make build sysconfdir=%{_sysconfdir} make sample make tar ARCHIVE_NAME=wrs-guest-heartbeat-%{version} -find build # Install for guest-client package %install -install -m 750 -d %{buildroot}/usr -install -m 750 -d %{buildroot}%{_includedir} -install -m 750 -d %{buildroot}%{_includedir}/guest-client -install -m 640 -p -D guest_client/src/heartbeat/guest_heartbeat_msg_defs.h %{buildroot}%{_includedir}/guest-client/guest_heartbeat_msg_defs.h -install -d %{buildroot}%{cgcs_sdk_deploy_dir} -install -m 640 build/wrs-guest-heartbeat-%{version}.tgz %{buildroot}%{cgcs_sdk_deploy_dir} -%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} +make install \ + prefix=%{buildroot}/usr \ + includedir=%{buildroot}%{_includedir} \ + SDK_DEPLOY_DIR=%{buildroot}%{cgcs_sdk_deploy_dir} \ + unitdir=%{buildroot}%{_unitdir} \ + sysconfdir=%{buildroot}%{_sysconfdir} %files %defattr(755,root,root,-) @@ -103,9 +85,7 @@ systemctl reload %endif %files -n guest-client-devel - %defattr(644,root,root,-) - /usr/include/guest-client/guest_heartbeat_msg_defs.h %files -n %{name}-cgts-sdk diff --git a/guest-client/guest-client-3.0.1/Makefile b/guest-client/guest-client-3.0.1/Makefile index 4dc62d1c..403d1c2f 100755 --- a/guest-client/guest-client-3.0.1/Makefile +++ b/guest-client/guest-client-3.0.1/Makefile @@ -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 # modification, are permitted provided that the following conditions @@ -29,13 +29,16 @@ # SHELL = /bin/sh +VERSION := 3.0.1 + ## Configuration Directory Variables -prefix := /usr/local +prefix := /usr exec_prefix := $(prefix) -sysconfdir := $(prefix)/etc +sysconfdir := /etc includedir := $(prefix)/include libdir := $(exec_prefix)/lib bindir := $(exec_prefix)/bin +unitdir := /usr/lib/systemd/system MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURRENT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) @@ -43,6 +46,7 @@ PARENT_DIR := $(patsubst %/,%,$(dir $(CURRENT_DIR))) BUILD_DIR := $(CURRENT_DIR)/build PACKAGE_DIR := $(BUILD_DIR)/package PACKAGE_ROOT_DIR := $(PACKAGE_DIR)/rootdir +SDK_DEPLOY_DIR := /opt/deploy/cgcs_sdk ARCHIVE_NAME := wrs-guest-client-3.0.1 ARCHIVE_PKG_NAME := wrs-guest-client-3.0.1_pkg @@ -110,9 +114,22 @@ package: @(cd $(BUILD_DIR); tar -pczf $(ARCHIVE_PKG_NAME).tgz \ $(ARCHIVE_PKG_NAME)/* --directory $(PACKAGE_DIR)) -install: package - @(echo "Installing ...") - @(cd $(PACKAGE_DIR); ./guest-client.pkg install $(INIT_TYPE) $(DESTDIR)) +install: + install -m 750 -d $(prefix) + 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 @(echo "Uninstalling ...") diff --git a/guest-client/guest-client-3.0.1/README.build b/guest-client/guest-client-3.0.1/README.build index 0e6d4522..f08a2397 100755 --- a/guest-client/guest-client-3.0.1/README.build +++ b/guest-client/guest-client-3.0.1/README.build @@ -173,9 +173,9 @@ INSTALL This will install the default configuration file, include files, compiled libraries and executable into the following directories: - guest_heartbeat.conf --> /usr/local/etc/guest-client/heartbeat - guest_api_types.h --> /usr/local/include - guest_heartbeat_api.h --> /usr/local/include + guest_heartbeat.conf --> /etc/guest-client/heartbeat + guest_api_types.h --> /usr/include/ + guest_heartbeat_api.h --> /usr/include libguest_common_api.so.3.0.0 --> /usr/local/lib libguest_heartbeat_api.so.3.0.0 --> /usr/local/lib guest-client --> /usr/local/bin @@ -214,6 +214,11 @@ INSTALL bindir - directory for installing executable programs, set to $(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. Usage: make = ...