1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
|
# Copyright (C) 2013-2022 Ruby-GNOME Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module GNOME
module Rake
class ExternalPackage < Struct.new(:name,
:download_name,
:base_name,
:archive_base_name,
:label,
:version,
:download_site,
:download_base_url,
:compression_method,
:base_dir_in_package,
:windows,
:native,
:patches,
:need_autogen,
:need_autoreconf,
:build_concurrently,
:bundled_packages)
def initialize(properties)
super()
properties.each do |key, value|
send("#{key}=", value)
end
end
def compression_method
resolve_value(super) || "gz"
end
def download_name
resolve_value(super) || name
end
def base_name
resolve_value(super) ||
"#{name.split('/').last}-#{version.gsub(/\Av/, '')}"
end
def archive_base_name
resolve_value(super) || "#{base_name}.tar.#{compression_method}"
end
def archive_url
"#{download_base_url}/#{archive_base_name}"
end
def download_base_url
resolve_value(super) || download_site_base_url
end
def patches
super || []
end
def need_autogen?
need_autogen
end
def need_autoreconf?
need_autoreconf
end
def base_dir_in_package
resolve_value(super) || "."
end
def windows
super || WindowsConfiguration.new({})
end
def windows=(properties)
super(WindowsConfiguration.new(properties))
end
def native
super || NativeConfiguration.new({})
end
def native=(properties)
super(NativeConfiguration.new(properties))
end
def bundled_packages
super || []
end
def latest_version
warn("this feature is no longer supported.")
nil
end
private
def resolve_value(value)
if value.respond_to?(:call)
value.call(self)
else
value
end
end
class WindowsConfiguration < Struct.new(:build,
:include_paths,
:library_paths,
:configure_args,
:meson_args,
:cmake_args,
:make_args,
:cc_args,
:patches,
:built_file,
:need_autogen,
:need_autoreconf,
:force_to_disable_deplibs_check,
:build_concurrently,
:use_cc_environment_variable,
:gobject_introspection_compiler_split_args,
:use_gobject_introspection)
def initialize(properties)
super()
properties.each do |key, value|
send("#{key}=", value)
end
end
def build?
build.nil? ? true : build
end
def include_paths
super || []
end
def library_paths
super || []
end
def configure_args
super || []
end
def meson_args
super || []
end
def cmake_args
super || []
end
def cc_args
super || []
end
def make_args
super || []
end
def patches
super || []
end
def built_file
super || nil
end
def need_autogen?
need_autogen.nil? ? false : need_autogen
end
def need_autoreconf?
need_autoreconf.nil? ? false : need_autoreconf
end
def force_to_disable_deplibs_check?
if force_to_disable_deplibs_check.nil?
false
else
force_to_disable_deplibs_check
end
end
def build_concurrently?
build_concurrently.nil? ? true : build_concurrently
end
def use_cc_environment_variable?
use_cc_environment_variable.nil? ? true : use_cc_environment_variable
end
def gobject_introspection_compiler_split_args?
gobject_introspection_compiler_split_args
end
def use_gobject_introspection?
use_gobject_introspection.nil? ? true : use_gobject_introspection
end
end
class NativeConfiguration < Struct.new(:build,
:configure_args,
:patches,
:built_file,
:need_autogen,
:need_autoreconf,
:build_concurrently)
def initialize(properties)
super()
properties.each do |key, value|
send("#{key}=", value)
end
end
def build?
build.nil? ? false : build
end
def configure_args
super || []
end
def patches
super || []
end
def built_file
super || nil
end
def need_autogen?
need_autogen.nil? ? false : need_autogen
end
def need_autoreconf?
need_autoreconf.nil? ? false : need_autoreconf
end
def build_concurrently?
build_concurrently.nil? ? true : build_concurrently
end
end
end
end
end
|