From 5ad65f00ecd9382136c873632ca6ab78f3c0a552 Mon Sep 17 00:00:00 2001 From: Karchnu Date: Sat, 20 Feb 2021 22:15:08 +0100 Subject: [PATCH] packaging.spec configuration example, few comments in src/context.cr --- packaging.spec | 35 +++++++++++++++++++++++++++++++++++ src/context.cr | 7 +++++++ 2 files changed, 42 insertions(+) create mode 100644 packaging.spec diff --git a/packaging.spec b/packaging.spec new file mode 100644 index 0000000..eb40f8a --- /dev/null +++ b/packaging.spec @@ -0,0 +1,35 @@ +# /etc/packaging.spec configuration file + +# where to send built packages +packages-directory: /usr/local/baguette/pkg/ +# where to download sources +sources-directory: /usr/local/baguette/src/ + +# the slot we want for our packages +slotting: /usr/baguette + +# prefixes for `packaging` running environment and child processes +# a.k.a. where to search for binaries during the build +prefixes: + - /usr/baguette/ + - / + +# list of environment variables when building +environment: + # we may choose another compiler, provide some CFLAGS, etc. + - CC: clang + - CFLAGS: -Os -Wall + + # next three parameters have special meaning + # to provide parameters to the `./configure` script when building + - configure: --disable-nls --without-gettext + + # to provide parameters to the `make` command + - make: + + # to provide parameters to the final `make install` command + - make install: + +# wanna build for another system? not a problem, just add the back-end (we currently have `apk` and `package`) +package-manager: package + diff --git a/src/context.cr b/src/context.cr index 776e585..8ccbc77 100644 --- a/src/context.cr +++ b/src/context.cr @@ -58,7 +58,11 @@ class Package::Context # but it’ll be kind of enough for now. property architecture = "x86_64" + # prefixes for `packaging` running environment and child processes + # = where to search for binaries and libraries for the build property prefixes = ["/usr", "/", "/usr/baguetteos"] + + # list of environment variables we want to have when building property environment = {} of String => String property verbosity = 0 @@ -259,8 +263,10 @@ class Package::Context when "sources-directory" @sources_directory = value.as_s when "prefixes" + # Prefixes during the build process. @prefixes = value.as_a_or_s when "environment" + # Environment variables during the build process. value.as_a_or_s.each do |entry| match = entry.split(':').map( &.gsub(/^[ \t]*/, "").gsub(/[ \t]*$/, "")) @@ -274,6 +280,7 @@ class Package::Context @environment[key] = value end when "package-manager" + # Targeted package manager (default: package, for BaguetteOS). self.packaging_backend = value.as_s end end