Browse Source

netdata/installer: Make netdata installer more flexible, to accommodate install with ssl on MacOS (#6922)

* netdata/packaging: allow passing of LDFLAGS, together with CFLAGS

* netdata/packaging: add instructions for mac

* Update packaging/installer/README.md

Co-Authored-By: Joel Hans <joel.g.hans@gmail.com>

* Update packaging/installer/README.md

Co-Authored-By: Joel Hans <joel.g.hans@gmail.com>

* Update packaging/installer/README.md

Co-Authored-By: Joel Hans <joel.g.hans@gmail.com>

* netdata/docs: fix doc as per feedback

Co-authored-by: Joel Hans <joel.g.hans@gmail.com>
Paul Emm. Katsoulakis 5 years ago
parent
commit
c7ea250762
3 changed files with 24 additions and 1 deletions
  1. 12 1
      netdata-installer.sh
  2. 11 0
      packaging/installer/README.md
  3. 1 0
      packaging/installer/netdata-updater.sh

+ 12 - 1
netdata-installer.sh

@@ -80,6 +80,7 @@ umask 002
 renice 19 $$ >/dev/null 2>/dev/null
 
 # you can set CFLAGS before running installer
+LDFLAGS="${LDFLAGS}"
 CFLAGS="${CFLAGS--O2}"
 [ "z${CFLAGS}" = "z-O3" ] && CFLAGS="-O2"
 
@@ -88,6 +89,7 @@ CFLAGS="${CFLAGS--O2}"
 printf "\\n# " >>netdata-installer.log
 date >>netdata-installer.log
 printf 'CFLAGS="%s" ' "${CFLAGS}" >>netdata-installer.log
+printf 'LDFLAGS="%s" ' "${LDFLAGS}" >>netdata-installer.log
 printf "%q " "${PROGRAM}" "${@}" >>netdata-installer.log
 printf "\\n" >>netdata-installer.log
 
@@ -187,6 +189,14 @@ If you need to pass different CFLAGS, use something like this:
 
   CFLAGS="<gcc options>" ${PROGRAM} [options]
 
+If you also need to provide different LDFLAGS, use something like this:
+
+  LDFLAGS="<extra ldflag options>" ${PROGRAM} [options]
+
+or use the following if both LDFLAGS and CFLAGS need to be overriden:
+
+  CFLAGS="<gcc options>" LDFLAGS="<extra ld options>" ${PROGRAM} [options]
+
 For the installer to complete successfully, you will need these packages installed:
 
   gcc make autoconf automake pkg-config zlib1g-dev (or zlib-devel) uuid-dev (or libuuid-devel)
@@ -422,7 +432,7 @@ run ./configure \
 	--with-math \
 	--with-user=netdata \
 	${NETDATA_CONFIGURE_OPTIONS} \
-	CFLAGS="${CFLAGS}" || exit 1
+	CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" || exit 1
 
 # remove the build_error hook
 trap - EXIT
@@ -1083,6 +1093,7 @@ cat <<EOF > "${NETDATA_USER_CONFIG_DIR}/.environment"
 # Created by installer
 PATH="${PATH}"
 CFLAGS="${CFLAGS}"
+LDFLAGS="${LDFLAGS}"
 NETDATA_PREFIX="${NETDATA_PREFIX}"
 NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS}"
 NETDATA_ADDED_TO_GROUPS="${NETDATA_ADDED_TO_GROUPS}"

+ 11 - 0
packaging/installer/README.md

@@ -430,6 +430,17 @@ sudo ./netdata-installer.sh --install /usr/local
 
 The installer will also install a startup plist to start Netdata when your Mac boots.
 
+**Note:** Should you wish to install Netdata with TLS support:
+1. Install OpenSSL via brew by executing `brew install openssl`
+2. Run the installer with the extra CFLAGS and LDFLAGS, since your OpenSSL installation is not automatically symlinked to `/usr/local`
+
+```sh
+# install Netdata in /usr/local/netdata
+cd netdata
+CFLAGS="-I$(brew --prefix)/opt/openssl/include" LDFLAGS="${LDFLAGS} -L$(brew --prefix)/opt/openssl/lib" sudo -E ./netdata-installer.sh --install /usr/local
+```
+
+
 ##### Alpine 3.x
 
 Execute these commands to install Netdata in Alpine Linux 3.x:

+ 1 - 0
packaging/installer/netdata-updater.sh

@@ -6,6 +6,7 @@
 # Variables needed by script:
 #  - PATH
 #  - CFLAGS
+#  - LDFLAGS
 #  - NETDATA_CONFIGURE_OPTIONS
 #  - REINSTALL_COMMAND
 #  - NETDATA_TARBALL_URL