Skip to content

Commit

Permalink
(PA-1896) Enable builds for Raspian/Debian 9 on armhf
Browse files Browse the repository at this point in the history
This commit enables builds for Debian 9 armhf, which is the target for
running raspian 9 (raspberry PI Debian). This build also has the
advantage of not requiring anything from pl-build-tools as this compiles
all natively using the xcc toolchain provided by Debian.

Since this uses system yaml-cpp and boost, it does add runtime
requirements on those libraries (as well as libicu).
  • Loading branch information
stahnma committed Mar 9, 2018
1 parent d294aa8 commit 02faa1a
Show file tree
Hide file tree
Showing 18 changed files with 311 additions and 51 deletions.
8 changes: 8 additions & 0 deletions configs/components/augeas.rb
Expand Up @@ -6,6 +6,14 @@

pkg.replaces 'pe-augeas'
pkg.build_requires "libxml2"

if platform.name =~ /debian-9-armhf/
pkg.build_requires "libreadline-dev:#{platform.architecture}"
pkg.build_requires "pkg-config"
pkg.environment "CFLAGS", settings[:cflags]
pkg.environment "LDFLAGS", settings[:ldflags]
end

if platform.name =~ /^el-(5|6|7)-.*/ || platform.is_fedora?
# Augeas needs a libselinux pkgconfig file on these platforms
pkg.build_requires 'ruby-selinux'
Expand Down
21 changes: 18 additions & 3 deletions configs/components/cpp-hocon.rb
Expand Up @@ -12,8 +12,14 @@
cmake = "/usr/local/bin/cmake"
special_flags = "-DCMAKE_CXX_FLAGS='#{settings[:cflags]}'"
elsif platform.is_cross_compiled_linux?
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
# Debian 9 (armhf currently) is not using pl-build-tools
if platform.name =~ /debian-9-armhf/
toolchain = "-DCMAKE_TOOLCHAIN_FILE=#{settings[:datadir]}/doc/debian-#{platform.architecture}-toolchain"
cmake = "/usr/bin/cmake"
else
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
end
elsif platform.is_solaris?
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/i386-pc-solaris2.#{platform.os_version}/bin/cmake"
Expand All @@ -36,16 +42,25 @@
end
end

if platform.name =~ /debian-9-armhf/
boost_args = "-DBOOST_LIBRARYDIR=/usr/lib/#{settings[:platform_triple]}/lib"
boost_static = "OFF"
else
boost_args = ""
boost_static = "ON"
end

# Until we build our own gettext packages, disable using locales.
# gettext 0.17 is required to compile .mo files with msgctxt.
pkg.configure do
["#{cmake} \
#{toolchain} \
#{boost_args} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
#{special_flags} \
-DBOOST_STATIC=ON \
-DBOOST_STATIC=#{boost_static} \
."]
end

Expand Down
15 changes: 14 additions & 1 deletion configs/components/cpp-pcp-client.rb
Expand Up @@ -32,6 +32,10 @@
elsif platform.is_cross_compiled_linux?
cmake = "/opt/pl-build-tools/bin/cmake"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
if platform.name =~ /debian-9-armhf/
cmake = "/usr/bin/cmake"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=#{settings[:datadir]}/doc/debian-#{platform.architecture}-toolchain"
end
elsif platform.is_solaris?
cmake = "/opt/pl-build-tools/i386-pc-solaris2.#{platform.os_version}/bin/cmake"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
Expand All @@ -45,18 +49,27 @@
platform_flags = "-DLEATHERMAN_USE_LOCALES=OFF"
end

if platform.name =~ /debian-9-armhf/
boost_args = "-DBOOST_LIBRARYDIR=/usr/lib/#{settings[:platform_triple]}/lib"
boost_static = "OFF"
else
boost_args = ""
boost_static = "ON"
end

pkg.configure do
[
"#{cmake} \
#{toolchain} \
#{boost_args} \
#{platform_flags} \
-DLEATHERMAN_GETTEXT=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
-DCMAKE_SYSTEM_PREFIX_PATH=#{settings[:prefix]} \
-DBOOST_STATIC=ON \
-DBOOST_STATIC=#{boost_static} \
."
]
end
Expand Down
2 changes: 1 addition & 1 deletion configs/components/curl.rb
Expand Up @@ -18,7 +18,7 @@
pkg.build_requires "puppet-ca-bundle"

if platform.is_cross_compiled_linux?
pkg.build_requires 'runtime'
pkg.build_requires 'runtime' unless platform.name =~ /debian-9-armhf/
pkg.environment "PATH" => "/opt/pl-build-tools/bin:$$PATH:#{settings[:bindir]}"
pkg.environment "PKG_CONFIG_PATH" => "/opt/puppetlabs/puppet/lib/pkgconfig"
pkg.environment "PATH" => "/opt/pl-build-tools/bin:$$PATH"
Expand Down
5 changes: 3 additions & 2 deletions configs/components/dmidecode.rb
@@ -1,5 +1,5 @@
component 'dmidecode' do |pkg, settings, platform|
if platform.name == 'el-7-aarch64'
if platform.name == 'el-7-aarch64' || platform.name =~ /debian-9-armhf/
pkg.version '3.1'
pkg.md5sum '7798f68a02b82358c44af913da3b6b42'
else
Expand All @@ -21,12 +21,13 @@

pkg.environment "LDFLAGS", settings[:ldflags]
pkg.environment "CFLAGS", settings[:cflags]
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)"

if platform.is_cross_compiled?
# The Makefile doesn't honor environment overrides, so we need to
# edit it directly for cross-compiling
pkg.configure do
["sed -i \"s|gcc|/opt/pl-build-tools/bin/#{settings[:platform_triple]}-gcc|g\" Makefile"]
["sed -i \"s|gcc|#{settings[:platform_triple]}-gcc|g\" Makefile"]
end
end

Expand Down
36 changes: 32 additions & 4 deletions configs/components/facter.rb
Expand Up @@ -22,7 +22,7 @@
end

pkg.build_requires 'leatherman'
pkg.build_requires 'runtime'
pkg.build_requires 'runtime' unless platform.name =~ /debian-9-armhf/
pkg.build_requires 'cpp-hocon'
pkg.build_requires 'libwhereami'

Expand All @@ -45,13 +45,26 @@
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}"
if platform.name =~ /debian-9-armhf/
pkg.build_requires "libyaml-cpp-dev:#{platform.architecture}"
pkg.requires "libyaml-cpp0.5v5"
pkg.requires "libboost-date-time1.62.0"
pkg.requires "libboost-thread1.62.0"
pkg.requires "libboost-chrono1.62.0"
pkg.requires "libboost-atomic1.62.0"
pkg.requires "libboost-log1.62.0"
pkg.requires "libboost-locale1.62.0"
else
pkg.build_requires "pl-yaml-cpp-#{platform.architecture}"
end
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}"
elsif platform.name =~ /debian-9-armhf/
pkg.build_requires "cmake"
else
pkg.build_requires "pl-yaml-cpp"
end
Expand Down Expand Up @@ -132,6 +145,10 @@
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig.rb"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
if platform.name =~ /debian-9-armhf/
cmake = "/usr/bin/cmake"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=#{settings[:datadir]}/doc/debian-#{platform.architecture}-toolchain"
end
elsif platform.is_solaris?
if platform.architecture == 'sparc'
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig.rb"
Expand Down Expand Up @@ -169,17 +186,28 @@
-DRUBY_LIB_INSTALL=#{settings[:ruby_vendordir]}"
end

if platform.name =~ /debian-9-armhf/
boost_args = "-DBOOST_LIBRARYDIR=/usr/lib/#{settings[:platform_triple]}/lib"
boost_static = "OFF"
yamlcpp_static = "OFF"
else
boost_args = ""
boost_static = "ON"
yamlcpp_static = "ON"
end

# FACTER_RUBY Needs bindir
pkg.configure do
["#{cmake} \
#{toolchain} \
#{boost_args} \
-DLEATHERMAN_GETTEXT=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
#{special_flags} \
-DBOOST_STATIC=ON \
-DYAMLCPP_STATIC=ON \
-DBOOST_STATIC=#{boost_static} \
-DYAMLCPP_STATIC=#{yamlcpp_static} \
-DWITHOUT_CURL=#{skip_curl} \
-DWITHOUT_BLKID=#{skip_blkid} \
-DWITHOUT_JRUBY=#{skip_jruby} \
Expand Down
50 changes: 46 additions & 4 deletions configs/components/leatherman.rb
Expand Up @@ -7,6 +7,32 @@
pkg.build_requires "cmake"
pkg.build_requires "boost"
pkg.build_requires "gettext"
elsif platform.name =~ /debian-9-armhf/
pkg.build_requires "toolchain"
pkg.build_requires "libboost-dev:#{platform.architecture}"
pkg.build_requires "libboost-regex-dev:#{platform.architecture}"
pkg.build_requires "libboost-atomic-dev:#{platform.architecture}"
pkg.build_requires "libboost-chrono-dev:#{platform.architecture}"
pkg.build_requires "libboost-date-time-dev:#{platform.architecture}"
pkg.build_requires "libboost-exception-dev:#{platform.architecture}"
pkg.build_requires "libboost-filesystem-dev:#{platform.architecture}"
pkg.build_requires "libboost-graph-dev:#{platform.architecture}"
pkg.build_requires "libboost-graph-parallel-dev:#{platform.architecture}"
pkg.build_requires "libboost-iostreams-dev:#{platform.architecture}"
pkg.build_requires "libboost-locale-dev:#{platform.architecture}"
pkg.build_requires "libboost-log-dev:#{platform.architecture}"
pkg.build_requires "libboost-math-dev:#{platform.architecture}"
pkg.build_requires "libboost-program-options-dev:#{platform.architecture}"
pkg.build_requires "libboost-random-dev:#{platform.architecture}"
pkg.build_requires "libboost-serialization-dev:#{platform.architecture}"
pkg.build_requires "libboost-signals-dev:#{platform.architecture}"
pkg.build_requires "libboost-test-dev:#{platform.architecture}"
pkg.build_requires "libboost-system-dev:#{platform.architecture}"
pkg.build_requires "libboost-thread-dev:#{platform.architecture}"
pkg.build_requires "libboost-timer-dev:#{platform.architecture}"
pkg.build_requires "libboost-wave-dev:#{platform.architecture}"
pkg.build_requires "cmake"
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"
Expand Down Expand Up @@ -34,7 +60,7 @@
end

pkg.build_requires "curl"
pkg.build_requires "runtime"
pkg.build_requires "runtime" unless platform.name =~ /debian-9-armhf/
pkg.build_requires "ruby-#{settings[:ruby_version]}"

ruby = "#{settings[:host_ruby]} -rrbconfig"
Expand All @@ -49,8 +75,13 @@
special_flags = "-DCMAKE_CXX_FLAGS='#{settings[:cflags]}' -DLEATHERMAN_MOCK_CURL=FALSE"
elsif platform.is_cross_compiled_linux?
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig.rb"
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
if platform.name =~ /debian-9-armhf/
toolchain = "-DCMAKE_TOOLCHAIN_FILE=#{settings[:datadir]}/doc/debian-#{platform.architecture}-toolchain"
cmake = "/usr/bin/cmake"
else
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
end
elsif platform.is_solaris?
if platform.architecture == 'sparc'
ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig.rb"
Expand Down Expand Up @@ -85,18 +116,29 @@
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)"
end


if platform.name =~ /debian-9-armhf/
boost_args = "-DBOOST_LIBRARYDIR=/usr/lib/#{settings[:platform_triple]}/lib"
boost_static = "OFF"
else
boost_args = ""
boost_static = "ON"
end

pkg.configure do
["#{cmake} \
#{toolchain} \
#{boost_args} \
-DLEATHERMAN_GETTEXT=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
-DCMAKE_INSTALL_RPATH=#{settings[:libdir]} \
-DLEATHERMAN_USE_ICU=TRUE \
#{leatherman_locale_var} \
-DLEATHERMAN_SHARED=TRUE \
#{special_flags} \
-DBOOST_STATIC=ON \
-DBOOST_STATIC=#{boost_static} \
."]
end

Expand Down
15 changes: 14 additions & 1 deletion configs/components/libwhereami.rb
Expand Up @@ -14,6 +14,10 @@
elsif platform.is_cross_compiled_linux?
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/bin/cmake"
if platform.name =~ /debian-9-armhf/
toolchain = "-DCMAKE_TOOLCHAIN_FILE=#{settings[:datadir]}/doc/debian-#{platform.architecture}-toolchain"
cmake = "/usr/bin/cmake"
end
elsif platform.is_solaris?
toolchain = "-DCMAKE_TOOLCHAIN_FILE=/opt/pl-build-tools/#{settings[:platform_triple]}/pl-build-toolchain.cmake"
cmake = "/opt/pl-build-tools/i386-pc-solaris2.#{platform.os_version}/bin/cmake"
Expand All @@ -36,16 +40,25 @@
end
end

if platform.name =~ /debian-9-armhf/
boost_args = "-DBOOST_LIBRARYDIR=/usr/lib/#{settings[:platform_triple]}/lib"
boost_static = "OFF"
else
boost_args = ""
boost_static = "ON"
end

# Until we build our own gettext packages, disable using locales.
# gettext 0.17 is required to compile .mo files with msgctxt.
pkg.configure do
["#{cmake} \
#{toolchain} \
#{boost_args} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=#{settings[:prefix]} \
-DCMAKE_INSTALL_PREFIX=#{settings[:prefix]} \
#{special_flags} \
-DBOOST_STATIC=ON \
-DBOOST_STATIC=#{boost_static} \
."]
end

Expand Down
4 changes: 2 additions & 2 deletions configs/components/libxml2.rb
Expand Up @@ -28,12 +28,12 @@
pkg.environment "CFLAGS" => settings[:cflags]
end

pkg.build_requires 'runtime'
pkg.build_requires 'runtime' unless platform.name =~ /debian-9-armhf/

# The system pkg-config has been found to pass incorrect build flags on
# some (but not all) cross-compiled debian-based platforms:
if platform.is_cross_compiled? && platform.is_deb?
pkg.build_requires "pl-pkg-config" unless platform.name =~ /ubuntu-16\.04-ppc64el/
pkg.build_requires "pl-pkg-config" unless platform.name =~ /ubuntu-16\.04-ppc64el/ || platform.name =~ /debian-9-armhf/
end

pkg.configure do
Expand Down
2 changes: 1 addition & 1 deletion configs/components/libxslt.rb
Expand Up @@ -38,7 +38,7 @@
end

if platform.is_cross_compiled_linux? || platform.name =~ /solaris-11/
pkg.build_requires "pl-gcc-#{platform.architecture}"
pkg.build_requires "pl-gcc-#{platform.architecture}" unless platform.name =~ /debian-9-armhf/
end

pkg.configure do
Expand Down

0 comments on commit 02faa1a

Please sign in to comment.