Project

General

Profile

« Previous | Next » 

Revision 9a1159d1

Added by Benoît PECCATTE about 6 years ago

Fixes #12186: Embed curl in the agent

View differences:

rudder-agent/SOURCES/Makefile
CPANMINUS_SHA1 = a12043498ab54d9abdc58d1ebb4988da3bd515db
#CPAN_URL = https://www.cpan.org
CPAN_URL = $(HTTPS)://www.normation.com/tarball/cpan/$(RUDDER_MAJOR_VERSION)
CURL_VERSION = 7.58.0
CURL_SHA1 = 089f17884d672aca7a661a65d847135f2f0ccbbf
# Defauth PATHs
RUDDER_DIR = /opt/rudder
......
ifneq (true,$(USE_SYSTEM_FUSION))
INSTALL_DEPS := $(INSTALL_DEPS) install-fusion
endif
# default: embed curl
ifneq (true,$(USE_SYSTEM_CURL))
BUILD_DEPS := $(BUILD_DEPS) build-curl
INSTALL_DEPS := $(INSTALL_DEPS) install-curl
CURL_ARG := --with-libcurl=$(CURDIR)/build-curl/opt/rudder
endif
# Hack needed because openssl is not guessing correctly the architecture on solaris 32bits
ifeq (i386-pc-solaris2.10,$(shell ./config.guess))
......
# download dependencies
depend: localdepends
localdepends: initial-promises initial-ncf rudder-agent-utilities perl-$(PERL_VERSION) fusioninventory-agent cfengine-source openssl-source lmdb-source pcre-source rudder-agent.cron ./rudder.8.gz
localdepends: initial-promises initial-ncf rudder-agent-utilities perl-$(PERL_VERSION) fusioninventory-agent cfengine-source openssl-source lmdb-source pcre-source curl-source rudder-agent.cron ./rudder.8.gz
# build binaries
build: build-cfengine
......
clean: localclean
localclean:
rm -rf $(DESTDIR)
rm -rf build-ssl build-lmdb build-cfengine build-perl fusion-modules build-cfengine-stamp
rm -rf build-ssl build-lmdb build-cfengine build-perl fusion-modules build-cfengine-stamp build-curl
rm -rf rudder-sources
rm -f ./rudder.8.gz
[ -d cfengine-source ] && cd cfengine-source && $(MAKE) clean 2>/dev/null || true
......
rm -rf $(TMP_DIR)
endif
curl-source:
ifeq ($(shell ../../build-caching get ./curl-source/ --force-config name=curl-src version=$(CURL_RELEASE) >/dev/null 2>&1 || echo KO), KO)
$(eval TMP_DIR := $(shell mktemp -dq /tmp/rudder.XXXXXX))
# Original URL: https://curl.haxx.se/download/curl-7.58.0.tar.gz
$(GET) $(TMP_DIR)/curl.tgz $(HTTPS)://www.normation.com/tarball/curl/curl-$(CURL_RELEASE).tar.gz $(CURL_SHA1)
gunzip < $(TMP_DIR)/curl.tgz | $(TAR) xf -
mv ./curl-$(CURL_RELEASE) ./curl-source
../../build-caching put ./curl-source/ --force-config name=curl-src version=$(CURL_RELEASE)
rm -rf $(TMP_DIR)
endif
rudder-sources.tar.bz2:
$(GET) rudder-sources.tar.bz2 $(HTTPS)://www.rudder-project.org/archives/rudder-sources-$(RUDDER_VERSION_TO_PACKAGE).tar.bz2 ""
......
# install to a temporary location is needed to build cfengine
cd pcre-source && $(MAKE) install DESTDIR=$(CURDIR)/build-pcre
build-curl: curl-source
cd curl-source && ./configure --prefix=$(RUDDER_DIR) $(OPENSSL_ARG)
cd curl-source && $(MAKE)
# install to a temporary location is needed to build cfengine
cd curl-source && $(MAKE) install DESTDIR=$(CURDIR)/build-curl
build-cfengine: get-flags $(BUILD_DEPS) cfengine-source build-cfengine-stamp
build-cfengine-stamp:
# If there is no configure, bootstrap with autogen.sh first
cd cfengine-source && [ -x ./configure ] || NO_CONFIGURE=1 ./autogen.sh
# remove temporary rpath added by configure to build options
cd cfengine-source && $(SED) 's/[A-Z]*_LDFLAGS="$[A-Z]*_LDFLAGS -R$with_[a-z]*\/lib"/true/' configure > configure.new && mv configure.new configure && chmod +x configure
cd cfengine-source && ./configure --prefix=$(RUDDER_DIR) --with-workdir=/var/rudder/cfengine-community --enable-static=yes --enable-shared=no --without-postgresql $(LMDB_ARG) $(OPENSSL_ARG) $(PCRE_ARG) CFLAGS="$(BUILD_CFLAGS) $(SECURE_CFLAGS)" LDFLAGS="-Wl,-R/opt/rudder/lib $(BUILD_LDFLAGS) $(SECURE_LDFLAGS)"
cd cfengine-source && ./configure --prefix=$(RUDDER_DIR) --with-workdir=/var/rudder/cfengine-community --enable-static=yes --enable-shared=no --without-postgresql $(LMDB_ARG) $(OPENSSL_ARG) $(PCRE_ARG) $(CURL_ARG) CFLAGS="$(BUILD_CFLAGS) $(SECURE_CFLAGS)" LDFLAGS="-Wl,-R/opt/rudder/lib $(BUILD_LDFLAGS) $(SECURE_LDFLAGS)"
cd cfengine-source && $(MAKE)
touch $@
......
mkdir -p $(DESTDIR)
$(CP_A) $(CURDIR)/build-pcre/* $(DESTDIR)
install-curl: build-curl
mkdir -p $(DESTDIR)
$(CP_A) $(CURDIR)/build-curl/* $(DESTDIR)
install-cfengine: build-cfengine $(INSTALL_DEPS)
cd cfengine-source && $(MAKE) install DESTDIR=$(DESTDIR) STRIP=""
mkdir -p $(INSTALL_DIR)/share/man/man8
rudder-agent/SPECS/rudder-agent.spec
# Same goes for the use of the local PCRE install vs. a bundled one
%define use_system_pcre true
# Same goes for the use of the local Curl install vs. a bundled one
%define use_system_curl true
# Default to using systemd for service management
%define use_systemd true
......
export CFLAGS="${RPM_OPT_FLAGS}"
export CXXFLAGS="${RPM_OPT_FLAGS}"
make %{?_smp_mflags} USE_SYSTEM_OPENSSL=%{use_system_openssl} USE_SYSTEM_LMDB=%{use_system_lmdb} USE_SYSTEM_PCRE=%{use_system_pcre} USE_SYSTEM_FUSION=%{use_system_fusion} USE_SYSTEM_PERL=%{use_system_perl} USE_HTTPS=%{use_https}
make %{?_smp_mflags} USE_SYSTEM_OPENSSL=%{use_system_openssl} USE_SYSTEM_LMDB=%{use_system_lmdb} USE_SYSTEM_PCRE=%{use_system_pcre} USE_SYSTEM_FUSION=%{use_system_fusion} USE_SYSTEM_PERL=%{use_system_perl} USE_HTTPS=%{use_https} USE_SYSTEM_CURL=%{use_system_curl}
# there was a slibclean here on aix
# TODO, check that it is not necessary anymore since we no more do a make install
......
%define no_ldso true
%endif
make install DESTDIR=%{buildroot} USE_SYSTEM_OPENSSL=%{use_system_openssl} USE_SYSTEM_LMDB=%{use_system_lmdb} USE_SYSTEM_PCRE=%{use_system_pcre} USE_SYSTEMD=%{use_systemd} NO_INIT=%{no_init} NO_CRON=%{no_cron} NO_LD=%{no_ld} NO_PROFILE=%{no_profile} USE_SYSTEM_FUSION=%{use_system_fusion} USE_SYSTEM_PERL=%{use_system_perl} NO_LDSO=%{no_ldso} USE_HTTPS=%{use_https}
make install DESTDIR=%{buildroot} USE_SYSTEM_OPENSSL=%{use_system_openssl} USE_SYSTEM_LMDB=%{use_system_lmdb} USE_SYSTEM_PCRE=%{use_system_pcre} USE_SYSTEM_CURL=%{use_system_curl} USE_SYSTEMD=%{use_systemd} NO_INIT=%{no_init} NO_CRON=%{no_cron} NO_LD=%{no_ld} NO_PROFILE=%{no_profile} USE_SYSTEM_FUSION=%{use_system_fusion} USE_SYSTEM_PERL=%{use_system_perl} NO_LDSO=%{no_ldso} USE_HTTPS=%{use_https}
# Build a list of files to include in this package for use in the %files section below
find %{buildroot} -type f -o -type l | sed "s,%{buildroot},," | sed "s,\.py$,\.py*," | grep -v "%{rudderdir}/etc/uuid.hive" | grep -v "/etc/bash_completion.d" | grep -v "%{ruddervardir}/cfengine-community/ppkeys" > %{_builddir}/file.list.%{name}
rudder-agent/debian/rules
USE_SYSTEM_LMDB=false
USE_SYSTEM_PCRE=true
USE_SYSTEM_PERL=true
USE_SYSTEM_CURL=true
USE_SYSTEMD=true
ifeq (rudder-agent,$(REAL_NAME))
......
USE_SYSTEMD=false
endif
MAKE_OPTIONS=USE_SYSTEM_OPENSSL=$(USE_SYSTEM_OPENSSL) USE_SYSTEM_LMDB=$(USE_SYSTEM_LMDB) USE_SYSTEM_PCRE=$(USE_SYSTEM_PCRE) USE_SYSTEM_FUSION=$(USE_SYSTEM_FUSION) USE_SYSTEM_PERL=$(USE_SYSTEM_PERL) USE_SYSTEMD=$(USE_SYSTEMD)
MAKE_OPTIONS=USE_SYSTEM_OPENSSL=$(USE_SYSTEM_OPENSSL) USE_SYSTEM_LMDB=$(USE_SYSTEM_LMDB) USE_SYSTEM_PCRE=$(USE_SYSTEM_PCRE) USE_SYSTEM_FUSION=$(USE_SYSTEM_FUSION) USE_SYSTEM_PERL=$(USE_SYSTEM_PERL) USE_SYSTEMD=$(USE_SYSTEMD) USE_SYSTEM_CURL=$(USE_SYSTEM_CURL)
configure:

Also available in: Unified diff