This repository has been archived on 2022-01-17. You can view files and clone it, but cannot push or open issues/pull-requests.
packaging/src/backends.cr

40 lines
927 B
Crystal

enum Package::BuildStatus
Success
Failed
Pass
end
# Building instructions
# phases: src-split, (pre-)(configure|build|install) and post-install
# name examples: autotools, cmake, make
# build(context, recipe)
class Package::Backend::Building
getter phase : String
getter name : String
getter callback : Proc(Context, Recipe, BuildStatus)
def initialize(@phase, @name, &block : Proc(Context, Recipe, BuildStatus))
@callback = block
end
def build(context : Context, recipe : Recipe)
@callback.call context, recipe
end
end
abstract class Package::Backend::Packaging
getter name : String
def initialize(@name)
end
abstract def package(pkgdir : String, architecture : String, package : Package) : Bool
def self.install(packages : Array(String))
raise "'install' unimplemented for this backend, yet"
end
def install(packages : Array(String))
self.install packages
end
end
require "./backends/*"