|
| 1 | +# This file is a basis for multiple versions/targets of ruby-augeas. |
| 2 | +# It should not be included as a component; Instead other components should |
| 3 | +# load it with instance_eval. See ruby-x.y-augeas.rb configs. |
| 4 | +# |
| 5 | + |
| 6 | +# These can be overridden by the including component. |
| 7 | +ruby_version ||= settings[:ruby_version] |
| 8 | +host_ruby ||= settings[:host_ruby] |
| 9 | +ruby_dir ||= settings[:ruby_dir] |
| 10 | +ruby_bindir ||= settings[:ruby_bindir] |
| 11 | + |
| 12 | +pkg.version "0.5.0" |
| 13 | +pkg.md5sum "a132eace43ce13ccd059e22c0b1188ac" |
| 14 | +pkg.url "http://download.augeas.net/ruby/ruby-augeas-#{pkg.get_version}.tgz" |
| 15 | +pkg.mirror "#{settings[:buildsources_url]}/ruby-augeas-#{pkg.get_version}.tar.gz" |
| 16 | + |
| 17 | +pkg.build_requires "ruby-#{ruby_version}" |
| 18 | +pkg.build_requires "augeas" |
| 19 | + |
| 20 | +pkg.environment "PATH", "$(PATH):/opt/pl-build-tools/bin:/usr/local/bin:/opt/csw/bin:/usr/ccs/bin:/usr/sfw/bin" |
| 21 | +if platform.is_aix? |
| 22 | + pkg.build_requires "http://osmirror.delivery.puppetlabs.net/AIX_MIRROR/pkg-config-0.19-6.aix5.2.ppc.rpm" |
| 23 | + pkg.environment "CC", "/opt/pl-build-tools/bin/gcc" |
| 24 | + pkg.environment "RUBY", host_ruby |
| 25 | + pkg.environment "LDFLAGS", " -brtl #{settings[:ldflags]}" |
| 26 | +end |
| 27 | + |
| 28 | +pkg.environment "CONFIGURE_ARGS", '--vendor' |
| 29 | +pkg.environment "PKG_CONFIG_PATH", "#{File.join(settings[:libdir], 'pkgconfig')}:/usr/lib/pkgconfig" |
| 30 | + |
| 31 | +if platform.is_solaris? |
| 32 | + if platform.architecture == 'sparc' |
| 33 | + pkg.environment "RUBY", host_ruby |
| 34 | + end |
| 35 | + ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb" |
| 36 | +elsif platform.is_cross_compiled_linux? |
| 37 | + pkg.environment "RUBY", host_ruby |
| 38 | + ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb" |
| 39 | + pkg.environment "LDFLAGS", settings[:ldflags] |
| 40 | +else |
| 41 | + ruby = File.join(ruby_bindir, 'ruby') |
| 42 | +end |
| 43 | + |
| 44 | +# This is a disturbing workaround needed for s390x based systems, that |
| 45 | +# for some reason isn't encountered with our other architecture cross |
| 46 | +# builds. When trying to build the augeas test cases for extconf.rb, |
| 47 | +# the process fails with "/opt/pl-build-tools/bin/s390x-linux-gnu-gcc: |
| 48 | +# error while loading shared libraries: /opt/puppetlabs/puppet/lib/libstdc++.so.6: |
| 49 | +# ELF file data encoding not little-endian". It will also complain in |
| 50 | +# the same way about libgcc. If however we temporarily move these |
| 51 | +# libraries out of the way, extconf.rb and the cross-compile work |
| 52 | +# properly. This needs to be fixed, but I've spent over a week analyzing |
| 53 | +# every possible angle that could cause this, from rbconfig settings to |
| 54 | +# strace logs, and we need to move forward on this platform. |
| 55 | +# FIXME: Scott Garman Jun 2016 |
| 56 | +if platform.architecture == "s390x" |
| 57 | + pkg.configure do |
| 58 | + [ |
| 59 | + "mkdir #{settings[:libdir]}/hide", |
| 60 | + "mv #{settings[:libdir]}/libstdc* #{settings[:libdir]}/hide/", |
| 61 | + "mv #{settings[:libdir]}/libgcc* #{settings[:libdir]}/hide/" |
| 62 | + ] |
| 63 | + end |
| 64 | +end |
| 65 | + |
| 66 | +pkg.build do |
| 67 | + build_commands = [] |
| 68 | + build_commands << "#{ruby} ext/augeas/extconf.rb" |
| 69 | + build_commands << "#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1)" |
| 70 | + |
| 71 | + build_commands |
| 72 | +end |
| 73 | + |
| 74 | +if settings[:ruby_vendordir] |
| 75 | + augeas_rb_target = File.join(settings[:ruby_vendordir], 'augeas.rb') |
| 76 | +else |
| 77 | + # If no alternate vendordir has been set, install into default |
| 78 | + # vendordir for this ruby version. |
| 79 | + augeas_rb_target = File.join(ruby_dir, 'lib', 'ruby', 'vendor_ruby', 'augeas.rb') |
| 80 | +end |
| 81 | + |
| 82 | +pkg.install_file 'lib/augeas.rb', augeas_rb_target |
| 83 | + |
| 84 | +pkg.install do |
| 85 | + [ |
| 86 | + "#{platform[:make]} -e -j$(shell expr $(shell #{platform[:num_cores]}) + 1) DESTDIR=/ install", |
| 87 | + ] |
| 88 | +end |
| 89 | + |
| 90 | +if platform.is_solaris? || platform.is_cross_compiled_linux? |
| 91 | + pkg.install do |
| 92 | + "chown root:root #{augeas_rb_target}" |
| 93 | + end |
| 94 | +end |
| 95 | + |
| 96 | +# Undo the gross hack from the configure step |
| 97 | +if platform.architecture == "s390x" |
| 98 | + pkg.install do |
| 99 | + [ |
| 100 | + "mv #{settings[:libdir]}/hide/* #{settings[:libdir]}/", |
| 101 | + "rmdir #{settings[:libdir]}/hide/" |
| 102 | + ] |
| 103 | + end |
| 104 | +end |
| 105 | + |
| 106 | +# Clean after install in case we are building for multiple rubies. |
| 107 | +pkg.install do |
| 108 | + "#{platform[:make]} -e clean" |
| 109 | +end |
0 commit comments