Obsolete
/
packaging
Archived
3
0
Fork 0

%{prefix} macro added.

- It is used in automated building instructions.
	- It is used in auto-splits.
	- It is preset before reading the recipe to the first of the
	  default prefixes defined in this context, and can be reset
	  to force the recipe to build somewhere else.
master
Luka Vandervelden 2019-08-28 20:26:15 +02:00
parent aac0eff75f
commit 4c66f13cae
2 changed files with 24 additions and 8 deletions

View File

@ -71,6 +71,8 @@ class Package::Context
# but itll be kind of enough for now.
property architecture = "x86_64"
property prefixes = ["/usr", "/", "/usr/weirdos"]
def initialize
@packaging_backends << Backend::Packaging.new "pkgutils" do |context, package|
puts "#{package.fake_root_directory} -> #{packages_directory}/#{package.name}##{package.version}-#{package.release}.pkg.tar.xz"
@ -111,7 +113,7 @@ class Package::Context
next BuildStatus::Pass
end
child = context.sh "./configure --prefix=/usr #{recipe.options["configure"]? || ""}"
child = context.sh "./configure --prefix=#{recipe.prefix} #{recipe.options["configure"]? || ""}"
if child.exit_status == 0
BuildStatus::Success
@ -154,19 +156,24 @@ class Package::Context
@splitter_backends << Backend::Splitter.new do |recipe|
Package.new(recipe, true).tap do |split|
prefixes = (@prefixes + [recipe.prefix]).uniq
split.name = "#{recipe.name}-man"
split.files = ["/usr/share/man"]
split.files = prefixes.map do |prefix|
"#{prefix}/share/man"
end
end
end
@splitter_backends << Backend::Splitter.new do |recipe|
Package.new(recipe, true).tap do |split|
prefixes = (@prefixes + [recipe.prefix]).uniq
split.name = "#{recipe.name}-dev"
split.files = ["/usr/include"]
split.file_patterns = [
Regex.new("^/lib/.*\\.a$"),
Regex.new("^/usr/lib/.*\\.a$")
]
split.files = prefixes.map { |x| "#{x}/include" }
split.file_patterns = prefixes.map do |prefix|
Regex.new("^" + prefix + ".*\\.a$")
end
end
end
end

View File

@ -57,6 +57,8 @@ class Package::Recipe
getter sources = Sources.new
getter packages = Array(Package).new
@prefix : String?
property recipe_directory = "."
@working_uuid : UUID = UUID.random
@ -74,7 +76,8 @@ class Package::Recipe
def initialize(@context, filename : String)
specs = SpecFileParser.parse filename, {
"pkg" => fake_root_directory
"pkg" => fake_root_directory,
"prefix" => prefix
}
name : String? = nil
@ -112,6 +115,8 @@ class Package::Recipe
@instructions.install << value.as_s_or_ls
when "dirname"
@dirname = value.as_s
when "prefix"
@prefix = value.as_s
when "dependencies"
value.as_a_or_s.each do |atom|
@run_dependencies << atom
@ -182,6 +187,10 @@ class Package::Recipe
@dirname || "#{name}-#{version}"
end
def prefix : String
@prefix || @context.prefixes[0]? || "/usr"
end
def download
sources.each do |url|
next if url.scheme == "file"