2019-07-02 03:50:50 +02:00
|
|
|
|
|
|
|
|
|
require "./context.cr"
|
|
|
|
|
require "./recipe.cr"
|
|
|
|
|
|
|
|
|
|
extend Package
|
|
|
|
|
|
|
|
|
|
# FIXME: recipe.clean? context autoclean?
|
2019-07-20 13:30:09 +02:00
|
|
|
|
context = Context.new()
|
|
|
|
|
context.packaging_backend = "apk"
|
2019-07-03 03:35:35 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
recipes = [] of Package::Recipe
|
2019-07-02 03:50:50 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
# FIXME: context.new_recipe? context.recipe?
|
|
|
|
|
recipes << Recipe.new(context, "hello", "2.10").tap do |recipe|
|
|
|
|
|
recipe.sources << "https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz"
|
2019-07-02 03:50:50 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
# This is a voluntary mix of automatic and manual build
|
|
|
|
|
# instructions.
|
|
|
|
|
# Also, installing in /package makes testing with a real-life
|
|
|
|
|
# package manager trivial and reduces the damage done in case
|
|
|
|
|
# of… containment failure. ]:->
|
|
|
|
|
recipe.instructions.configure << "cd hello-#{recipe.version} && ./configure --prefix=/package"
|
|
|
|
|
#recipe.instructions.build << "cd hello-#{recipe.version} && make"
|
|
|
|
|
#recipe.instructions.install << "cd hello-#{recipe.version} && make DESTDIR='${PKG}' install"
|
2019-07-03 04:24:33 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
recipe.url = "https://www.gnu.org/software/hello/"
|
|
|
|
|
recipe.description = "The GNU Hello program produces a familiar, friendly greeting."
|
|
|
|
|
recipe.dependencies << "gettext"
|
2019-07-04 23:18:54 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
# Should be automatic now.
|
|
|
|
|
#recipe.packages << Package::Package.new(recipe).tap do |package|
|
|
|
|
|
# package.name = "#{recipe.name}-man"
|
|
|
|
|
# package.files = ["/package/share/man"]
|
|
|
|
|
#end
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-20 15:00:11 +02:00
|
|
|
|
# Be careful with that one. It’s not configured to use proper prefixes.
|
|
|
|
|
# (Not sure that it should though. It’s gotta put things in /sbin anyway.)
|
|
|
|
|
recipes << Recipe.new(context, "sysvinit", "2.95").tap do |recipe|
|
|
|
|
|
recipe.sources << "https://git.savannah.nongnu.org/cgit/sysvinit.git/snapshot/sysvinit-#{recipe.version}.tar.gz"
|
|
|
|
|
recipe.url = "https://savannah.nongnu.org/projects/sysvinit"
|
|
|
|
|
recipe.description = "System V-like init system."
|
|
|
|
|
|
|
|
|
|
recipe.instructions.install << "cd sysvinit-#{recipe.version} && make ROOT='#{recipe.fake_root_directory}' install"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
recipes << Recipe.new(context, "musl", "1.1.23").tap do |recipe|
|
|
|
|
|
recipe.sources << "https://www.musl-libc.org/releases/musl-#{recipe.version}.tar.gz"
|
|
|
|
|
recipe.url = "https://www.musl-libc.org/"
|
|
|
|
|
recipe.description = "The musl c library (libc) implementation."
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
if ARGV.size == 0 || ARGV[0]? == "-h"
|
|
|
|
|
pp recipes.map &.name
|
|
|
|
|
exit 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
selected_recipes = ARGV.map do |name|
|
|
|
|
|
recipes.find(&.name.==(name)) || name
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if selected_recipes.any? &.is_a?(String)
|
|
|
|
|
puts "At least one of the requested recipes is not known."
|
2019-07-03 03:17:01 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
selected_recipes.select! &.is_a?(String)
|
|
|
|
|
pp! selected_recipes
|
|
|
|
|
end
|
2019-07-02 03:50:50 +02:00
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
# Getting rid of Strings.
|
|
|
|
|
selected_recipes = selected_recipes.compact_map do |recipe|
|
|
|
|
|
if recipe.is_a? String
|
|
|
|
|
nil
|
|
|
|
|
else
|
|
|
|
|
recipe
|
2019-07-02 03:50:50 +02:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2019-07-20 13:30:09 +02:00
|
|
|
|
selected_recipes.each do |recipe|
|
|
|
|
|
pp recipe
|
|
|
|
|
|
|
|
|
|
raise "oh no, download failed" unless recipe.download
|
|
|
|
|
raise "oh no, extraction failed" unless recipe.extract
|
|
|
|
|
|
|
|
|
|
raise "oh no, build failed" unless recipe.build
|
|
|
|
|
raise "oh no, packaging failed" unless recipe.package
|
|
|
|
|
|
|
|
|
|
recipe.clean
|
|
|
|
|
end
|
|
|
|
|
|