|
| 1 | +component "boost" do |pkg, settings, platform| |
| 2 | + # Source-Related Metadata |
| 3 | + pkg.version "1.67.0" |
| 4 | + pkg.md5sum "4850fceb3f2222ee011d4f3ea304d2cb" |
| 5 | + # Apparently boost doesn't use dots to version they use underscores....arg |
| 6 | + pkg.url "http://downloads.sourceforge.net/project/boost/boost/#{pkg.get_version}/boost_#{pkg.get_version.gsub('.','_')}.tar.gz" |
| 7 | + pkg.mirror "#{settings[:buildsources_url]}/boost_#{pkg.get_version.gsub('.','_')}.tar.gz" |
| 8 | + |
| 9 | + if platform.is_solaris? |
| 10 | + pkg.apply_patch 'resources/patches/boost/0001-fix-build-for-solaris.patch' |
| 11 | + pkg.apply_patch 'resources/patches/boost/Fix-bootstrap-build-for-solaris-10.patch' |
| 12 | + end |
| 13 | + |
| 14 | + if platform.is_solaris? || platform.is_aix? |
| 15 | + pkg.apply_patch 'resources/patches/boost/solaris-aix-boost-filesystem-unique-path.patch' |
| 16 | + end |
| 17 | + |
| 18 | + if platform.is_cisco_wrlinux? |
| 19 | + pkg.apply_patch 'resources/patches/boost/no-fionbio.patch' |
| 20 | + end |
| 21 | + |
| 22 | + if platform.architecture == "aarch64" |
| 23 | + #pkg.apply_patch 'resources/patches/boost/boost-aarch64-flags.patch' |
| 24 | + end |
| 25 | + |
| 26 | + # Package Dependency Metadata |
| 27 | + |
| 28 | + # Build Requirements |
| 29 | + if platform.is_cross_compiled_linux? |
| 30 | + pkg.build_requires "pl-binutils-#{platform.architecture}" |
| 31 | + pkg.build_requires "pl-gcc-#{platform.architecture}" |
| 32 | + elsif platform.is_aix? |
| 33 | + # |
| 34 | + elsif platform.is_solaris? |
| 35 | + # |
| 36 | + elsif platform.is_windows? |
| 37 | + # |
| 38 | + elsif platform.is_macos? |
| 39 | + # |
| 40 | + else |
| 41 | + pkg.build_requires "pl-gcc" |
| 42 | + # Various Linux platforms |
| 43 | + case platform.name |
| 44 | + when /el|fedora/ |
| 45 | + pkg.build_requires 'bzip2-devel' |
| 46 | + pkg.build_requires 'zlib-devel' |
| 47 | + when /sles-(11|12)/ |
| 48 | + pkg.build_requires 'libbz2-devel' |
| 49 | + pkg.build_requires 'zlib-devel' |
| 50 | + when /debian|ubuntu|Cumulus/i |
| 51 | + pkg.build_requires 'libbz2-dev' |
| 52 | + pkg.build_requires 'zlib1g-dev' |
| 53 | + end |
| 54 | + end |
| 55 | + |
| 56 | + # Build-time Configuration |
| 57 | + boost_libs = [ 'atomic', 'chrono', 'container', 'date_time', 'exception', 'filesystem', 'graph', 'graph_parallel', 'iostreams', 'locale', 'log', 'math', 'program_options', 'random', 'regex', 'serialization', 'signals', 'system', 'test', 'thread', 'timer', 'wave' ] |
| 58 | + |
| 59 | + cflags = "-fPIC -std=c99" |
| 60 | + cxxflags = "-std=c++11 -fPIC" |
| 61 | + |
| 62 | + # These are all places where windows differs from *nix. These are the default *nix settings. |
| 63 | + toolset = 'gcc' |
| 64 | + with_toolset = "--with-toolset=#{toolset}" |
| 65 | + boost_dir = "" |
| 66 | + bootstrap_suffix = ".sh" |
| 67 | + execute = "./" |
| 68 | + addtl_flags = "" |
| 69 | + gpp = "#{settings[:tools_root]}/bin/g++" |
| 70 | + b2flags = "" |
| 71 | + |
| 72 | + if platform.is_cross_compiled_linux? |
| 73 | + pkg.environment "PATH" => "/opt/pl-build-tools/bin:$$PATH" |
| 74 | + linkflags = "-Wl,-rpath=#{settings[:libdir]}" |
| 75 | + gpp = "/opt/pl-build-tools/bin/#{settings[:platform_triple]}-g++" |
| 76 | + elsif platform.is_macos? |
| 77 | + pkg.environment "PATH" => "/opt/pl-build-tools/bin:$$PATH" |
| 78 | + linkflags = "" |
| 79 | + gpp = "clang++" |
| 80 | + toolset = 'gcc' |
| 81 | + with_toolset = "--with-toolset=clang" |
| 82 | + elsif platform.is_solaris? |
| 83 | + pkg.environment 'PATH', '/opt/pl-build-tools/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin:/usr/csw/bin' |
| 84 | + linkflags = "-Wl,-rpath=#{settings[:libdir]},-L/opt/pl-build-tools/#{settings[:platform_triple]}/lib,-L/usr/lib" |
| 85 | + b2flags = "define=_XOPEN_SOURCE=600" |
| 86 | + if platform.architecture == "sparc" |
| 87 | + b2flags = "#{b2flags} instruction-set=v9" |
| 88 | + end |
| 89 | + gpp = "/opt/pl-build-tools/bin/#{settings[:platform_triple]}-g++" |
| 90 | + elsif platform.is_windows? |
| 91 | + arch = platform.architecture == "x64" ? "64" : "32" |
| 92 | + pkg.environment "PATH" => "C:/tools/mingw#{arch}/bin:$$PATH" |
| 93 | + pkg.environment "CYGWIN" => "nodosfilewarning" |
| 94 | + |
| 95 | + # bootstrap.bat does not take the `--with-toolset` flag |
| 96 | + toolset = "gcc" |
| 97 | + with_toolset = "" |
| 98 | + # boost is installed with this extra subdirectory on windows |
| 99 | + boost_dir = "boost-1_67" |
| 100 | + # we do not need to reference the .bat suffix when calling the bootstrap script |
| 101 | + bootstrap_suffix = "" |
| 102 | + # we need to make sure we link against non-cygwin libraries |
| 103 | + execute = "cmd.exe /c " |
| 104 | + |
| 105 | + gpp = "C:/tools/mingw#{arch}/bin/g++" |
| 106 | + |
| 107 | + # We don't have iconv available on windows yet |
| 108 | + addtl_flags = "boost.locale.iconv=off" |
| 109 | + elsif platform.is_aix? |
| 110 | + pkg.environment "PATH" => "/opt/freeware/bin:/opt/pl-build-tools/bin:$(PATH)" |
| 111 | + linkflags = "-Wl,-L#{settings[:libdir]},-L/opt/pl-build-tools/lib" |
| 112 | + else |
| 113 | + pkg.environment "PATH" => "#{settings[:bindir]}:$$PATH" |
| 114 | + linkflags = "-Wl,-rpath=#{settings[:libdir]},-rpath=#{settings[:libdir]}64" |
| 115 | + end |
| 116 | + |
| 117 | + # Set user-config.jam |
| 118 | + if platform.is_windows? |
| 119 | + userconfigjam = %Q{using gcc : : #{gpp} ;} |
| 120 | + else |
| 121 | + if platform.architecture =~ /arm|s390x/ || platform.is_aix? |
| 122 | + userconfigjam = %Q{using gcc : 5.2.0 : #{gpp} : <linkflags>"#{linkflags}" <cflags>"#{cflags}" <cxxflags>"#{cxxflags}" ;} |
| 123 | + else |
| 124 | + userconfigjam = %Q{using gcc : 4.8.2 : #{gpp} : <linkflags>"#{linkflags}" <cflags>"#{cflags}" <cxxflags>"#{cxxflags}" ;} |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + # Build Commands |
| 129 | + |
| 130 | + # On some platforms, we have multiple means of specifying paths. Sometimes, we need to use either one |
| 131 | + # form or another. `special_prefix` allows us to do this. i.e., on windows, we need to have the |
| 132 | + # windows specific path (C:/), whereas for everything else, we can default to the drive root currently |
| 133 | + # in use (/cygdrive/c). This has to do with how the program is built, where it is expecting to find |
| 134 | + # libraries and binaries, and how it tries to find them. |
| 135 | + pkg.build do |
| 136 | + [ |
| 137 | + %Q{echo '#{userconfigjam}' > ~/user-config.jam}, |
| 138 | + "cd tools/build", |
| 139 | + "#{execute}bootstrap#{bootstrap_suffix} #{with_toolset}", |
| 140 | + "./b2 install -d+2 \ |
| 141 | + --prefix=#{settings[:prefix]} \ |
| 142 | + toolset=#{toolset} \ |
| 143 | + #{b2flags} \ |
| 144 | + --debug-configuration" |
| 145 | + ] |
| 146 | + end |
| 147 | + |
| 148 | + pkg.install do |
| 149 | + [ "#{settings[:prefix]}/bin/b2 \ |
| 150 | + -d+2 \ |
| 151 | + toolset=#{toolset} \ |
| 152 | + #{b2flags} \ |
| 153 | + --debug-configuration \ |
| 154 | + --build-dir=. \ |
| 155 | + --prefix=#{settings[:prefix]} \ |
| 156 | + #{boost_libs.map {|lib| "--with-#{lib}"}.join(" ")} \ |
| 157 | + #{addtl_flags} \ |
| 158 | + install", |
| 159 | + "chmod 0644 #{settings[:includedir]}/#{boost_dir}/boost/graph/vf2_sub_graph_iso.hpp", |
| 160 | + "chmod 0644 #{settings[:includedir]}/#{boost_dir}/boost/thread/v2/shared_mutex.hpp", |
| 161 | + # Remove the user-config.jam from the build user's home directory: |
| 162 | + "rm -f ~/user-config.jam" |
| 163 | + ] |
| 164 | + end |
| 165 | +end |
0 commit comments