From 20c66a1eaef872dbfad4ba82d2ca1c74eb4c9818 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 01 Mar 2014 19:40:11 -0500 Subject: Merge branch 'feature/autoconf-and-automake'. --- diff --git a/.gitignore b/.gitignore index 8a6293e..00b4298 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,38 @@ # Swap and backup files -.*.sw* -.sw* -*~ +*.s[a-w]? Session.vim +*~ +*.orig + +# Files generated by aclocal, autoconf, and automake +aclocal.m4 +autom4te.cache/ +configure +build-aux/ +ChangeLog +INSTALL +Makefile.in -# Generated files +# Files generated by configure +config.log +config.status Makefile + +# Files generated by Makefile src/*[^.]?? lib/*.sm lib/*/*.sm +locale/*.ms man/*[^.]?? -locale/*/*.ms -opkhelper-*.tar.* +*-*/ +*-*.tar* + +# Build and destination directories +build/ +build.*/ +dest/ +dest.*/ + +# Patches and build logs +[0-9][0-9][0-9][0-9]-*.patch +*.log diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..d9952b7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +P. J. McDermott diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..927fb38 --- /dev/null +++ b/COPYING @@ -0,0 +1,13 @@ +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 copies of the GNU General Public License +along with this program in the files "COPYING.2" and "COPYING.3". +If not, see . diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 6f78957..0000000 --- a/INSTALL +++ /dev/null @@ -1,43 +0,0 @@ -Basic Installation -================== - -This software package uses a build system similar to one generated by GNU -Autoconf and Automake. - -The `configure` shell script attempts to find certain system dependencies (e.g. -a shell interpreter) and configure the package to be built and installed on the -system. Upon successful dependency resolution and configuration, the script -generates a `Makefile` in your current working directory. - -The simplest way to configure, build, and install this package is: - - 1. Run the `configure` script from the source directory or any other directory. - For example, from the source directory you can run `./configure`. - 2. Run `make` to build the package. - 3. Run `make install` to install the package. You will probably need superuser - privileges to install files into your system. - -To uninstall the package, you can run `make uninstall`. - - -Options -======= - -The `configure` script accepts certain command-line options to control package -building and installation. Run the script with the `--help` option for more -information. - - -Macros -====== - -The macro `DESTDIR` affects the root directory into which the `Makefile` -installs the package. For example, you can install the package into a -filesystem hierarchy under a directory named `dest` in the current directory by -running `make DESTDIR=dest install`. - - -Separate Build Directory -======================== - -Building opkhelper from outside the source directory is currently unsupported. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..68820f2 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,169 @@ +# Process this file with automake to produce an input makefile. +# +# Copyright (C) 2013, 2014 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 3 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 . + +include $(top_srcdir)/src/local.mk +include $(top_srcdir)/lib/local.mk +include $(top_srcdir)/lib/buildsystem/local.mk +include $(top_srcdir)/man/local.mk +include $(top_srcdir)/locale/local.mk +include $(top_srcdir)/archtab/local.mk +include $(top_srcdir)/tests/local.mk + +bin_SCRIPTS = $(bin_sources:.sh=) +pkgdata_SCRIPTS = $(pkgdata_sources:.sh=.sm) +pkgdatabuildsystem_SCRIPTS = $(pkgdatabuildsystem_sources:.sh=.sm) +man1_MANS = $(man1_sources:.1in=.1) +locale_MESSAGES = $(locale_sources:.sh=.ms) +CLEANFILES = \ + $(bin_SCRIPTS) \ + $(pkgdata_SCRIPTS) \ + $(pkgdatabuildsystem_SCRIPTS) \ + $(man1_MANS) \ + $(locale_MESSAGES) +pkgdatabuildsystemdir = $(pkgdatadir)/buildsystem +archtabdir = $(pkgdatadir)/archtab +EXTRA_DIST = \ + COPYING.2 \ + COPYING.3 \ + autogen.sh \ + $(bin_sources) \ + $(pkgdata_sources) \ + $(pkgdatabuildsystem_sources) \ + $(man1_sources) \ + $(locale_sources) \ + $(archtab_sources) \ + $(tests) \ + tests/testlib.sh + +SUFFIXES = .sh .sm .1in .1 .ms + +textdomain = $$(printf '%s\n' '$(PACKAGE)' | sed -e 's|-|_|g') +do_subst = sed \ + -e 's|[@]PACKAGE[@]|$(PACKAGE)|g' \ + -e 's|[@]PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|[@]PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \ + -e 's|[@]SH[@]|$(SH)|g' \ + -e 's|[@]multiarch_libdir[@]|$(multiarch_libdir)|g' \ + -e 's|[@]pkgdatadir[@]|$(pkgdatadir)|g' \ + -e 's|[@]localedir[@]|$(localedir)|g' \ + -e 's|[@]archtabdir[@]|$(archtabdir)|g' + +all-local: $(locale_MESSAGES) $(archtab_sources) + +install-data-local: $(locale_MESSAGES) $(archtab_sources) + @$(NORMAL_INSTALL) + for f in $(locale_MESSAGES); do \ + ff="$${f#*/}"; \ + dir="$(DESTDIR)$(localedir)/$${ff%.ms}/LC_MESSAGES"; \ + $(MKDIR_P) "$${dir}" || exit 1; \ + $(INSTALL_DATA) "$${f}" "$${dir}/$(textdomain).ms" || \ + exit $${?}; \ + done + for f in $(archtab_sources); do \ + ff="$${f#*/}"; \ + dir="$(DESTDIR)$(archtabdir)/$${ff%/?*}"; \ + $(MKDIR_P) "$${dir}" || exit 1; \ + $(INSTALL_DATA) "$(top_srcdir)/$${f}" "$${dir}/$${ff#*/}" || \ + exit $${?}; \ + done + +uninstall-local: + @$(NORMAL_UNINSTALL) + for f in $(locale_MESSAGES); do \ + ff="$${f#*/}"; \ + dir="$(DESTDIR)$(localedir)/$${ff%.ms}/LC_MESSAGES"; \ + rm -f "$${dir}/$(textdomain).ms"; \ + done + for f in $(archtab_sources); do \ + ff="$${f#*/}"; \ + dir="$(DESTDIR)$(archtabdir)/$${ff%/?*}"; \ + rm -f "$${dir}/$${ff#*/}"; \ + done + +uninstall-hook: + for f in $(archtab_sources); do \ + ff="$${f#*/}"; \ + dir="$(DESTDIR)$(archtabdir)/$${ff%/?*}"; \ + if [ -d "$${dir}" ]; then \ + rmdir "$${dir}" || exit 1; \ + fi; \ + done + for dir in \ + '$(DESTDIR)$(pkgdatabuildsystemdir)' \ + '$(DESTDIR)$(archtabdir)' \ + '$(DESTDIR)$(pkgdatadir)'; do \ + if [ -d "$${dir}" ]; then \ + rmdir "$${dir}"; \ + fi; \ + done + +really-clean: distclean + rm -Rf $(srcdir)/aclocal.m4 $(srcdir)/autom4te.cache/ \ + $(srcdir)/configure \ + $(srcdir)/build-aux/ $(srcdir)/INSTALL $(srcdir)/Makefile.in + +test: + @set -e; \ + mkdir -p tests; \ + cd tests; \ + . '$(abs_top_srcdir)/tests/testlib.sh'; \ + PATH="$${PATH}:$(DESTDIR)$(bindir)"; \ + t_all=0; t_failed=0; \ + for t_test in $(tests); do \ + t_fail='false'; \ + . "$(abs_top_srcdir)/$${t_test}" >out 2>&1; \ + if "$${t_fail}"; then \ + printf 'FAIL: %s\n' "$${t_test#tests/}"; \ + cat out | sed 's/^/ /'; \ + t_failed=$$(($$t_failed + 1)); \ + else \ + printf 'PASS: %s\n' "$${t_test#tests/}"; \ + fi; \ + t_all=$$(($$t_all + 1)); \ + rm out; \ + done; \ + t_banner="$$(printf '%d out of %d tests failed' \ + $${t_failed} $${t_all})"; \ + t_l=$$(printf '%s\n' "$${t_banner}" | wc -c); \ + t_i=1; while [ "$${t_i}" -lt "$${t_l}" ]; do \ + printf '='; \ + t_i=$$(($$t_i + 1)); \ + done; \ + printf '\n%s\n' "$${t_banner}"; \ + t_i=1; while [ "$${t_i}" -lt "$${t_l}" ]; do \ + printf '='; \ + t_i=$$(($$t_i + 1)); \ + done; \ + printf '\n'; \ + [ $${t_failed} -eq 0 ] + +.sh: + $(AM_V_GEN)$(MKDIR_P) "$$(dirname $@)" + $(AM_V_at)$(do_subst) $< >$@ + $(AM_V_at)chmod a+x $@ + +.sh.sm: + $(AM_V_GEN)$(MKDIR_P) "$$(dirname $@)" + $(AM_V_at)$(do_subst) $< >$@ + +.1in.1: + $(AM_V_GEN)$(MKDIR_P) "$$(dirname $@)" + $(AM_V_at)$(do_subst) $< >$@ + +.sh.ms: + $(AM_V_GEN)$(MKDIR_P) "$$(dirname $@)" + $(AM_V_at)cp $< $@ diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 1d57c5d..0000000 --- a/Makefile.in +++ /dev/null @@ -1,284 +0,0 @@ -# opkhelper -# Makefile.in -# Input Makefile for configure. -# -# Copyright (C) 2012-2013 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 . - -package_name = @package_name@ -package_version= @package_version@ -package_description = @package_description@ -package_library = @package_library@ - -srcdir = @srcdir@ -prefix = @prefix@ -bindir = @bindir@ -libdir = @libdir@ -pkglibdir = @pkglibdir@ -datadir = @datadir@ -mandir = @mandir@ -man1dir = @man1dir@ -localedir = @localedir@ -pkgdatadir = @pkgdatadir@ -archtabdir = @archtabdir@ - -DESTDIR = / - -sh = @sh@ - -multiarch_libdir = @multiarch_libdir@ - -pkglibbuildsystemdir = $(pkglibdir)/buildsystem - -include $(srcdir)/src/local.mk -include $(srcdir)/lib/local.mk -include $(srcdir)/lib/buildsystem/local.mk -include $(srcdir)/man/local.mk -include $(srcdir)/locale/local.mk -include $(srcdir)/archtab/local.mk -include $(srcdir)/tests/local.mk - -bin = $(bin_srcs:.sh=) -pkglib = $(pkglib_srcs:.sh=.sm) -pkglibbuildsystem = $(pkglibbuildsystem_srcs:.sh=.sm) -man1 = $(man1_srcs:.1in=.1) -locale = $(locale_srcs:.sh=.ms) -archtab = $(archtab_srcs) - -distdir = $(package_name)-$(package_version) -distfiles = \ - configure \ - Makefile.in \ - COPYING.2 \ - COPYING.3 \ - README \ - INSTALL \ - ChangeLog \ - TODO \ - src/local.mk \ - lib/local.mk \ - lib/buildsystem/local.mk \ - man/local.mk \ - locale/local.mk \ - archtab/local.mk \ - tests/local.mk \ - $(bin_srcs) \ - $(pkglib_srcs) \ - $(pkglibbuildsystem_srcs) \ - $(man1_srcs) \ - $(locale_srcs) \ - $(archtab_srcs) \ - $(tests) - -textdomain = $$(printf '%s\n' '$(package_name)' | sed -e 's|-|_|g') - -script = \ - s&@@PACKAGE_NAME@@&$(package_name)&;\ - s&@@PACKAGE_VERSION@@&$(package_version)&;\ - s&@@PACKAGE_DESCRIPTION@@&$(package_description)&;\ - s&@@PKGLIBDIR@@&$(pkglibdir)&;\ - s&@@LOCALEDIR@@&$(localedir)&;\ - s&@@ARCHTABDIR@@&$(archtabdir)&;\ - s&@@SH@@&$(sh)&;\ - s&@@MULTIARCH_LIBDIR@@&$(multiarch_libdir)&; - -.SUFFIXES: -.SUFFIXES: .sh .sm .1in .1 .ms - -# XXX: Support for lists of multiple targets in inference rules doesn't appear -# to be required by POSIX.1-2008 [1], but it exists in GNU Make and NetBSD -# pmake. Expand this into separate rules if it is a problem with certain make -# implementations. -# [1]: Compare the inference and target rule definitions after fragments -# <#tag_20_76_13_06> and <#tag_20_76_13_04> in -# . -.sh: - @printf ' SED %s\n' '$@' - @sed '$(script)' '$(srcdir)/$?' >'$@' - @chmod 755 '$@' -.sh.sm .1in.1: - @printf ' SED %s\n' '$@' - @sed '$(script)' '$(srcdir)/$?' >'$@' - @chmod 644 '$@' -.sh.ms: - @printf ' CP %s\n' '$@' - @obj='$@'; mkdir -p "$${obj%/*}" - @cp '$(srcdir)/$?' '$@' - @chmod 644 '$@' - -all: all-exec all-data -all-exec: all-bin all-pkglib all-pkglibbuildsystem -all-bin: $(bin) -all-pkglib: $(pkglib) -all-pkglibbuildsystem: $(pkglibbuildsystem) -all-data: all-man1 all-locale -all-man1: $(man1) -all-locale: $(locale) - -clean_cmds = \ - set -e; \ - for f in $${files}; do \ - printf ' RM %s\n' "$${f}"; \ - rm -f "$${f}"; \ - done -clean: clean-exec clean-data -clean-exec: clean-bin clean-pkglib clean-pkglibbuildsystem -clean-bin: - @files='$(bin)'; $(clean_cmds) -clean-pkglib: - @files='$(pkglib)'; $(clean_cmds) -clean-pkglibbuildsystem: - @files='$(pkglibbuildsystem)'; $(clean_cmds) -clean-data: clean-man1 clean-locale -clean-man1: - @files='$(man1)'; $(clean_cmds) -clean-locale: - @files='$(locale)'; $(clean_cmds) - -install_cmds = \ - set -e; \ - mkdir -p "$(DESTDIR)/$${dir}"; \ - for f in $${files}; do \ - printf ' INSTALL %s\n' "$${f}"; \ - ff="$$(basename "$${f}")"; \ - cp "$${f}" "$(DESTDIR)/$${dir}/$${ff}"; \ - chmod "$${mode}" "$(DESTDIR)/$${dir}/$${ff}"; \ - done -install: all install-exec install-data -install-exec: all-exec install-bin install-pkglib install-pkglibbuildsystem -install-bin: - @files='$(bin)'; dir='$(bindir)'; mode='755'; $(install_cmds) -install-pkglib: - @files='$(pkglib)'; dir='$(pkglibdir)'; mode='644'; $(install_cmds) -install-pkglibbuildsystem: - @files='$(pkglibbuildsystem)'; dir='$(pkglibbuildsystemdir)'; \ - mode='644'; $(install_cmds) -install-data: all-data install-man1 install-locale install-archtab -install-man1: - @files='$(man1)'; dir='$(man1dir)'; mode='644'; $(install_cmds) -install-locale: - @mkdir -p '$(DESTDIR)/$(localedir)' - @set -e; for f in $(locale); do \ - printf ' INSTALL %s\n' "$${f}"; \ - ff="$${f#*/}"; \ - dd="$(DESTDIR)/$(localedir)/$${ff%.ms}/LC_MESSAGES"; \ - mkdir -p "$${dd}"; \ - df="$${dd}/$(textdomain).ms"; \ - cp "$${f}" "$${df}"; \ - chmod 644 "$${df}"; \ - done -install-archtab: - @mkdir -p '$(DESTDIR)/$(archtabdir)' - @set -e; for f in $(archtab); do \ - printf ' INSTALL %s\n' "$${f}"; \ - ff="$${f#*/}"; \ - mkdir -p "$(DESTDIR)/$(archtabdir)/$${ff%/?*}"; \ - cp "$(srcdir)/$${f}" "$(DESTDIR)/$(archtabdir)/$${ff}"; \ - chmod 644 "$(DESTDIR)/$(archtabdir)/$${ff}"; \ - done - -uninstall_cmds = \ - set -e; \ - for f in $${files}; do \ - printf ' RM %s\n' "$${f}"; \ - ff="$$(basename "$${f}")"; \ - rm -f "$(DESTDIR)/$${dir}/$${ff}"; \ - done -uninstall: uninstall-exec uninstall-data -uninstall-exec: uninstall-bin uninstall-pkglibbuildsystem uninstall-pkglib -uninstall-bin: - @files='$(bin)'; dir='$(bindir)'; $(uninstall_cmds) -uninstall-pkglib: - @files='$(pkglib)'; dir='$(pkglibdir)'; $(uninstall_cmds) - @rmdir '$(DESTDIR)/$(pkglibdir)' -uninstall-pkglibbuildsystem: - @files='$(pkglibbuildsystem)'; dir='$(pkglibbuildsystemdir)'; \ - $(uninstall_cmds) - @rmdir '$(DESTDIR)/$(pkglibbuildsystemdir)' -uninstall-data: uninstall-man1 uninstall-locale uninstall-archtab -uninstall-man1: - @files='$(man1)'; dir='$(man1dir)'; $(uninstall_cmds) -uninstall-locale: - @set -e; for f in $(locale); do \ - printf ' RM %s\n' "$${f}"; \ - ff="$${f#*/}"; \ - dd="$(DESTDIR)/$(localedir)/$${ff%.ms}/LC_MESSAGES"; \ - df="$${dd}/$(textdomain).ms)"; \ - rm -f "$${df}"; \ - done -uninstall-archtab: - @set -e; for f in $(archtab); do \ - printf ' RM %s\n' "$${f}"; \ - ff="$${f#*/}"; \ - rm -f "$(DESTDIR)/$(archtabdir)/$${ff}"; \ - rmdir "$(DESTDIR)/$(archtabdir)/$${ff%/?*}" 2>/dev/null || \ - true; \ - done - @rmdir '$(DESTDIR)/$(archtabdir)' - @rmdir '$(DESTDIR)/$(pkgdatadir)' - -test: - @set -e; \ - mkdir -p tests; \ - cd tests; \ - . ./testlib.sh; \ - PATH="$${PATH}:$(DESTDIR)/$(bindir)"; \ - t_all=0; t_failed=0; \ - for t_test in $(tests); do \ - t_fail='false'; \ - . "$(srcdir)/$${t_test}" >out 2>&1; \ - if "$${t_fail}"; then \ - printf 'FAIL: %s\n' "$${t_test#tests/}"; \ - cat out | sed 's/^/ /'; \ - t_failed=$$(($$t_failed + 1)); \ - else \ - printf 'PASS: %s\n' "$${t_test#tests/}"; \ - fi; \ - t_all=$$(($$t_all + 1)); \ - rm out; \ - done; \ - t_banner="$$(printf '%d out of %d tests failed' \ - $${t_failed} $${t_all})"; \ - t_l=$$(printf '%s\n' "$${t_banner}" | wc -c); \ - t_i=1; while [ "$${t_i}" -lt "$${t_l}" ]; do \ - printf '='; \ - t_i=$$(($$t_i + 1)); \ - done; \ - printf '\n%s\n' "$${t_banner}"; \ - t_i=1; while [ "$${t_i}" -lt "$${t_l}" ]; do \ - printf '='; \ - t_i=$$(($$t_i + 1)); \ - done; \ - printf '\n'; \ - [ $${t_failed} -eq 0 ] - -$(distdir): - @mkdir -p '$(distdir)' - @set -e; for f in $(distfiles); do \ - mkdir -p "$(distdir)/$$(dirname $${f})"; \ - cp -p "$${f}" "$(distdir)/$${f}"; \ - done - -dist dist-gzip: $(distdir) - @tar -cf - '$(distdir)' | gzip -9c > '$(distdir).tar.gz' - @rm -Rf '$(distdir)' - -dist-bzip2: $(distdir) - @tar -cf - '$(distdir)' | bzip2 -9c > '$(distdir).tar.bz2' - @rm -Rf '$(distdir)' - -dist-xz: $(distdir) - @tar -cf - '$(distdir)' | xz -c > '$(distdir).tar.xz' - @rm -Rf '$(distdir)' diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/NEWS diff --git a/archtab/local.mk b/archtab/local.mk index 0841263..b773c33 100644 --- a/archtab/local.mk +++ b/archtab/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -archtab_srcs = \ +archtab_sources = \ archtab/amd64-linux-glibc/autoconf \ archtab/amd64-linux-glibc/kbuild \ archtab/i686-linux-glibc/autoconf \ diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..c90bb39 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +srcdir="${0%/*}" + +{( + cd "${srcdir}" + [ -d build-aux ] || mkdir build-aux + aclocal + autoconf + automake --add-missing --copy +)} + +"${srcdir}/configure" "${@}" diff --git a/configure b/configure deleted file mode 100755 index 5687863..0000000 --- a/configure +++ /dev/null @@ -1,344 +0,0 @@ -#! /bin/sh -# -# opkhelper -# configure -# Configuration script to generate Makefile. -# -# Copyright (C) 2011-2013 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 . - -package_name='opkhelper' -package_version='3.0.0-beta4' -package_description='OPK Build Helper Tools' -package_library='libopkhelper.3.0' - -srcdir="$(cd "${0%/*}" && pwd)" -prefix='/usr/local' -bindir='${prefix}/bin' -libdir='${prefix}/share' -pkglibdir='${libdir}/${package_library}' -datadir='${prefix}/share' -mandir='${datadir}/man' -man1dir='${mandir}/man1' -localedir='${datadir}/locale' -pkgdatadir='${datadir}/${package_name}' -archtabdir='${pkgdatadir}/archtab' -multiarch_libdir='true' - -quiet='false' -missing_deps='false' -dep_cmds=' -sh -make -' -dep_libs=' -' - -long_opts_with_args=' -srcdir -prefix -bindir -libdir -pkglibdir -datadir -mandir -man1dir -localedir -pkgdatadir -archtabdir -' - -features=" -${dep_cmds} -${dep_libs} -${opt_dep_cmds} -${opt_dep_libs} -multiarch-libdir -" - -subst_vars=" -package_name -package_version -package_description -package_library -${long_opts_with_args} -${features} -" - -main() -{ - parse_options "${@}" - shift ${optind} - if [ ${#} -ne 0 ]; then - print_usage - exit - fi - - for dep in ${dep_cmds}; do - dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" - dep_val="$(eval echo \$\{"${dep_name}"\})" - if [ -z "${dep_val}" ]; then - find_dep_cmd "${dep}" || missing_deps='true' - fi - done - for dep in ${dep_libs}; do - dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" - dep_val="$(eval echo \$\{"${dep_name}"\})" - if [ -z "${dep_val}" ]; then - find_dep_lib "${dep}" || missing_deps='true' - fi - done - for dep in ${opt_dep_cmds}; do - dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" - dep_val="$(eval echo \$\{"${dep_name}"\})" - if [ -z "${dep_val}" ]; then - find_dep_cmd "${dep}" - fi - done - for dep in ${opt_dep_libs}; do - dep_name="$(printf '%s' "${dep}" | tr -c '[a-z0-9]' '_')" - dep_val="$(eval echo \$\{"${dep_name}"\})" - if [ -z "${dep_val}" ]; then - find_dep_lib "${dep}" - fi - done - - if ${missing_deps}; then - cat <. -This configure script is free software: you can redistribute and/or modify it. -There is NO WARRANTY, to the extent permitted by law. -EOF -} - -parse_options() -{ - optind=0 - - for _opt; do - - # Handle arguments of "--opt arg" options. - if [ -n "${_prev}" ]; then - eval "${_prev}"=\"\$\{_opt\}\" - _prev='' - continue - fi - - # Detect "--opt=arg" and "--opt arg" options. - case "${_opt}" in - *=*) - _optarg="${_opt#*=}" - _opt="${_opt%=*}" - _optarg_set='true' - ;; - *) - _optarg_set='false' - ;; - esac - - # Handle short and long options. - case "${_opt}" in - --) - break - ;; - -h|--help) - print_help - exit 0 - ;; - -V|--version) - print_version - exit 0 - ;; - -q|--quiet) - quiet='true' - continue - ;; - esac - - # Anything beyond this point should be a long option. - case "${_opt}" in - --with-*) - _opt="${_opt#--with-}" - _opts="${features}" - _type='package' - ;; - --*) - _opt="${_opt#--}" - _opts="${long_opts_with_args}" - _type='option' - ;; - *) - break - ;; - esac - - grep "^${_opt}\$" >/dev/null 2>&1 <&2 - continue - fi - if ${_optarg_set}; then - _opt="$(printf '%s' "${_opt}" | tr -c '[a-z0-9]' '_')" - eval "${_opt}"=\"\$\{_optarg\}\" - else - _prev="${_opt}" - fi - - optind=$(($optind + 1)) - - done -} - -find_dep_cmd() -{ - _dep="${1}" - - ${quiet} || printf 'checking for %s... ' "${_dep}" - - IFS=':' - - for _element in ${PATH}; do - unset IFS - : ${_element=-.} - if [ -f "${_element}/${_dep}" -a -x "${_element}/${_dep}" ]; then - ${quiet} || printf '%s/%s\n' "${_element}" "${_dep}" - _var="$(printf '%s' "${_dep}" | tr -c '[a-z0-9]' '_')" - eval "${_var}"=\"${_element}/${_dep}\" - return 0 - fi - done - - unset IFS - - ${quiet} || printf 'not found\n' - return 1 -} - -find_dep_lib() -{ - _dep="${1}" - - ${quiet} || printf 'checking for %s... ' "${_dep}" - - IFS=':' - - for _element in $(eval echo "${libdir}") ${PATH}; do - unset IFS - : ${_element=-.} - if [ -d "${_element}/${_dep}" ]; then - ${quiet} || printf '%s/%s\n' "${_element}" "${_dep}" - _var="$(printf '%s' "${_dep}" | tr -c '[a-z0-9]' '_')" - eval "${_var}"=\"${_element}/${_dep}\" - return 0 - fi - done - - unset IFS - - ${quiet} || printf 'not found\n' - return 1 -} - -write_makefiles() -{ - for _dir in src lib lib/buildsystem locale man; do - [ -d "${_dir}" ] || mkdir "${_dir}" - done - - # Make a script to edit input makefiles. - _sed_script='' - for _var in ${subst_vars}; do - _var="$(printf '%s' "${_var}" | tr -c '[a-z0-9]' '_')" - _sed_script="${_sed_script}s&@${_var}@&$(eval echo \$\{"${_var}"\})&g;" - done - sed "${_sed_script}" "${srcdir}/Makefile.in" >'Makefile' -} - -main "${@}" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..2d945d6 --- /dev/null +++ b/configure.ac @@ -0,0 +1,75 @@ +# Process this file with autoconf to produce a configure script. +# +# Copyright (C) 2013, 2014 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 3 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 . + +AC_INIT([OPK Build Helper Tools], [3.0.0-beta4], + [mailto:proteanos-dev@lists.proteanos.com], [opkhelper], + [http://www.proteanos.com/dev/opkhelper/]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_SRCDIR([src/oh-installfiles.sh]) + +AM_INIT_AUTOMAKE([gnu dist-bzip2 dist-xz subdir-objects]) + +AC_ARG_WITH( + [sh], + [AS_HELP_STRING([--with-sh], [POSIX-conformant shell with `local'])], + dnl This `dnl' is needed to workaround Vim syntax highlighting. + [ + case "${withval}" in + 'yes'|'') + AC_MSG_ERROR([--with-sh requires an argument]) + ;; + 'no') + AC_MSG_ERROR([sh is required]) + ;; + *) + SH="${withval}" + ;; + esac + ], + [ + AC_PATH_PROG([SH], [sh]) + if test -z "${SH}"; then + AC_MSG_ERROR([sh not found]) + fi + ] +) + +AC_ARG_ENABLE( + [multiarch-libdir], + [AS_HELP_STRING( + [--disable-multiarch-libdir], + [do not use multiarch library paths in packages] + )], + [ + opt='multiarch-libdir' + case "${enableval}" in + 'yes'|'no') ;; + *) AC_MSG_ERROR( + [bad value `${enableval}' for ${opt} option]) ;; + esac + dnl This `dnl' is needed to workaround Vim syntax highlighting. + multiarch_libdir="${enableval}" + ], + [ + multiarch_libdir='yes' + ] +) + +AC_SUBST([SH]) +AC_SUBST([multiarch_libdir]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT() diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh index ffdba86..0369700 100644 --- a/lib/buildsystem.sh +++ b/lib/buildsystem.sh @@ -155,7 +155,7 @@ oh_buildsystem_arch() fi # Try to find a suitable build system host arch. - for bs_arch in $(cat '@@ARCHTABDIR@@/'"${arch}/${system}") + for bs_arch in $(cat '@archtabdir@/'"${arch}/${system}") do if oh_buildsystem_do 'testarch' "${system}" "${bs_arch}" then diff --git a/lib/buildsystem/autoconf.sh b/lib/buildsystem/autoconf.sh index 7ec8938..716ebca 100644 --- a/lib/buildsystem/autoconf.sh +++ b/lib/buildsystem/autoconf.sh @@ -48,7 +48,7 @@ _oh_autoconf_configure() "${_OH_BUILDSYSTEM_TARGET_ARCH}" 'autoconf')" fi - if [ '@@MULTIARCH_LIBDIR@@' = 'true' ]; then + if [ '@multiarch_libdir@' = 'yes' ]; then libdir='${prefix}/lib/'"${OPK_HOST_ARCH}" else libdir='${prefix}/lib/' diff --git a/lib/buildsystem/local.mk b/lib/buildsystem/local.mk index 76cf972..bacf27d 100644 --- a/lib/buildsystem/local.mk +++ b/lib/buildsystem/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -pkglibbuildsystem_srcs = \ +pkgdatabuildsystem_sources = \ lib/buildsystem/autoconf.sh \ lib/buildsystem/kbuild.sh \ lib/buildsystem/make.sh diff --git a/lib/load.sh b/lib/load.sh index a21ca52..d537b4b 100644 --- a/lib/load.sh +++ b/lib/load.sh @@ -22,7 +22,7 @@ _OH_LOAD_SM=1 # 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. -. '@@PKGLIBDIR@@/common.sm' +. '@pkgdatadir@/common.sm' oh_use() { @@ -34,7 +34,7 @@ oh_use() return 125 fi - module='@@PKGLIBDIR@@'"/${module}.sm" + module='@pkgdatadir@'"/${module}.sm" if [ -r "${module}" ]; then . "${module}" else diff --git a/lib/local.mk b/lib/local.mk index 0f7c62d..53a3ff8 100644 --- a/lib/local.mk +++ b/lib/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -pkglib_srcs = \ +pkgdata_sources = \ lib/load.sh \ lib/common.sh \ lib/output.sh \ diff --git a/lib/locale.sh b/lib/locale.sh index 1ac543b..5601364 100644 --- a/lib/locale.sh +++ b/lib/locale.sh @@ -24,7 +24,7 @@ oh_use output _OH_DEFAULT_LOCALE='en_US' _OH_TEXT_DOMAIN='opkhelper' -_OH_LOCALE_PATH='@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms' +_OH_LOCALE_PATH='@localedir@/%s/LC_MESSAGES/%s.ms' oh_load_locale() { diff --git a/locale/local.mk b/locale/local.mk index eeddd03..e490e60 100644 --- a/locale/local.mk +++ b/locale/local.mk @@ -16,5 +16,5 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -locale_srcs = \ +locale_sources = \ locale/en_US.sh diff --git a/man/local.mk b/man/local.mk index 808e325..0e88e68 100644 --- a/man/local.mk +++ b/man/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -man1_srcs = \ +man1_sources = \ man/oh-installfiles.1in \ man/oh-strip.1in \ man/oh-fixperms.1in \ diff --git a/man/oh-architecture.1in b/man/oh-architecture.1in index fbe42b2..73d6c0c 100644 --- a/man/oh-architecture.1in +++ b/man/oh-architecture.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-architecture 1 \ -"2012-11-15" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-11-15" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-architecture \- Print build system architecture names. diff --git a/man/oh-autobuild.1in b/man/oh-autobuild.1in index a3a43bc..cb425dd 100644 --- a/man/oh-autobuild.1in +++ b/man/oh-autobuild.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-autobuild 1 \ -"2012-11-14" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-11-14" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-autobuild \- Automatically build a package. diff --git a/man/oh-autoclean.1in b/man/oh-autoclean.1in index 1f45132..be80640 100644 --- a/man/oh-autoclean.1in +++ b/man/oh-autoclean.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-autoclean 1 \ -"2012-11-14" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-11-14" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-autoclean \- Automatically clean up a package's built files. diff --git a/man/oh-autoconfigure.1in b/man/oh-autoconfigure.1in index ef19201..000da60 100644 --- a/man/oh-autoconfigure.1in +++ b/man/oh-autoconfigure.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-autoconfigure 1 \ -"2012-11-15" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-11-15" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-autoconfigure \- Automatically configure a package to be built. diff --git a/man/oh-autoinstall.1in b/man/oh-autoinstall.1in index 10affef..6a14487 100644 --- a/man/oh-autoinstall.1in +++ b/man/oh-autoinstall.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-autoinstall 1 \ -"2012-11-14" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-11-14" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-autoinstall \- Automatically install a package's data files. diff --git a/man/oh-autotest.1in b/man/oh-autotest.1in index dc3808b..4400d96 100644 --- a/man/oh-autotest.1in +++ b/man/oh-autotest.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-autotest 1 \ -"2012-10-22" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-10-22" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-autotest \- Automatically run a package's test suites. diff --git a/man/oh-fixperms.1in b/man/oh-fixperms.1in index 70a3e9e..bc3addc 100644 --- a/man/oh-fixperms.1in +++ b/man/oh-fixperms.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-fixperms 1 \ -"2012-10-22" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-10-22" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-fixperms \- Fix permissions and ownerships of data files. diff --git a/man/oh-installfiles.1in b/man/oh-installfiles.1in index 68434b9..9dd9615 100644 --- a/man/oh-installfiles.1in +++ b/man/oh-installfiles.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-installfiles 1 \ -"2012-10-21" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-10-21" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-installfiles \- Install files into binary package data directories. diff --git a/man/oh-strip.1in b/man/oh-strip.1in index 52d75f3..02c46c0 100644 --- a/man/oh-strip.1in +++ b/man/oh-strip.1in @@ -1,6 +1,6 @@ .\" Author: Patrick "P. J." McDermott .TH oh-strip 1 \ -"2012-10-21" "@@PACKAGE_NAME@@-@@PACKAGE_VERSION@@" "@@PACKAGE_DESCRIPTION@@" +"2012-10-21" "@PACKAGE@ @PACKAGE_VERSION@" "@PACKAGE_NAME@" .SH NAME oh-strip \- Strip binary objects of symbols. diff --git a/src/local.mk b/src/local.mk index 84c8f4d..970704f 100644 --- a/src/local.mk +++ b/src/local.mk @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -bin_srcs = \ +bin_sources = \ src/oh-installfiles.sh \ src/oh-strip.sh \ src/oh-fixperms.sh \ diff --git a/src/oh-architecture.sh b/src/oh-architecture.sh index 003b625..9f5593f 100644 --- a/src/oh-architecture.sh +++ b/src/oh-architecture.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-architecture @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-autobuild.sh b/src/oh-autobuild.sh index cc365bc..d647afe 100644 --- a/src/oh-autobuild.sh +++ b/src/oh-autobuild.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-autobuild @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-autoclean.sh b/src/oh-autoclean.sh index b57b6f1..ad935f0 100644 --- a/src/oh-autoclean.sh +++ b/src/oh-autoclean.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-autoclean @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-autoconfigure.sh b/src/oh-autoconfigure.sh index af18b87..af24f3b 100644 --- a/src/oh-autoconfigure.sh +++ b/src/oh-autoconfigure.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-autoconfigure @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-autoinstall.sh b/src/oh-autoinstall.sh index 6dbb532..25c1c44 100644 --- a/src/oh-autoinstall.sh +++ b/src/oh-autoinstall.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-autoinstall @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-autotest.sh b/src/oh-autotest.sh index f11414d..2061ece 100644 --- a/src/oh-autotest.sh +++ b/src/oh-autotest.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-autotest @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' oh_use buildsystem diff --git a/src/oh-fixperms.sh b/src/oh-fixperms.sh index 71dda4d..b5657a5 100644 --- a/src/oh-fixperms.sh +++ b/src/oh-fixperms.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-fixperms @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' main() { diff --git a/src/oh-installfiles.sh b/src/oh-installfiles.sh index 5b9926f..4505ac5 100644 --- a/src/oh-installfiles.sh +++ b/src/oh-installfiles.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-installfiles @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' CR=' ' diff --git a/src/oh-strip.sh b/src/oh-strip.sh index 4217099..9dbd5f4 100644 --- a/src/oh-strip.sh +++ b/src/oh-strip.sh @@ -1,4 +1,4 @@ -#!@@SH@@ +#!@SH@ # # opkhelper # src/oh-strip @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. '@@PKGLIBDIR@@/load.sm' +. '@pkgdatadir@/load.sm' CR=' ' -- cgit v0.9.1