summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3/build.mk39
-rw-r--r--src/3/ppt-mkpkgs96
-rw-r--r--src/3/ppt-rmpkgs10
3 files changed, 145 insertions, 0 deletions
diff --git a/src/3/build.mk b/src/3/build.mk
new file mode 100644
index 0000000..7f20ec0
--- /dev/null
+++ b/src/3/build.mk
@@ -0,0 +1,39 @@
+ppt_plat = $${OPK_SOURCE\#config-}
+ppt_pkg_dir = config-$${pkg}-$(ppt_plat).data
+ppt_platconf_dir = $(ppt_pkg_dir)/usr/share/platconf/$(ppt_plat)/$${pkg}_$${ver}
+0 = /usr/share/platconf-pkg-tools/$(ppt_version)/build.mk
+
+nop build:
+ @:
+
+install-build:
+ set -e; \
+ for pkg in src/build/*/; do \
+ pkg="$${pkg#src/build/}"; \
+ pkg="$${pkg%/}"; \
+ for ver in "src/build/$${pkg}/"*/; do \
+ ver="$${ver#src/build/$${pkg}/}"; \
+ ver="$${ver%/}"; \
+ mkdir -p "$(ppt_platconf_dir)"; \
+ cp -p "src/build/$${pkg}/$${ver}/"* \
+ "$(ppt_platconf_dir)"; \
+ done; \
+ done
+
+install-run:
+ set -e; \
+ for pkg in src/run/*/; do \
+ pkg="$${pkg#src/run/}"; \
+ pkg="$${pkg%/}"; \
+ mkdir "config-$${pkg}.data"; \
+ find "src/run/$${pkg}" -type f | while read -r file; do \
+ file="$${file#src/run/$${pkg}}"; \
+ mkdir -p "config-$${pkg}.data/$${file%/*}"; \
+ cp -p "src/run/$${pkg}/$${file}" \
+ "config-$${pkg}.data/$${file}"; \
+ done; \
+ done
+
+install:
+ [ -d src/build/ ] && $(MAKE) -f $0 install-build
+ [ -d src/run/ ] && $(MAKE) -f $0 install-run
diff --git a/src/3/ppt-mkpkgs b/src/3/ppt-mkpkgs
new file mode 100644
index 0000000..4bd49b1
--- /dev/null
+++ b/src/3/ppt-mkpkgs
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+set -eu
+
+PLAT=
+
+info()
+{
+ local fmt="${1}"
+ shift 1
+
+ printf "ppt-mkpkgs: ${fmt}\n" "${@}"
+}
+
+make_common_pkg()
+{
+ # Make "-common" package to provide source package documentation files.
+ mkdir -p "config-${PLAT}-common.pkg"
+ cat >"config-${PLAT}-common.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Description: "${PLAT}" platform configuration - common files
+ EOF
+ >"config-${PLAT}-common.pkg/docs"
+ info 'Metadata for package "%s" generated.' "config-${PLAT}-common"
+}
+
+make_base_pkg()
+{
+ # Make a "config-base" package to depend on packages to be automatically
+ # installed.
+ mkdir -p "config-base.pkg"
+ cat >"config-base.pkg/control" <<-EOF
+ Architecture: all
+ Platform: ${PLAT}
+ Essential: yes
+ Depends: config-${PLAT}-common (= \${Binary-Version}),
+ \${Config-Base-Depends}
+ Description: "${PLAT}" platform configuration - base package
+ EOF
+ info 'Metadata for package "%s" generated.' "config-base"
+}
+
+make_build_time_pkgs()
+{
+ local pkg=
+
+ # Make each config-*-* package.
+ for pkg in src/build/*; do
+ [ -d "${pkg}" ] || continue
+ pkg="${pkg#src/build/}"
+ mkdir -p "config-${pkg}-${PLAT}.pkg"
+ cat >"config-${pkg}-${PLAT}.pkg/control" <<-EOF
+ Architecture: all
+ Platform: all
+ Depends: config-${PLAT}-common (= \${Binary-Version}),
+ \${Config-${pkg}-Depends}
+ Description: "${PLAT}" platform configuration for ${pkg}
+ EOF
+ info 'Metadata for package "%s" generated.' \
+ "config-${pkg}-${PLAT}"
+ done
+}
+
+make_run_time_pkgs()
+{
+ local pkg=
+
+ # Make each config-* package.
+ for pkg in src/run/*; do
+ [ -d "${pkg}" ] || continue
+ pkg="${pkg#src/run/}"
+ mkdir -p "config-${pkg}.pkg"
+ cat >"config-${pkg}.pkg/control" <<-EOF
+ Architecture: all
+ Platform: ${PLAT}
+ Depends: config-${PLAT}-common (= \${Binary-Version}),
+ \${Config-${pkg}-Depends}
+ Description: "${PLAT}" platform configuration for ${pkg}
+ EOF
+ info 'Metadata for package "%s" generated.' \
+ "config-${pkg}"
+ done
+}
+
+main()
+{
+ PLAT="$(sed '1{s/^config-\([^ ][^ ]*\) (.*$/\1/;};1!q;' changelog)"
+
+ make_common_pkg
+ make_base_pkg
+ make_build_time_pkgs
+ make_run_time_pkgs
+}
+
+main "${@}"
diff --git a/src/3/ppt-rmpkgs b/src/3/ppt-rmpkgs
new file mode 100644
index 0000000..7e7fbc4
--- /dev/null
+++ b/src/3/ppt-rmpkgs
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -eu
+
+main()
+{
+ rm -Rf config-*.pkg/
+}
+
+main "${@}"