summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-10-22 03:40:58 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-10-22 03:40:58 (EDT)
commitf3aeb0ffc84c75faea757d94b0270ee566b6a03f (patch)
treecbea7f3f36427ba7a851c7a5a59696d3288ac8ba
parentd85b660b4a34e2fa2f75fde202059ee41ab20eb4 (diff)
parentdfd503fffcca2c1527c6004dff86e304079a4ebb (diff)
Merge branch 'feature/buildsystems-support'.
-rw-r--r--.gitignore2
-rw-r--r--Makefile.in16
-rwxr-xr-xconfigure4
-rw-r--r--lib/Makefile.in76
-rw-r--r--lib/buildsystem.sh108
-rw-r--r--lib/buildsystem/Makefile.in69
-rw-r--r--lib/buildsystem/autoconf.sh72
-rw-r--r--lib/buildsystem/make.sh97
-rw-r--r--lib/common.sh62
-rw-r--r--lib/load.sh51
-rw-r--r--man/Makefile.in4
-rw-r--r--man/oh-autobuild.1.in47
-rw-r--r--man/oh-autoclean.1.in47
-rw-r--r--man/oh-autoconfigure.1.in47
-rw-r--r--man/oh-autoinstall.1.in55
-rw-r--r--man/oh-autotest.1.in47
-rw-r--r--src/Makefile.in11
-rw-r--r--src/oh-autobuild.sh51
-rw-r--r--src/oh-autoclean.sh51
-rw-r--r--src/oh-autoconfigure.sh51
-rw-r--r--src/oh-autoinstall.sh54
-rw-r--r--src/oh-autotest.sh51
-rw-r--r--src/oh-fixperms.sh8
-rw-r--r--src/oh-installfiles.sh7
-rw-r--r--src/oh-strip.sh8
25 files changed, 1074 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index e5dbd7c..8a6293e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@ Session.vim
# Generated files
Makefile
src/*[^.]??
+lib/*.sm
+lib/*/*.sm
man/*[^.]??
locale/*/*.ms
opkhelper-*.tar.*
diff --git a/Makefile.in b/Makefile.in
index 253a0be..ea83095 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -26,6 +26,7 @@ bindir = @bindir@
libdir = @libdir@
datadir = @datadir@
mandir = @mandir@
+libopkhelper = @libopkhelper@
libopkbuild_1 = @libopkbuild_1@
DESTDIR = /
@@ -39,6 +40,7 @@ MACROS = \
'libdir=$(libdir)' \
'datadir=$(datadir)' \
'mandir=$(mandir)' \
+ 'libopkhelper=$(libopkhelper)' \
'libopkbuild_1=$(libopkbuild_1)'
distdir = $(package_name)-$(package_version)
@@ -49,6 +51,9 @@ distfiles = configure Makefile.in COPYING README INSTALL ChangeLog TODO
all:
@printf 'Making executable files...\n'
@cd src && $(MAKE) $(MACROS) all
+ @printf 'Making library files...\n'
+ @cd lib && $(MAKE) $(MACROS) all
+ @cd lib/buildsystem && $(MAKE) $(MACROS) all
@printf 'Making locales...\n'
@cd locale && $(MAKE) $(MACROS) all
@printf 'Making manual pages...\n'
@@ -57,6 +62,9 @@ all:
clean:
@printf 'Cleaning executable files...\n'
@cd src && $(MAKE) $(MACROS) clean
+ @printf 'Cleaning library files...\n'
+ @cd lib && $(MAKE) $(MACROS) clean
+ @cd lib/buildsystem && $(MAKE) $(MACROS) clean
@printf 'Cleaning locales...\n'
@cd locale && $(MAKE) $(MACROS) clean
@printf 'Cleaning manual pages...\n'
@@ -65,6 +73,9 @@ clean:
install: all
@printf 'Installing executable files...\n'
@cd src && $(MAKE) $(MACROS) install
+ @printf 'Installing library files...\n'
+ @cd lib && $(MAKE) $(MACROS) install
+ @cd lib/buildsystem && $(MAKE) $(MACROS) install
@printf 'Installing locales...\n'
@cd locale && $(MAKE) $(MACROS) install
@printf 'Installing manual pages...\n'
@@ -73,6 +84,9 @@ install: all
uninstall:
@printf 'Uninstalling executable files...\n'
@cd src && $(MAKE) $(MACROS) uninstall
+ @printf 'Uninstalling library files...\n'
+ @cd lib/buildsystem && $(MAKE) $(MACROS) uninstall
+ @cd lib && $(MAKE) $(MACROS) uninstall
@printf 'Uninstalling locales...\n'
@cd locale && $(MAKE) $(MACROS) uninstall
@printf 'Uninstalling manual pages...\n'
@@ -82,6 +96,8 @@ $(distdir):
@mkdir -p '$(distdir)'
@cp -pR $(distfiles) '$(distdir)'
@cd src && $(MAKE) '../$(distdir)/src'
+ @cd lib && $(MAKE) '../$(distdir)/lib'
+ @cd lib/buildsystem && $(MAKE) '../$(distdir)/lib/buildsystem'
@cd locale && $(MAKE) '../$(distdir)/locale'
@cd man && $(MAKE) '../$(distdir)/man'
diff --git a/configure b/configure
index 9a55e7b..69ba15a 100755
--- a/configure
+++ b/configure
@@ -30,6 +30,7 @@ libdir='$(prefix)/share'
datadir='$(prefix)/share'
mandir='$(datadir)/man'
localedir='$(datadir)/locale'
+libopkhelper='$(libdir)/libopkhelper.3.0'
quiet='false'
missing_deps='false'
@@ -62,6 +63,7 @@ package_name
package_version
package_description
${long_opts_with_args}
+libopkhelper
${features}
"
@@ -309,7 +311,7 @@ write_makefiles()
_sed_script="${_sed_script}s&@${_var}@&$(eval echo \$\{"${_var}"\})&g;"
done
- for _dir in . src locale man; do
+ for _dir in . src lib lib/buildsystem locale man; do
mkdir -p "${_dir}"
sed "${_sed_script}" "${srcdir}/${_dir}/Makefile.in" >"${_dir}/Makefile"
done
diff --git a/lib/Makefile.in b/lib/Makefile.in
new file mode 100644
index 0000000..5c2a6f9
--- /dev/null
+++ b/lib/Makefile.in
@@ -0,0 +1,76 @@
+# opkhelper
+# Makefile.in
+# Input Makefile for configure.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package_name = @package_name@
+package_version= @package_version@
+
+srcdir = @srcdir@
+prefix = @prefix@
+libdir = @libdir@
+datadir = @datadir@
+localedir = @localedir@
+libopkhelper = @libopkhelper@
+libopkbuild_1 = @libopkbuild_1@
+
+sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
+ s&@@PACKAGE_VERSION@@&$(package_version)&;\
+ s&@@LOCALEDIR@@&$(localedir)&;\
+ s&@@LIBOPKHELPER@@&$(libopkhelper)&;\
+ s&@@LIBOPKBUILD_1@@&$(libopkbuild_1)&;
+
+.SUFFIXES:
+.SUFFIXES: .sh .sm
+
+SRCS = load.sh common.sh \
+ buildsystem.sh
+OBJS = $(SRCS:.sh=.sm)
+
+distdir = ../$(package_name)-$(package_version)/lib
+distfiles = Makefile.in $(SRCS)
+
+all: $(OBJS)
+
+$(OBJS):
+ @printf ' SED lib/%s\n' '$@'
+ @sed '$(sed_script)' '$(srcdir)/lib/$*.sh' >'$@'
+
+clean:
+ @for obj in $(OBJS); do \
+ printf ' RM lib/%s\n' "$${obj}"; \
+ rm -f "$${obj}"; \
+ done
+
+install: all
+ @mkdir -p '$(DESTDIR)/$(libopkhelper)'
+ @for obj in $(OBJS); do \
+ printf ' INSTALL lib/%s\n' "$${obj}"; \
+ cp "$${obj}" "$(DESTDIR)/$(libopkhelper)/$${obj}"; \
+ chmod 644 "$(DESTDIR)/$(libopkhelper)/$${obj}"; \
+ done
+
+uninstall:
+ @for obj in $(OBJS); do \
+ printf ' RM %s\n' "$${obj}"; \
+ rm -f "$(DESTDIR)/$(libopkhelper)/$${obj}"; \
+ done
+ @rmdir '$(DESTDIR)/$(libopkhelper)' 2>/dev/null || true
+
+$(distdir):
+ @mkdir -p '$(distdir)'
+ @cp -pR $(distfiles) '$(distdir)'
diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh
new file mode 100644
index 0000000..7cf70f5
--- /dev/null
+++ b/lib/buildsystem.sh
@@ -0,0 +1,108 @@
+# opkhelper
+# lib/buildsystem
+# Interface for interacting with software build systems.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+[ -n "${_OH_BUILDSYSTEM_SM}" ] && return 0
+_OH_BUILDSYSTEM_SM='true'
+
+_OH_BUILDSYSTEMS='
+autoconf
+make
+'
+
+oh_buildsystems_init()
+{
+ _oh_local _ohbsi_bs
+
+ for _ohbsi_bs in ${_OH_BUILDSYSTEMS}; do
+ oh_use "buildsystem/${_ohbsi_bs}"
+ done
+
+ _OH_BUILDSYSTEM_WORK_AREA="${PWD}"
+ _OH_BUILDSYSTEM_SOURCE_DIR="$(cd src && pwd)"
+
+ [ -z "${_OH_BUILDSYSTEM_BUILD_DIR}" ] && \
+ _OH_BUILDSYSTEM_BUILD_DIR="${PWD}/src"
+ [ -z "${_OH_BUILDSYSTEM_DESTDIR}" ] && \
+ _OH_BUILDSYSTEM_DESTDIR="${PWD}/dest"
+ [ -z "${_OH_BUILDSYSTEM_SYSTEM}" ] && \
+ _OH_BUILDSYSTEM_SYSTEM=''
+}
+
+oh_set_buildsystem_option()
+{
+ _oh_local _ohsbso_name _obsbso_value
+
+ if [ ${#} -eq 2 ]; then
+ _ohsbso_name="${1}"
+ _ohsbso_value="${2}"
+ else
+ _oh_return 125
+ return ${?}
+ fi
+
+ case "${_ohsbso_name}" in
+ 'build-dir')
+ _OH_BUILDSYSTEM_BUILD_DIR="${_ohsbso_value}"
+ ;;
+ 'destdir')
+ _OH_BUILDSYSTEM_DESTDIR="${_ohsbso_value}"
+ ;;
+ 'build-system')
+ _OH_BUILDSYSTEM_SYSTEM="${_ohsbso_value}"
+ ;;
+ *)
+ _oh_return 125
+ return ${?}
+ ;;
+ esac
+}
+
+oh_buildsystem_do()
+{
+ _oh_local _ohbsd_step _ohbsd_bs _ohbsd_done
+
+ if [ ${#} -ge 1 ]; then
+ _ohbsd_step="${1}"
+ shift 1
+ else
+ _oh_return 125
+ return ${?}
+ fi
+
+ _ohbsd_done='false'
+
+ if [ -n "${_OH_BUILDSYSTEM_SYSTEM}" ]; then
+ if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsd_step}"; then
+ "_oh_${_OH_BUILDSYSTEM_SYSTEM}_${_ohbsd_step}" "${@}"
+ _ohbsd_done='true'
+ fi
+ else
+ for _ohbsd_bs in ${_OH_BUILDSYSTEMS}; do
+ if "_oh_${_ohbsd_bs}_can_${_ohbsd_step}"; then
+ "_oh_${_ohbsd_bs}_${_ohbsd_step}" "${@}"
+ _ohbsd_done='true'
+ break
+ fi
+ done
+ fi
+
+ if ! ${_ohbsd_done}; then
+ : error
+ fi
+}
diff --git a/lib/buildsystem/Makefile.in b/lib/buildsystem/Makefile.in
new file mode 100644
index 0000000..abc59ff
--- /dev/null
+++ b/lib/buildsystem/Makefile.in
@@ -0,0 +1,69 @@
+# opkhelper
+# Makefile.in
+# Input Makefile for configure.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package_name = @package_name@
+package_version= @package_version@
+
+srcdir = @srcdir@
+prefix = @prefix@
+libdir = @libdir@
+libopkhelper = @libopkhelper@
+
+sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
+ s&@@PACKAGE_VERSION@@&$(package_version)&;
+
+.SUFFIXES:
+.SUFFIXES: .sh .sm
+
+SRCS = autoconf.sh make.sh
+OBJS = $(SRCS:.sh=.sm)
+
+distdir = ../../$(package_name)-$(package_version)/lib/buildsystem
+distfiles = Makefile.in $(SRCS)
+
+all: $(OBJS)
+
+$(OBJS):
+ @printf ' SED lib/buildsystem/%s\n' '$@'
+ @sed '$(sed_script)' '$(srcdir)/lib/buildsystem/$*.sh' >'$@'
+
+clean:
+ @for obj in $(OBJS); do \
+ printf ' RM lib/buildsystem/%s\n' "$${obj}"; \
+ rm -f "$${obj}"; \
+ done
+
+install: all
+ @mkdir -p '$(DESTDIR)/$(libopkhelper)/buildsystem'
+ @for obj in $(OBJS); do \
+ printf ' INSTALL lib/buildsystem/%s\n' "$${obj}"; \
+ cp "$${obj}" "$(DESTDIR)/$(libopkhelper)/buildsystem/$${obj}"; \
+ chmod 644 "$(DESTDIR)/$(libopkhelper)/buildsystem/$${obj}"; \
+ done
+
+uninstall:
+ @for obj in $(OBJS); do \
+ printf ' RM %s\n' "$${obj}"; \
+ rm -f "$(DESTDIR)/$(libopkhelper)/buildsystem/$${obj}"; \
+ done
+ @rmdir '$(DESTDIR)/$(libopkhelper)/buildsystem' 2>/dev/null || true
+
+$(distdir):
+ @mkdir -p '$(distdir)'
+ @cp -pR $(distfiles) '$(distdir)'
diff --git a/lib/buildsystem/autoconf.sh b/lib/buildsystem/autoconf.sh
new file mode 100644
index 0000000..13370ae
--- /dev/null
+++ b/lib/buildsystem/autoconf.sh
@@ -0,0 +1,72 @@
+# opkhelper
+# lib/buildsystem/autoconf
+# Build system plugin for GNU Autoconf.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+[ -n "${_OH_BUILDSYSTEM_AUTOCONF_SM}" ] && return 0
+_OH_BUILDSYSTEM_AUTOCONF_SM='true'
+
+_oh_autoconf_can_configure()
+{
+ [ -x "${_OH_BUILDSYSTEM_SOURCE_DIR}/configure" ]
+}
+
+_oh_autoconf_configure()
+{
+ mkdir -p "${_OH_BUILDSYSTEM_BUILD_DIR}"
+ cd "${_OH_BUILDSYSTEM_BUILD_DIR}"
+
+ "${_OH_BUILDSYSTEM_SOURCE_DIR}/configure" \
+ --prefix='/usr' \
+ --bindir='${prefix}/bin' \
+ --sbindir='${prefix}/sbin' \
+ --libexecdir='${prefix}/lib' \
+ --sysconfdir='/etc' \
+ --localstatedir='/var' \
+ --libdir='${prefix}/lib' \
+ --includedir='${prefix}/include' \
+ --infodir='${prefix}/share/info' \
+ --mandir='${prefix}/share/man' \
+ --build="${OPK_BUILD_ARCH_GNU}" \
+ $([ "${OPK_BUILD_ARCH}" != "${OPK_HOST_ARCH}" ] && \
+ printf '%s' "--host=${OPK_HOST_ARCH_GNU}") \
+ --disable-maintainer-mode \
+ --disable-dependency-tracking \
+ "${@}"
+
+ cd "${_OH_BUILDSYSTEM_WORK_AREA}"
+}
+
+_oh_autoconf_can_build()
+{
+ return 1
+}
+
+_oh_autoconf_can_clean()
+{
+ return 1
+}
+
+_oh_autoconf_can_test()
+{
+ return 1
+}
+
+_oh_autoconf_can_install()
+{
+ return 1
+}
diff --git a/lib/buildsystem/make.sh b/lib/buildsystem/make.sh
new file mode 100644
index 0000000..5df424a
--- /dev/null
+++ b/lib/buildsystem/make.sh
@@ -0,0 +1,97 @@
+# opkhelper
+# lib/buildsystem/make
+# Build system plugin for POSIX-conformant make.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+[ -n "${_OH_BUILDSYSTEM_MAKE_SM}" ] && return 0
+_OH_BUILDSYSTEM_MAKE_SM='true'
+
+_oh_make_can_configure()
+{
+ return 1
+}
+
+_oh_make_can_build()
+{
+ [ -r "${_OH_BUILDSYSTEM_SOURCE_DIR}/makefile" -o \
+ -r "${_OH_BUILDSYSTEM_SOURCE_DIR}/Makefile" ]
+}
+
+_oh_make_build()
+{
+ _oh_make_update_first_defined_target '' "${@}"
+}
+
+_oh_make_can_clean()
+{
+ _oh_make_can_build
+}
+
+_oh_make_clean()
+{
+ _oh_make_update_first_defined_target 'distclean realclean clean' "${@}"
+}
+
+_oh_make_can_test()
+{
+ _oh_make_can_build
+}
+
+_oh_make_test()
+{
+ _oh_make_update_first_defined_target 'test check' "${@}"
+}
+
+_oh_make_can_install()
+{
+ _oh_make_can_build
+}
+
+_oh_make_install()
+{
+ _oh_make_update_first_defined_target 'install' \
+ "${@}" "DESTDIR=${_OH_BUILDSYSTEM_DESTDIR}"
+}
+
+_oh_make_update_first_defined_target()
+{
+ _oh_local _ohbsmufdt_targets _ohbsmufdt_target
+
+ _ohbsmufdt_targets="${1}"
+ shift
+
+ mkdir -p "${_OH_BUILDSYSTEM_BUILD_DIR}"
+ cd "${_OH_BUILDSYSTEM_BUILD_DIR}"
+
+ if [ -z "${_ohbsmufdt_targets}" ]; then
+ make "${@}"
+ else
+ for _ohbsmufdt_target in ${_ohbsmufdt_targets}; do
+ # If the target is defined, ...
+ if make -n "${_ohbsmufdt_target}" >/dev/null 2>&1; then
+ # ... then update it.
+ make "${@}" "${_ohbsmufdt_target}"
+ break
+ fi
+ done
+ fi
+
+ cd "${_OH_BUILDSYSTEM_WORK_AREA}"
+
+ _oh_return 0
+ return ${?}
+}
diff --git a/lib/common.sh b/lib/common.sh
new file mode 100644
index 0000000..b0c465c
--- /dev/null
+++ b/lib/common.sh
@@ -0,0 +1,62 @@
+# opkhelper
+# lib/common
+# Functions for stack memory management.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+[ -n "${_OH_COMMON_SM}" ] && return 0
+_OH_COMMON_SM='true'
+
+_OH_STACK_VARS=
+_OH_SAVED_IFS=
+
+_oh_local()
+{
+ # Push the variable list onto the stack.
+ _OH_STACK_VARS="${_OH_STACK_VARS}|${*}"
+
+ # Save the old IFS value, if any, and set it to its default.
+ _OH_SAVED_IFS="${IFS}"
+ IFS='
+'
+}
+
+_oh_return()
+{
+ # Unset the variables at the top of the stack.
+ IFS=' '
+ unset -v ${_OH_STACK_VARS##*|}
+
+ # Pop the variable list from the top of the stack.
+ _OH_STACK_VARS="${_OH_STACK_VARS%|*}"
+
+ # Restore the saved IFS.
+ IFS="${_OH_SAVED_IFS}"
+
+ return ${1}
+}
+
+oh_init()
+{
+ ob_use locale
+ ob_use output
+
+ # Since nothing other than opkhelper is supposed to use libopkhelper, we can
+ # do strange things like affecting application-wide locale settings from the
+ # library and assume that no one will play with them.
+ ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
+ ob_set_text_domain 'opkhelper'
+}
diff --git a/lib/load.sh b/lib/load.sh
new file mode 100644
index 0000000..0b54f4a
--- /dev/null
+++ b/lib/load.sh
@@ -0,0 +1,51 @@
+# opkhelper
+# lib/load
+# Functions for loading library modules.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+[ -n "${_OH_LOAD_SM}" ] && return 0
+_OH_LOAD_SM='true'
+
+# The "common" module is used by this and all other modules.
+# We have to manually load the "common" module so we can use it in oh_use.
+. '@@LIBOPKHELPER@@/common.sm'
+
+# Assume that every library module and utility uses libopkbuild.
+. '@@LIBOPKBUILD_1@@/load.sm'
+
+oh_use()
+{
+ _oh_local _ohu_module
+
+ if [ ${#} -eq 1 ]; then
+ _ohu_module="${1}"
+ else
+ _oh_return 125
+ return ${?}
+ fi
+
+ _ohu_module='@@LIBOPKHELPER@@'"/${_ohu_module}.sm"
+ if [ -r "${_ohu_module}" ]; then
+ . "${_ohu_module}"
+ else
+ _oh_return 1
+ return ${?}
+ fi
+
+ _oh_return 0
+ return ${?}
+}
diff --git a/man/Makefile.in b/man/Makefile.in
index a684679..fe4350e 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -35,7 +35,9 @@ sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
.SUFFIXES:
.SUFFIXES: .in
-SRCS = oh-installfiles.1.in oh-strip.1.in oh-fixperms.1.in
+SRCS = oh-installfiles.1.in oh-strip.1.in oh-fixperms.1.in \
+ oh-autoconfigure.1.in oh-autobuild.1.in \
+ oh-autoclean.1.in oh-autotest.1.in oh-autoinstall.1.in
OBJS = $(SRCS:.in=)
distdir = ../$(package_name)-$(package_version)/man
diff --git a/man/oh-autobuild.1.in b/man/oh-autobuild.1.in
new file mode 100644
index 0000000..4ebbe16
--- /dev/null
+++ b/man/oh-autobuild.1.in
@@ -0,0 +1,47 @@
+.\" Author: Patrick "P. J." McDermott
+.TH oh-autobuild 1 \
+"@@DATE@@" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@"
+
+.SH NAME
+oh-autobuild \- Automatically build a package.
+
+.SH SYNOPSIS
+.B oh-autobuild
+.RB [ -S
+.IR buildsystem ]
+.RB [ -B
+.IR builddir ]
+[\-\-
+.IR arguments ]
+
+.SH DESCRIPTION
+.B oh-autobuild
+attempts to automatically build a package.
+
+.SH OPTIONS
+.TP
+.BI \-S \ buildsystem
+Force the use of
+.IR buildsystem ,
+instead of trying to detect the one used by the package.
+.TP
+.BI \-B \ builddir
+Build in
+.I builddir
+instead of in the source directory.
+
+.SH COPYRIGHT
+Copyright (C) 2012 Patrick "P. J." McDermott
+.sp
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+.sp
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.sp
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/man/oh-autoclean.1.in b/man/oh-autoclean.1.in
new file mode 100644
index 0000000..57fd91b
--- /dev/null
+++ b/man/oh-autoclean.1.in
@@ -0,0 +1,47 @@
+.\" Author: Patrick "P. J." McDermott
+.TH oh-autoclean 1 \
+"@@DATE@@" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@"
+
+.SH NAME
+oh-autoclean \- Automatically clean up a package's built files.
+
+.SH SYNOPSIS
+.B oh-autoclean
+.RB [ -S
+.IR buildsystem ]
+.RB [ -B
+.IR builddir ]
+[\-\-
+.IR arguments ]
+
+.SH DESCRIPTION
+.B oh-autoclean
+attempts to automatically clean up built files in the build directory.
+
+.SH OPTIONS
+.TP
+.BI \-S \ buildsystem
+Force the use of
+.IR buildsystem ,
+instead of trying to detect the one used by the package.
+.TP
+.BI \-B \ builddir
+Build in
+.I builddir
+instead of in the source directory.
+
+.SH COPYRIGHT
+Copyright (C) 2012 Patrick "P. J." McDermott
+.sp
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+.sp
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.sp
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/man/oh-autoconfigure.1.in b/man/oh-autoconfigure.1.in
new file mode 100644
index 0000000..4394e72
--- /dev/null
+++ b/man/oh-autoconfigure.1.in
@@ -0,0 +1,47 @@
+.\" Author: Patrick "P. J." McDermott
+.TH oh-autoconfigure 1 \
+"@@DATE@@" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@"
+
+.SH NAME
+oh-autoconfigure \- Automatically configure a package to be built.
+
+.SH SYNOPSIS
+.B oh-autoconfigure
+.RB [ -S
+.IR buildsystem ]
+.RB [ -B
+.IR builddir ]
+[\-\-
+.IR arguments ]
+
+.SH DESCRIPTION
+.B oh-autoconfigure
+attempts to automatically configure a package to be built.
+
+.SH OPTIONS
+.TP
+.BI \-S \ buildsystem
+Force the use of
+.IR buildsystem ,
+instead of trying to detect the one used by the package.
+.TP
+.BI \-B \ builddir
+Build in
+.I builddir
+instead of in the source directory.
+
+.SH COPYRIGHT
+Copyright (C) 2012 Patrick "P. J." McDermott
+.sp
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+.sp
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.sp
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/man/oh-autoinstall.1.in b/man/oh-autoinstall.1.in
new file mode 100644
index 0000000..9b97ebb
--- /dev/null
+++ b/man/oh-autoinstall.1.in
@@ -0,0 +1,55 @@
+.\" Author: Patrick "P. J." McDermott
+.TH oh-autoinstall 1 \
+"@@DATE@@" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@"
+
+.SH NAME
+oh-autoinstall \- Automatically install a package's data files.
+
+.SH SYNOPSIS
+.B oh-autoinstall
+.RB [ -S
+.IR buildsystem ]
+.RB [ -B
+.IR builddir ]
+.RB [ -d
+.IR destdir ]
+[\-\-
+.IR arguments ]
+
+.SH DESCRIPTION
+.B oh-autoinstall
+attempts to automatically install a package's data files.
+
+.SH OPTIONS
+.TP
+.BI \-S \ buildsystem
+Force the use of
+.IR buildsystem ,
+instead of trying to detect the one used by the package.
+.TP
+.BI \-B \ builddir
+Build in
+.I builddir
+instead of in the source directory.
+.TP
+.BI \-d \ destdir
+Install data files in
+.IR destdir .
+The default directory is
+.IR dest .
+
+.SH COPYRIGHT
+Copyright (C) 2012 Patrick "P. J." McDermott
+.sp
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+.sp
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.sp
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/man/oh-autotest.1.in b/man/oh-autotest.1.in
new file mode 100644
index 0000000..49a16ca
--- /dev/null
+++ b/man/oh-autotest.1.in
@@ -0,0 +1,47 @@
+.\" Author: Patrick "P. J." McDermott
+.TH oh-autotest 1 \
+"@@DATE@@" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@"
+
+.SH NAME
+oh-autotest \- Automatically run a package's test suites.
+
+.SH SYNOPSIS
+.B oh-autotest
+.RB [ -S
+.IR buildsystem ]
+.RB [ -B
+.IR builddir ]
+[\-\-
+.IR arguments ]
+
+.SH DESCRIPTION
+.B oh-autotest
+attempts to automatically run a package's test suites.
+
+.SH OPTIONS
+.TP
+.BI \-S \ buildsystem
+Force the use of
+.IR buildsystem ,
+instead of trying to detect the one used by the package.
+.TP
+.BI \-B \ builddir
+Build in
+.I builddir
+instead of in the source directory.
+
+.SH COPYRIGHT
+Copyright (C) 2012 Patrick "P. J." McDermott
+.sp
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+.sp
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+.sp
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/Makefile.in b/src/Makefile.in
index d620dca..1886b13 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -26,14 +26,14 @@ bindir = @bindir@
libdir = @libdir@
datadir = @datadir@
localedir = @localedir@
-libopkbuild_1 = @libopkbuild_1@
+libopkhelper = @libopkhelper@
sh = @sh@
sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
s&@@PACKAGE_VERSION@@&$(package_version)&;\
s&@@LOCALEDIR@@&$(localedir)&;\
- s&@@LIBOPKBUILD_1@@&$(libopkbuild_1)&;\
+ s&@@LIBOPKHELPER@@&$(libopkhelper)&;\
s&@@SH@@&$(sh)&;
.SUFFIXES:
@@ -42,7 +42,12 @@ sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
SRCS = \
oh-installfiles.sh \
oh-strip.sh \
- oh-fixperms.sh
+ oh-fixperms.sh \
+ oh-autoconfigure.sh \
+ oh-autobuild.sh \
+ oh-autoclean.sh \
+ oh-autotest.sh \
+ oh-autoinstall.sh
OBJS = $(SRCS:.sh=)
distdir = ../$(package_name)-$(package_version)/src
diff --git a/src/oh-autobuild.sh b/src/oh-autobuild.sh
new file mode 100644
index 0000000..1bfe420
--- /dev/null
+++ b/src/oh-autobuild.sh
@@ -0,0 +1,51 @@
+#!@@SH@@
+#
+# opkhelper
+# src/oh-autobuild
+# Automatically build a package.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. '@@LIBOPKHELPER@@/load.sm'
+
+oh_use buildsystem
+
+main()
+{
+ oh_init
+
+ while getopts 'S:B:' opt; do
+ case "${opt}" in
+ S)
+ oh_set_buildsystem_option 'build-system' "${OPTARG}"
+ ;;
+ B)
+ oh_set_buildsystem_option 'build-dir' "${OPTARG}"
+ ;;
+ ?)
+ ob_error "$(ob_get_msg 'bad_opt')"
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ oh_buildsystems_init
+
+ oh_buildsystem_do 'build' "${@}"
+}
+
+main "${@}"
diff --git a/src/oh-autoclean.sh b/src/oh-autoclean.sh
new file mode 100644
index 0000000..e0488bd
--- /dev/null
+++ b/src/oh-autoclean.sh
@@ -0,0 +1,51 @@
+#!@@SH@@
+#
+# opkhelper
+# src/oh-autoclean
+# Automatically clean up a package's built files.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. '@@LIBOPKHELPER@@/load.sm'
+
+oh_use buildsystem
+
+main()
+{
+ oh_init
+
+ while getopts 'S:B:' opt; do
+ case "${opt}" in
+ S)
+ oh_set_buildsystem_option 'build-system' "${OPTARG}"
+ ;;
+ B)
+ oh_set_buildsystem_option 'build-dir' "${OPTARG}"
+ ;;
+ ?)
+ ob_error "$(ob_get_msg 'bad_opt')"
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ oh_buildsystems_init
+
+ oh_buildsystem_do 'clean' "${@}"
+}
+
+main "${@}"
diff --git a/src/oh-autoconfigure.sh b/src/oh-autoconfigure.sh
new file mode 100644
index 0000000..cef8e7f
--- /dev/null
+++ b/src/oh-autoconfigure.sh
@@ -0,0 +1,51 @@
+#!@@SH@@
+#
+# opkhelper
+# src/oh-autoconfigure
+# Automatically configure a package to be built.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. '@@LIBOPKHELPER@@/load.sm'
+
+oh_use buildsystem
+
+main()
+{
+ oh_init
+
+ while getopts 'S:B:' opt; do
+ case "${opt}" in
+ S)
+ oh_set_buildsystem_option 'build-system' "${OPTARG}"
+ ;;
+ B)
+ oh_set_buildsystem_option 'build-dir' "${OPTARG}"
+ ;;
+ ?)
+ ob_error "$(ob_get_msg 'bad_opt')"
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ oh_buildsystems_init
+
+ oh_buildsystem_do 'configure' "${@}"
+}
+
+main "${@}"
diff --git a/src/oh-autoinstall.sh b/src/oh-autoinstall.sh
new file mode 100644
index 0000000..b50174e
--- /dev/null
+++ b/src/oh-autoinstall.sh
@@ -0,0 +1,54 @@
+#!@@SH@@
+#
+# opkhelper
+# src/oh-autoinstall
+# Automatically install a package's data files.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. '@@LIBOPKHELPER@@/load.sm'
+
+oh_use buildsystem
+
+main()
+{
+ oh_init
+
+ while getopts 'S:B:d:' opt; do
+ case "${opt}" in
+ S)
+ oh_set_buildsystem_option 'build-system' "${OPTARG}"
+ ;;
+ B)
+ oh_set_buildsystem_option 'build-dir' "${OPTARG}"
+ ;;
+ d)
+ oh_set_buildsystem_option 'destdir' "${OPTARG}"
+ ;;
+ ?)
+ ob_error "$(ob_get_msg 'bad_opt')"
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ oh_buildsystems_init
+
+ oh_buildsystem_do 'install' "${@}"
+}
+
+main "${@}"
diff --git a/src/oh-autotest.sh b/src/oh-autotest.sh
new file mode 100644
index 0000000..7176c08
--- /dev/null
+++ b/src/oh-autotest.sh
@@ -0,0 +1,51 @@
+#!@@SH@@
+#
+# opkhelper
+# src/oh-autotest
+# Automatically run a package's test suites.
+#
+# Copyright (C) 2012 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. '@@LIBOPKHELPER@@/load.sm'
+
+oh_use buildsystem
+
+main()
+{
+ oh_init
+
+ while getopts 'S:B:' opt; do
+ case "${opt}" in
+ S)
+ oh_set_buildsystem_option 'build-system' "${OPTARG}"
+ ;;
+ B)
+ oh_set_buildsystem_option 'build-dir' "${OPTARG}"
+ ;;
+ ?)
+ ob_error "$(ob_get_msg 'bad_opt')"
+ exit 1
+ ;;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ oh_buildsystems_init
+
+ oh_buildsystem_do 'test' "${@}"
+}
+
+main "${@}"
diff --git a/src/oh-fixperms.sh b/src/oh-fixperms.sh
index b9029df..d8f3886 100644
--- a/src/oh-fixperms.sh
+++ b/src/oh-fixperms.sh
@@ -19,17 +19,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. '@@LIBOPKBUILD_1@@/load.sm'
-
-ob_use locale
-ob_use output
+. '@@LIBOPKHELPER@@/load.sm'
main()
{
dir='dest'
- ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
- ob_set_text_domain 'opkhelper'
+ oh_init
while getopts 'd:' opt; do
case "${opt}" in
diff --git a/src/oh-installfiles.sh b/src/oh-installfiles.sh
index d77c89b..6288e6a 100644
--- a/src/oh-installfiles.sh
+++ b/src/oh-installfiles.sh
@@ -19,10 +19,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. '@@LIBOPKBUILD_1@@/load.sm'
+. '@@LIBOPKHELPER@@/load.sm'
-ob_use locale
-ob_use output
ob_use package
files_ifs='
@@ -32,8 +30,7 @@ main()
{
dir='dest'
- ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
- ob_set_text_domain 'opkhelper'
+ oh_init
while getopts 'd:' opt; do
case "${opt}" in
diff --git a/src/oh-strip.sh b/src/oh-strip.sh
index bf328a5..96c4d3f 100644
--- a/src/oh-strip.sh
+++ b/src/oh-strip.sh
@@ -19,10 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. '@@LIBOPKBUILD_1@@/load.sm'
-
-ob_use locale
-ob_use output
+. '@@LIBOPKHELPER@@/load.sm'
CR='
'
@@ -32,8 +29,7 @@ main()
dir='dest'
keep_debug='false'
- ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms'
- ob_set_text_domain 'opkhelper'
+ oh_init
while getopts 'd:k' opt; do
case "${opt}" in