Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ If you wish to build puppet-agent or the facter gem yourself:
Puppet, you will need to make a few edits in the component and project
files. The build process depends on the following packages:
- GCC (>=4.8.0)
- Boost (>=1.57)
- CMake (>= 3.2.3)
- yaml-cpp (>= 0.5.0)

Any references to pl-gcc, pl-cmake, pl-boost, pl-yaml-cpp, etc. in the
[configs directory](configs/) will need to be changed to refer to
equivalent installable packages on your target operating system. In many
cases, you can drop the `pl-` prefix and ensure that CXX or CC envrionment
variables are what they should be.
Any references to pl-gcc, pl-cmake, etc. in the [configs
directory](configs/) will need to be changed to refer to equivalent
installable packages on your target operating system. In many cases, you
can drop the `pl-` prefix and ensure that CXX or CC environment variables
are what they should be.
4. Update the `location` and `version` in the [puppet-runtime
component json file](configs/components/puppet-runtime.json) as follows:
- `location` should be a file URL to your local puppet-runtime output
Expand Down
2 changes: 1 addition & 1 deletion configs/components/cpp-hocon.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"url": "git://github.com/puppetlabs/cpp-hocon.git", "ref": "refs/tags/0.1.5"}
{"url": "git://github.com/puppetlabs/cpp-hocon.git", "ref": "c710b8cd407339f7f6f3215028fc51cf50695f06"}
3 changes: 1 addition & 2 deletions configs/components/cpp-hocon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
special_flags = "-DCMAKE_CXX_FLAGS_RELEASE='-O2 -DNDEBUG'"
elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "CYGWIN", settings[:cygwin]

cmake = "C:/ProgramData/chocolatey/bin/cmake.exe -G \"MinGW Makefiles\""
Expand All @@ -45,7 +45,6 @@
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
#{special_flags} \
-DBOOST_STATIC=ON \
."]
end

Expand Down
2 changes: 0 additions & 2 deletions configs/components/cpp-pcp-client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
if platform.is_aix?
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-gcc-5.2.0-11.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-cmake-3.2.3-2.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-yaml-cpp-0.5.1-1.aix#{platform.os_version}.ppc.rpm"
# This should be moved to the toolchain file
platform_flags = '-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-bbigtoc"'
elsif platform.is_macos?
Expand Down Expand Up @@ -55,7 +54,6 @@
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
-DCMAKE_SYSTEM_PREFIX_PATH=#{settings[:prefix]} \
-DBOOST_STATIC=ON \
."
]
end
Expand Down
15 changes: 5 additions & 10 deletions configs/components/facter-precompiled-gem.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
component "facter-precompiled-gem" do |pkg, settings, platform|
pkg.build_requires 'puppet-runtime' # provides boost and yaml-cpp
pkg.build_requires 'facter-source-gem'

pkg.add_source("file://resources/files/facter-gem/facter-precompiled.gemspec.erb")

if platform.is_osx?
pkg.build_requires "cmake"
pkg.build_requires "boost"
pkg.build_requires "yaml-cpp"
elsif platform.is_windows?
pkg.build_requires "cmake"
pkg.build_requires "pl-toolchain-#{platform.architecture}"
pkg.build_requires "pl-boost-#{platform.architecture}"
pkg.build_requires "pl-yaml-cpp-#{platform.architecture}"
else
pkg.build_requires "pl-gcc"
pkg.build_requires "pl-cmake"
pkg.build_requires "pl-boost"
pkg.build_requires "pl-yaml-cpp"
end

pkg.add_source("file://resources/files/facter-gem/make.bat")
Expand All @@ -26,17 +21,17 @@
make = 'make'
rm = 'rm'
pkg.environment "PATH" => "/usr/local/bin:#{settings[:build_tools_dir]}:#{settings[:ruby_dir]}:$$PATH"
pkg.environment('FACTER_CMAKE_OPTS', "-DBOOST_STATIC=ON -DYAMLCPP_STATIC=ON -DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DWITHOUT_JRUBY=ON")
pkg.environment('FACTER_CMAKE_OPTS', "-DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DWITHOUT_JRUBY=ON")
elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
rm = '/bin/rm'
pkg.environment "PATH" => "/cygdrive/c/ProgramData/chocolatey/bin:$$(cygpath -u #{settings[:gcc_bindir]}):$$(cygpath -u #{settings[:build_tools_dir]}):$$(cygpath -u #{settings[:ruby_dir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment('FACTER_CMAKE_OPTS', '-G \"MinGW Makefiles\" -DBOOST_STATIC=ON -DYAMLCPP_STATIC=ON -DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DCMAKE_TOOLCHAIN_FILE=C:\tools\pl-build-tools\pl-build-toolchain.cmake -DWITHOUT_JRUBY=ON')
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):/cygdrive/c/ProgramData/chocolatey/bin:$(cygpath -u #{settings[:gcc_bindir]}):$(cygpath -u #{settings[:build_tools_dir]}):$(cygpath -u #{settings[:ruby_dir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment('FACTER_CMAKE_OPTS', '-G \"MinGW Makefiles\" -DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DCMAKE_TOOLCHAIN_FILE=C:\tools\pl-build-tools\pl-build-toolchain.cmake -DWITHOUT_JRUBY=ON')
else
make = 'make'
rm = 'rm'
pkg.environment "PATH" => "#{settings[:build_tools_dir]}:#{settings[:ruby_dir]}:$$PATH"
pkg.environment('FACTER_CMAKE_OPTS', "-DBOOST_STATIC=ON -DYAMLCPP_STATIC=ON -DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DWITHOUT_JRUBY=ON")
pkg.environment('FACTER_CMAKE_OPTS', "-DLEATHERMAN_USE_CURL=FALSE -DWITHOUT_CURL=TRUE -DWITHOUT_OPENSSL=TRUE -DWITHOUT_BLKID=TRUE -DFACTER_SKIP_TESTS=TRUE -DWITHOUT_JRUBY=ON")
end

if platform.is_windows?
Expand Down
31 changes: 11 additions & 20 deletions configs/components/facter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pkg.build_requires 'openssl-devel'
end

pkg.build_requires 'puppet-runtime' # Provides openssl, ruby, augeas, curl
pkg.build_requires 'puppet-runtime' # Provides augeas, boost, curl, openssl, ruby, yaml-cpp
pkg.build_requires 'leatherman'
pkg.build_requires 'runtime'
pkg.build_requires 'cpp-hocon'
Expand All @@ -30,27 +30,11 @@
end

if platform.is_windows?
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
else
pkg.environment "PATH", "#{settings[:bindir]}:$(PATH)"
end

if platform.is_macos?
pkg.build_requires "yaml-cpp"
elsif platform.name =~ /solaris-10/
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/solaris/10/pl-yaml-cpp-0.5.1.#{platform.architecture}.pkg.gz"
elsif platform.is_cross_compiled_linux? || platform.name =~ /solaris-11/
pkg.build_requires "pl-yaml-cpp-#{platform.architecture}"
elsif platform.is_aix?
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-gcc-5.2.0-11.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-cmake-3.2.3-2.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-yaml-cpp-0.5.1-1.aix#{platform.os_version}.ppc.rpm"
elsif platform.is_windows?
pkg.build_requires "pl-yaml-cpp-#{platform.architecture}"
else
pkg.build_requires "pl-yaml-cpp"
end

# Explicitly skip jruby if not installing a jdk.
skip_jruby = 'OFF'
java_home = ''
Expand Down Expand Up @@ -172,8 +156,6 @@
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
#{special_flags} \
-DBOOST_STATIC=ON \
-DYAMLCPP_STATIC=ON \
-DWITHOUT_CURL=#{skip_curl} \
-DWITHOUT_BLKID=#{skip_blkid} \
-DWITHOUT_JRUBY=#{skip_jruby} \
Expand Down Expand Up @@ -237,6 +219,15 @@
pkg.install_file "#{settings[:prefix]}/bin/#{dll}", "#{settings[:facter_root]}/bin/#{dll}"
end

# Also copy the boost dlls that facter requires into the ruby and facter
# bindirs, so that dynamically linked executables can find them
settings[:boost_libs].each do |name|
pkg.install_file "#{settings[:prefix]}/lib/libboost_#{name}.dll", "#{settings[:facter_root]}/bin/libboost_#{name}.dll"
pkg.install_file "#{settings[:prefix]}/lib/libboost_#{name}.dll.a", "#{settings[:facter_root]}/bin/libboost_#{name}.dll.a"
pkg.install_file "#{settings[:prefix]}/lib/libboost_#{name}.dll", "#{settings[:ruby_bindir]}/libboost_#{name}.dll"
pkg.install_file "#{settings[:prefix]}/lib/libboost_#{name}.dll.a", "#{settings[:ruby_bindir]}/libboost_#{name}.dll.a"
end

# Copy these into both facter and ruby's bindirs
[
"leatherman_curl.dll",
Expand Down
11 changes: 2 additions & 9 deletions configs/components/leatherman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,25 @@

if platform.is_macos?
pkg.build_requires "cmake"
pkg.build_requires "boost"
pkg.build_requires "gettext"
elsif platform.name =~ /solaris-10/
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/solaris/10/pl-boost-1.58.0-7.#{platform.architecture}.pkg.gz"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/solaris/10/pl-cmake-3.2.3-2.i386.pkg.gz"
elsif platform.is_cross_compiled_linux? || platform.name =~ /solaris-11/
pkg.build_requires "pl-boost-#{platform.architecture}"
pkg.build_requires "pl-cmake"
elsif platform.is_aix?
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-gcc-5.2.0-11.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-cmake-3.2.3-2.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-boost-1.58.0-7.aix#{platform.os_version}.ppc.rpm"
pkg.build_requires "http://pl-build-tools.delivery.puppetlabs.net/aix/#{platform.os_version}/ppc/pl-gettext-0.19.8-2.aix#{platform.os_version}.ppc.rpm"
elsif platform.is_windows?
pkg.build_requires "cmake"
pkg.build_requires "pl-toolchain-#{platform.architecture}"
pkg.build_requires "pl-boost-#{platform.architecture}"
pkg.build_requires "pl-gettext-#{platform.architecture}"
else
pkg.build_requires "pl-cmake"
pkg.build_requires "pl-boost"
pkg.build_requires "pl-gettext"
end

pkg.build_requires "puppet-runtime" # Provides curl and ruby
pkg.build_requires "puppet-runtime" # Provides boost, curl, ruby
pkg.build_requires "runtime"

ruby = "#{settings[:host_ruby]} -rrbconfig"
Expand Down Expand Up @@ -58,7 +52,7 @@
special_flags = "-DCMAKE_CXX_FLAGS_RELEASE='-O2 -DNDEBUG'"
elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "CYGWIN", settings[:cygwin]

cmake = "C:/ProgramData/chocolatey/bin/cmake.exe -G \"MinGW Makefiles\""
Expand Down Expand Up @@ -91,7 +85,6 @@
#{leatherman_locale_var} \
-DLEATHERMAN_SHARED=TRUE \
#{special_flags} \
-DBOOST_STATIC=ON \
."]
end

Expand Down
4 changes: 2 additions & 2 deletions configs/components/libwhereami.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
special_flags = "-DCMAKE_CXX_FLAGS_RELEASE='-O2 -DNDEBUG'"
elsif platform.is_windows?
make = "#{settings[:gcc_bindir]}/mingw32-make"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "CYGWIN", settings[:cygwin]

cmake = "C:/ProgramData/chocolatey/bin/cmake.exe -G \"MinGW Makefiles\""
Expand All @@ -44,8 +44,8 @@
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
#{special_flags} \
-DBOOST_STATIC=ON \
."]
end

Expand Down
28 changes: 26 additions & 2 deletions configs/components/pxp-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
cmake = "/opt/pl-build-tools/bin/cmake"

if platform.is_windows?
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
pkg.environment "PATH", "$(shell cygpath -u #{settings[:prefix]}/lib):$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0"
else
pkg.environment "PATH", "#{settings[:bindir]}:/opt/pl-build-tools/bin:$(PATH)"
end
Expand Down Expand Up @@ -62,7 +62,6 @@
-DCMAKE_SYSTEM_PREFIX_PATH=#{settings[:prefix]} \
-DMODULES_INSTALL_PATH=#{File.join(settings[:install_root], 'pxp-agent', 'modules')} \
#{special_flags} \
-DBOOST_STATIC=ON \
."
]
end
Expand Down Expand Up @@ -154,4 +153,29 @@
else
fail "need to know where to put #{pkg.get_name} service files"
end

# Unless the settings specify that this is a development build, we remove
# unneeded header files so that they don't make it into the final package
# (boost headers, for example, increase the size of the package to an
# unacceptable degree).
#
# We're doing this in the pxp-agent component because pxp-agent is the last
# component to build that requires these headers.
unless settings[:dev_build]
# Note that ruby is _not_ included in this list because its headers are
# required to build native extensions for gems.
unwanted_headers = ["augeas.h", "boost", "cpp-pcp-client", "curl", "fa.h",
"facter", "hocon", "leatherman", "libexslt", "libxml2",
"libxslt", "openssl", "whereami", "yaml-cpp"]

# We need a full path on windows because /usr/bin is not in the PATH at this point
rm = platform.is_windows? ? '/usr/bin/rm' : 'rm'

pkg.install do
[
unwanted_headers.map { |h| "#{rm} -rf #{settings[:includedir]}/#{h}" },
"#{rm} -rf #{settings[:prefix]}/ssl/man", # Also remove unwanted OpenSSL manpages
]
end
end
end
2 changes: 1 addition & 1 deletion configs/components/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# update curl to statically link against zlib
pkg.install_file "#{settings[:tools_root]}/bin/zlib1.dll", "#{settings[:ruby_bindir]}/zlib1.dll"

# gdbm, yaml-cpp and iconv are all runtime dependancies of ruby, and their libraries need
# gdbm and iconv are runtime dependancies of ruby, and their libraries need
# To exist inside our vendored ruby
pkg.install_file "#{settings[:tools_root]}/bin/libgdbm-4.dll", "#{settings[:ruby_bindir]}/libgdbm-4.dll"
pkg.install_file "#{settings[:tools_root]}/bin/libgdbm_compat-4.dll", "#{settings[:ruby_bindir]}/libgdbm_compat-4.dll"
Expand Down