From 64cf6bb223423578b4aba393727debf0bb7295bd Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 22 Oct 2012 01:32:16 -0400 Subject: Move common load/init logic into libopkhelper. --- diff --git a/lib/Makefile.in b/lib/Makefile.in index 4f26b57..5c2a6f9 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -26,11 +26,13 @@ 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 diff --git a/lib/common.sh b/lib/common.sh index 14762db..b0c465c 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -48,3 +48,15 @@ _oh_return() 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 index 2a71036..0b54f4a 100644 --- a/lib/load.sh +++ b/lib/load.sh @@ -24,6 +24,9 @@ _OH_LOAD_SM='true' # 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 diff --git a/src/Makefile.in b/src/Makefile.in index 93abe0a..20a4c56 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -27,7 +27,6 @@ libdir = @libdir@ datadir = @datadir@ localedir = @localedir@ libopkhelper = @libopkhelper@ -libopkbuild_1 = @libopkbuild_1@ sh = @sh@ @@ -35,7 +34,6 @@ sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\ s&@@PACKAGE_VERSION@@&$(package_version)&;\ s&@@LOCALEDIR@@&$(localedir)&;\ s&@@LIBOPKHELPER@@&$(libopkhelper)&;\ - s&@@LIBOPKBUILD_1@@&$(libopkbuild_1)&;\ s&@@SH@@&$(sh)&; .SUFFIXES: diff --git a/src/oh-autoconfigure.sh b/src/oh-autoconfigure.sh index 5ae5263..cef8e7f 100644 --- a/src/oh-autoconfigure.sh +++ b/src/oh-autoconfigure.sh @@ -19,17 +19,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@LIBOPKBUILD_1@@/load.sm' . '@@LIBOPKHELPER@@/load.sm' -ob_use locale -ob_use output oh_use buildsystem main() { - ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms' - ob_set_text_domain 'opkhelper' + oh_init while getopts 'S:B:' opt; do case "${opt}" in 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 . -. '@@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 . -. '@@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 . -. '@@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 -- cgit v0.9.1