Skip to content

Commit

Permalink
Fixes #16861: Build agent on solaris
Browse files Browse the repository at this point in the history
  • Loading branch information
peckpeck committed Mar 6, 2020
1 parent 4ba0e0b commit 65c7fbf
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 7 deletions.
12 changes: 9 additions & 3 deletions rudder-agent/SOURCES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ BUILD_FLAGS=CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
build-ssl: openssl-source
# openssl doesn't support CFLAGS (it overrides its own) so we must pass them in batch to configure
# openssl doesn't work with pie
cd openssl-source && RELEASE="" $(SSL_CONFIGURE) -fPIC $(CFLAGS) $(LDFLAGS) --prefix=$(RUDDER_DIR) --openssldir=$(RUDDER_DIR)/openssl shared no-idea no-rc5 no-ssl3 no-dtls no-psk no-srp no-engine
cd openssl-source && RELEASE="" $(SSL_CONFIGURE) -fPIC $(CFLAGS) $(LDFLAGS) --prefix=$(RUDDER_DIR) --openssldir=$(RUDDER_DIR)/openssl shared no-idea no-rc5 no-ssl3 no-dtls no-psk no-srp no-engine enable-egd
# we need aix libpath in ssl library
ifeq (aix,$(OS_FAMILY))
cd openssl-source && sed '/link_a.aix:/,/link_app.aix:/s/-bnolibpath,//' Makefile.shared > Makefile.shared.tmp && mv Makefile.shared.tmp Makefile.shared
Expand All @@ -531,6 +531,7 @@ endif
slibclean >/dev/null 2>&1 || true
# install to a temporary location is needed to build cfengine
cd openssl-source && $(MAKE) install $(OPENSSL_DESTDIR_VAR_NAME)=$(CURDIR)/dependencies
touch $@

build-lmdb: lmdb-source
# lmdb doesn't support CFLAGS (it overrides its own) so we pass XCFLAGS instead, that is appended to the original ones
Expand All @@ -548,34 +549,39 @@ build-pcre: pcre-source
cd pcre-source && $(MAKE) $(MAKE_J)
# install to a temporary location is needed to build cfengine
cd pcre-source && $(MAKE) install DESTDIR=$(CURDIR)/dependencies
touch $@

build-zlib: zlib-source
cd zlib-source && $(BUILD_FLAGS) ./configure --prefix=$(RUDDER_DIR)
cd zlib-source && $(MAKE) $(MAKE_J)
# install to a temporary location is needed to build cfengine
cd zlib-source && $(MAKE) install DESTDIR=$(CURDIR)/dependencies
touch $@

build-curl: curl-source
# pkcconfig give openssl build configuration, but it point to final installation path (/opt/rudder)
# since we need the temporary path during build we need to add -I and -L
# since we also need to link it during cfengine build we add -R (--rpath)
# we may want to remove rpath using patchelf at the end, but this is mostly cosmetic
cd curl-source && ./configure --prefix=$(RUDDER_DIR) --without-libpsl --with-ssl $(ZLIB_ARG) --disable-rtsp --enable-ipv6 --without-librtmp --without-ldap-lib CPPFLAGS="-I$(CURDIR)/dependencies$(RUDDER_DIR)/include" CFLAGS="$(CFLAGS) $(PIE_CFLAGS)" LDFLAGS="$(LDFLAGS) -Wl,-R$(CURDIR)/dependencies$(RUDDER_DIR)/lib -L$(CURDIR)/dependencies$(RUDDER_DIR)/lib -Wl,-R$(CURDIR)/dependencies$(RUDDER_DIR)/lib" PKG_CONFIG_PATH="$(CURDIR)/dependencies$(RUDDER_DIR)/lib/pkgconfig"
cd curl-source && ./configure --prefix=$(RUDDER_DIR) --without-libpsl --with-ssl $(ZLIB_ARG) --disable-tls-srp --disable-rtsp --enable-ipv6 --without-libidn2 --without-librtmp --without-ldap-lib CPPFLAGS="-I$(CURDIR)/dependencies$(RUDDER_DIR)/include" CFLAGS="$(CFLAGS) $(PIE_CFLAGS)" LDFLAGS="$(LDFLAGS) -Wl,-R$(CURDIR)/dependencies$(RUDDER_DIR)/lib -L$(CURDIR)/dependencies$(RUDDER_DIR)/lib -Wl,-R$(CURDIR)/dependencies$(RUDDER_DIR)/lib" PKG_CONFIG_PATH="$(CURDIR)/dependencies$(RUDDER_DIR)/lib/pkgconfig"
cd curl-source && $(MAKE) $(MAKE_J)
# install to a temporary location is needed to build cfengine
cd curl-source && $(MAKE) install DESTDIR=$(CURDIR)/dependencies
touch $@

build-yaml: yaml-source
cd yaml-source && ./configure --prefix=$(RUDDER_DIR) --enable-gettext=no $(BUILD_FLAGS)
cd yaml-source && $(MAKE) $(MAKE_J)
# install to a temporary location is needed to build cfengine
cd yaml-source && $(MAKE) install DESTDIR=$(CURDIR)/dependencies
touch $@

build-xml: xml-source
cd xml-source && ./configure --prefix=$(RUDDER_DIR) $(ZLIB_ARG) --with-xpath --with-c14n --without-catalog --without-debug --without-docbook --without-ftp --without-http --without-html --without-iconv --without-python --enable-shared --disable-static $(BUILD_FLAGS)
cd xml-source && $(MAKE) $(MAKE_J)
# install to a temporary location is needed to build cfengine
cd xml-source && $(MAKE) install DESTDIR=$(CURDIR)/dependencies
touch $@

build-perl: perl-$(PERL_RELEASE)
cd perl-$(PERL_RELEASE) && $(MAKE) distclean 2>/dev/null || true # Or this can fail on an already used source
Expand All @@ -591,7 +597,7 @@ build-perl: perl-$(PERL_RELEASE)
-o -name ".packlist" \
-o -name "*.bs" \
| xargs rm -f
touch build-perl # because perl-$(PERL_RELEASE) is touched by make install
touch $@

# check cache content
PATCHES_SHA = $(shell find patches/cfengine -type f | sort | xargs sha256sum | sha256sum | awk '{print $$1}')
Expand Down
63 changes: 59 additions & 4 deletions rudder-agent/solaris/packaging.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
# this is not the final build script just an indication of what has to be dont
set -e

VERSION="6.0.5"
BUILD_DIR="BUILD"

BASE=$(readlink -f $(dirname $0)/..)
cd "${BASE}/SOURCES"

# nightly get
wget -q --header="accept-encoding:" -O rudder-sources.tar.bz2 "http://repository.rudder.io/sources/6.0-nightly/rudder-sources-${VERSION}~rc1-latest.tar.bz2"

# 1- install build-dependencies

# dependencies
pkg install gcc
pkg install gnu-binutils

# 2- configure, make and install into tmpdir

# Temporary directory
cd "${BASE}."
mkdir -p "${BUILD_DIR}"

# use gnu tools to build
export PATH=/usr/gnu/bin:/usr/gnu/x86_64-pc-solaris2.11/bin/:$PATH

env="RUDDER_VERSION_TO_PACKAGE=${VERSION} USE_SYSTEM_OPENSSL=false USE_SYSTEM_ZLIB=false USE_SYSTEM_LMDB=false USE_SYSTEM_PCRE=false USE_SYSTEM_PERL=false USE_SYSTEM_FUSION=false USE_SYSTEM_CURL=false USE_SYSTEM_YAML=false USE_SYSTEM_XML=false USE_ACL=false"

cd SOURCES

# build
gmake build RUDDER_VERSION_TO_PACKAGE=6.0.3 USE_SYSTEM_OPENSSL=false USE_SYSTEM_ZLIB=false USE_SYSTEM_LMDB=false USE_SYSTEM_PCRE=false USE_SYSTEM_PERL=false USE_SYSTEM_FUSION=false USE_SYSTEM_CURL=false USE_SYSTEM_YAML=false USE_SYSTEm_XML=false OS_FAMILY=solaris
gmake build ${env}

# install in a temporary directory
gmake install DESTDIR=$(pwd)/tmp-build RUDDER_VERSION_TO_PACKAGE=6.0.3 USE_SYSTEM_OPENSSL=false USE_SYSTEM_ZLIB=false USE_SYSTEM_LMDB=false USE_SYSTEM_PCRE=false USE_SYSTEM_PERL=false USE_SYSTEM_FUSION=false USE_SYSTEM_CURL=false USE_SYSTEM_YAML=false USE_SYSTEM_XML=false OS_FAMILY=solaris
gmake install ${env} DESTDIR="${BASE}/${BUILD_DIR}"

# 3- generate package (doc, https://docs.oracle.com/cd/E26502_01/html/E21383/pkgcreate.html)

cd "${BASE}"

# file list
pkgsend generate "${BUILD_DIR}" | pkgfmt > rudder-agent.p5m.1

# metadata
pkgmogrify -DARCH=`uname -p` -DVERSION=${VERSION} -DTAG=0 rudder-agent.p5m.1 solaris/rudder-agent.metadata.mog | pkgfmt > rudder-agent.p5m.2

# dependencies
pkgdepend generate -md "${BUILD_DIR}" rudder-agent.p5m.2 | pkgfmt > rudder-agent.p5m.3
pkgdepend resolve -m rudder-agent.p5m.3

# actuators
pkgmogrify rudder-agent.p5m.3.res solaris/rudder-agent.postinst.mog | pkgfmt > rudder-agent.p5m.4.res

# lint
pkglint -c ~/solaris-reference -r http://pkg.oracle.com/solaris/release rudder-agent.p5m.4.res

# generate repo
pkgrepo create rudder-nightly
pkgrepo -s rudder-nightly set publisher/prefix=normation
pkgsend -s rudder-nightly publish -d BUILD rudder-agent.p5m.4.res

# tar for easy transportation
tar czf rudder-nightly.tgz rudder-nightly

# create repo archive for easy transpotration to another solaris
#pkgrecv -s rudder-nightly -a -d rudder-nightly.p5p rudder-agent

# merge solaris + i386 into a single package : https://docs.oracle.com/cd/E26502_01/html/E29030/pkgmerge-1.html#REFMAN1pkgmerge-1
# pkgmerge -s arch=sparc,http://src1.example.com -s arch=i386,http://src2.example.com -d /path/to/target/repository

# post install
/opt/rudder/share/package-scripts/rudder-agent-postinst "true" "solaris" "false" ""
#/opt/rudder/share/package-scripts/rudder-agent-postinst "true" "solaris" "false" "orchestrateur"

21 changes: 21 additions & 0 deletions rudder-agent/solaris/rudder-agent.metadata.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set name=pkg.fmri value=rudder-agent@$(VERSION),5.11-$(TAG)
set name=pkg.summary value="Configuration management and audit tool - agent"
set name=pkg.description value=" Rudder is an open source configuration management and audit solution.\
.\
This package contains the agent that must be installed on all nodes to be\
managed by Rudder. It is based on two main components: CFEngine Community 3 and\
FusionInventory."
set name=variant.arch value=$(ARCH)
set name=info.classification value="org.opensolaris.category.2008:System/Administration and Configuration"
<transform dir path=etc$->drop>
<transform dir path=etc/bash_completion.d$->drop>
<transform dir path=etc/cron.d$->drop>
<transform dir path=etc/default$->drop>
<transform dir path=etc/init.d$->drop>
<transform dir path=etc/profile.d$->drop>
<transform dir path=opt$->drop>
<transform dir path=var$->drop>
<transform dir path=var/log$->drop>
<transform dir path=usr$->drop>
<transform dir path=usr/bin$->drop>
<transform file path=opt/rudder/bin/vzps.py$->drop>
Empty file.

0 comments on commit 65c7fbf

Please sign in to comment.