summaryrefslogtreecommitdiffstats
path: root/src/opkbuild
diff options
context:
space:
mode:
Diffstat (limited to 'src/opkbuild')
-rw-r--r--src/opkbuild17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/opkbuild b/src/opkbuild
index e4d8d60..ce9fe34 100644
--- a/src/opkbuild
+++ b/src/opkbuild
@@ -24,8 +24,17 @@ print_usage()
printf 'Usage: %s\n' "$1"
}
-# TODO: Sanity checks.
+# Sanity checks.
+if [ ! -f format -o ! -f build -o ! -f control ]; then
+ printf 'Error: Current working directory is not a source package.\n' >&2
+ exit 1
+fi
+if [ "$(cat format)" != '1.0' ]; then
+ printf 'Error: Source package is of an incompatible version.\n' >&2
+ exit 1
+fi
+# Build *-src package.
mkdir -p tmp/dest/usr/src/${pkgname}_${pkgver}
cd tmp
for file in ../*; do
@@ -41,10 +50,14 @@ done
oh-buildpkg ${pkgname}-src
rm -Rf dest
+# Build other binary packages.
for binpkgdir in ../*.pkg/; do
# TODO: Check architecture.
if true; then
+ # Make installation directory.
+ # TODO: Maybe this should be an FHS-compliant filesystem hierarchy.
mkdir dest
+ # Copy or extract software sources to src.
if [ -d ../src ]; then
cp -Rp ../src src
elif [ -f ../${pkgname}_${pkgver}.tar.gz ]; then
@@ -53,7 +66,9 @@ for binpkgdir in ../*.pkg/; do
# TODO: Other compression formats, putting things in src/, ...
binpkg=${binpkgdir#'../'}
binpkg=${binpkg%'.pkg/}
+ # Build the package.
../build ${binpkg}
+ # Clean up everything except the build stamps.
for file in *; do
case ${file} in
*.buildstamp)