From 185c09e4c2e027fc1c8d17bdd7521a8270db1b90 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 16 May 2017 15:05:49 -0700 Subject: [PATCH] Add CFLAGS and instruct nokogiri to use installer libraries. --- substrate/launcher/main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/substrate/launcher/main.go b/substrate/launcher/main.go index b6d70672..bab1c28b 100644 --- a/substrate/launcher/main.go +++ b/substrate/launcher/main.go @@ -94,7 +94,8 @@ func main() { // Setup the CPP/LDFLAGS so that native extensions can be // properly compiled into the Vagrant environment. - cppflags := "-I" + filepath.Join(embeddedDir, "include") + cppflags := "-I" + filepath.Join(embeddedDir, "include") + + filepath.Join(embeddedDir, "include", "libxml2") ldflags := "-L" + filepath.Join(embeddedDir, "lib") if original := os.Getenv("CPPFLAGS"); original != "" { cppflags = original + " " + cppflags @@ -102,6 +103,11 @@ func main() { if original := os.Getenv("LDFLAGS"); original != "" { ldflags = original + " " + ldflags } + cflags := "-I" + filepath.Join(embeddedDir, "include") + + filepath.Join(embeddedDir, "include", "libxml2") + if original := os.Getenv("CFLAGS"); original != "" { + cflags = original + " " + cflags + } // Set the PATH to include the proper paths into our embedded dir path = os.Getenv("PATH") @@ -126,6 +132,7 @@ func main() { // Setup the environment to prefer our embedded dir over // anything the user might have setup on his/her system. "CPPFLAGS": cppflags, + "CFLAGS": cflags, "GEM_HOME": filepath.Join(embeddedDir, "gems"), "GEM_PATH": filepath.Join(embeddedDir, "gems"), "GEMRC": filepath.Join(embeddedDir, "etc", "gemrc"), @@ -133,6 +140,10 @@ func main() { "PATH": path, "SSL_CERT_FILE": sslCertFile, + // Instruct nokogiri installations to use libraries provided + // by the installer + "NOKOGIRI_USE_SYSTEM_LIBRARIES": "true", + // Environmental variables used by Vagrant itself "VAGRANT_EXECUTABLE": vagrantExecutable, "VAGRANT_INSTALLER_ENV": "1",