diff options
-rw-r--r-- | Makefile.in | 47 | ||||
-rwxr-xr-x | autogen.sh | 26 | ||||
-rwxr-xr-x | configure | 342 | ||||
-rw-r--r-- | configure.ac | 132 |
4 files changed, 182 insertions, 365 deletions
diff --git a/Makefile.in b/Makefile.in index e8201b8..edd7275 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,33 +17,34 @@ # 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@ -package_description = @package_description@ -package_library = @package_library@ +package_name = @PACKAGE_NAME@ +package_version = @PACKAGE_VERSION@ +package_description = @PACKAGE_DESCRIPTION@ +package_library = @PACKAGE_LIBRARY@ srcdir = @srcdir@ prefix = @prefix@ +exec_prefix = @prefix@ bindir = @bindir@ libdir = @libdir@ -pkglibdir = @pkglibdir@ +pkglibdir = $(libdir)/@PACKAGE_LIBRARY@ datadir = @datadir@ mandir = @mandir@ -man1dir = @man1dir@ -man3dir = @man3dir@ +man1dir = $(mandir)/man1 +man3dir = $(mandir)/man3 localedir = @localedir@ sysconfdir = @sysconfdir@ DESTDIR = / -sh = @sh@ -opkg = @opkg@ +sh = @SH@ +opkg = @OPKG@ -metadata = @metadata@ +metadata = @METADATA@ pkglibpackagedir = $(pkglibdir)/package pkglibmetadatadir = $(pkglibdir)/metadata -pkgdatadir = $(datadir)/$(package_name) +pkgdatadir = $(datadir)/@PACKAGE_NAME@ helperdir = $(pkgdatadir)/helpers include $(srcdir)/src/local.mk @@ -97,18 +98,18 @@ distfiles = \ $(tests_data) script = \ - s&@@PACKAGE_NAME@@&$(package_name)&;\ - s&@@PACKAGE_VERSION@@&$(package_version)&;\ - s&@@PACKAGE_DESCRIPTION@@&$(package_description)&;\ - s&@@BINDIR@@&$(bindir)&;\ - s&@@PKGLIBDIR@@&$(pkglibdir)&;\ - s&@@DATADIR@@&$(datadir)&;\ - s&@@LOCALEDIR@@&$(localedir)&;\ - s&@@SYSCONFDIR@@&$(sysconfdir)&;\ - s&@@HELPERDIR@@&$(helperdir)&;\ - s&@@SH@@&$(sh)&;\ - s&@@OPKG@@&$(opkg)&;\ - s&@@METADATA@@&$(metadata)&;\ + s&@[@]PACKAGE_NAME@@&$(package_name)&;\ + s&@[@]PACKAGE_VERSION@@&$(package_version)&;\ + s&@[@]PACKAGE_DESCRIPTION@@&$(package_description)&;\ + s&@[@]BINDIR@@&$(bindir)&;\ + s&@[@]PKGLIBDIR@@&$(pkglibdir)&;\ + s&@[@]DATADIR@@&$(datadir)&;\ + s&@[@]LOCALEDIR@@&$(localedir)&;\ + s&@[@]SYSCONFDIR@@&$(sysconfdir)&;\ + s&@[@]HELPERDIR@@&$(helperdir)&;\ + s&@[@]SH@@&$(sh)&;\ + s&@[@]OPKG@@&$(opkg)&;\ + s&@[@]METADATA@@&$(metadata)&;\ .SUFFIXES: .SUFFIXES: .sh .sm .1in .1 .3in .3 .ms diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..2051523 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# Script to generate the build system. +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +set -e + +srcdir="${0%/*}" + +{( + cd "${srcdir}" + [ -d build-aux ] || mkdir build-aux + cat >ChangeLog <<-EOF +This file is generated upon release. Run \`git log\` for a list of changes. +EOF + aclocal + autoconf +)} + +"${srcdir}/configure" "${@}" diff --git a/configure b/configure deleted file mode 100755 index 94d1177..0000000 --- a/configure +++ /dev/null @@ -1,342 +0,0 @@ -#! /bin/sh -# -# opkbuild -# 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 <http://www.gnu.org/licenses/>. - -package_name='opkbuild' -package_version='3.0.0-beta7' -package_description='Distribution Build System' -package_library='libopkbuild.1' - -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' -man3dir='${mandir}/man3' -localedir='${datadir}/locale' -sysconfdir='/etc' -metadata='proteanos' - -quiet='false' -missing_deps='false' -dep_cmds=' -sh -make -opkg -' -opt_dep_libs=' -' - -long_opts_with_args=' -srcdir -prefix -bindir -libdir -pkglibdir -datadir -mandir -man1dir -man3dir -localedir -sysconfdir -' - -features=" -${dep_cmds} -${dep_libs} -${opt_dep_cmds} -${opt_dep_libs} -metadata -" - -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 <<EOF - -Some dependencies could not be found. -Please make sure all dependencies are installed and try again. - -EOF - exit 1 - fi - - write_makefiles - - printf '\nConfiguration complete!\n\n' -} - -print_usage() -{ - printf 'Usage: %s [OPTION]...\n' "${0}" -} - -print_help() -{ - cat <<EOF -\`configure' configures ${package_name} ${package_version} to adapt to many \ -kinds of systems. - -$(print_usage) - -Configuration: - -h, --help display this help and exit - -V, --version display version information and exit - -q, --quiet do not print \`checking ...' messages - --srcdir=SRCDIR find the sources in SRCDIR - default: configure dir - -Installation directories: - --prefix=PREFIX install files under PREFIX - default: /usr/local - --bindir=BINDIR install scripts in BINDIR - default: PREFIX/bin - --libdir=LIBDIR install library scripts in LIBDIR - default: PREFIX/share - --pkglibdir=PKGLIBDIR install package library scripts in PKGLIBDIR - default: LIBDIR/${package_library} - --datadir=DATADIR expect to find data in DATADIR - default: PREFIX/share - --mandir=MANDIR install manual pages in MANDIR - default: DATADIR/man - --man1dir=MAN1DIR install section 1 manual pages in MAN1DIR - default: MANDIR/man1 - --man3dir=MAN1DIR install section 3 manual pages in MAN3DIR - default: MANDIR/man3 - --localedir=LOCALEDIR install locales in LOCALEDIR - default: DATADIR/locale - --sysconfdir=SYSCONFDIR install system configuration in SYSCONFDIR - default: /etc - -Features: - --with-metadata=SYSTEM use SYSTEM metadata plugin - default: proteanos - -Dependencies: - --with-sh=PATH use sh at PATH - --with-opkg=PATH use opkg at PATH -EOF -} - -print_version() -{ - cat <<EOF -${package_name} ${package_version} configure -Not generated by GNU Autoconf - -Copyright (C) 2011-2013 Patrick "P. J." McDermott -License: GNU GPL version 2 or later <http://www.gnu.org/licenses/gpl.html>. -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 <<EOF -"${_opts}" -EOF - if [ ${?} -ne 0 ]; then - printf 'warning: unrecognized %s name: %s\n' \ - "${_type}" "${_opt}" >&2 - elif ${_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}" - - for _element in $(eval echo "${libdir}") ${PATH}; do - : ${_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 - - ${quiet} || printf 'not found\n' - return 1 -} - -write_makefiles() -{ - mkdir -p src lib lib/package lib/metadata locale man tests - - # 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' - - # New and improved kludge to generate system configuration for testing. - # TODO: Remove when no longer used. - sed "${_sed_script}" "${srcdir}/mksysconf.in" >'mksysconf' - chmod 755 'mksysconf' -} - -main "${@}" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..5429166 --- /dev/null +++ b/configure.ac @@ -0,0 +1,132 @@ +# Process this file with autoconf to produce a configure script. +# +# Copyright (C) 2013, 2018 Patrick McDermott +# +# This file is part of opkbuild. +# +# opkbuild 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. +# +# opkbuild 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 opkbuild. If not, see <http://www.gnu.org/licenses/>. + +AC_INIT([opkbuild], [3.0.0-beta7], + [mailto:proteanos-dev@lists.proteanos.com], [opkbuild], + [http://www.proteanos.com/dev/pro-archman/]) +AC_SUBST([PACKAGE_DESCRIPTION], ['Distribution Build System']) +AC_SUBST([PACKAGE_LIBRARY], ['libopkbuild.1']) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_SRCDIR([src/opkbuild.sh]) + +AC_ARG_WITH( + [sh], + [AS_HELP_STRING([--with-sh=PATH], + [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}" + AC_SUBST([SH]) + ;; + esac + ], + [ + AC_PATH_PROG([SH], [sh]) + if test -z "${SH}"; then + AC_MSG_ERROR([sh not found]) + fi + ] +) + +AC_ARG_WITH( + [make], + [AS_HELP_STRING([--with-make=PATH], [path to make utility])], + [ + case "${withval}" in + 'yes'|'') + AC_MSG_ERROR([--with-make requires an argument]) + ;; + 'no') + AC_MSG_ERROR([make is required]) + ;; + *) + MAKE="${withval}" + AC_SUBST([MAKE]) + ;; + esac + ], + [ + AC_PATH_PROG([MAKE], [make]) + if test -z "${MAKE}"; then + AC_MSG_ERROR([make not found]) + fi + ] +) + +AC_ARG_WITH( + [opkg], + [AS_HELP_STRING([--with-opkg=PATH], [path to opkg utility])], + [ + case "${withval}" in + 'yes'|'') + AC_MSG_ERROR([--with-opkg requires an argument]) + ;; + 'no') + AC_MSG_ERROR([opkg is required]) + ;; + *) + OPKG="${withval}" + AC_SUBST([OPKG]) + ;; + esac + ], + [ + AC_PATH_PROG([OPKG], [opkg]) + if test -z "${OPKG}"; then + AC_MSG_ERROR([opkg not found]) + fi + ] +) + +AC_ARG_WITH( + [metadata], + [AS_HELP_STRING([--with-metadata=SYSTEM], + [use SYSTEM metadata plugin \[default: proteanos\]])], + [ + case "${withval}" in + 'yes'|'') + AC_MSG_ERROR([--with-metadata requires an + argument]) + ;; + 'no') + AC_MSG_ERROR([a metadata plugin is required]) + ;; + *) + AC_SUBST([METADATA], ["${withval}"]) + ;; + esac + ], + [ + AC_SUBST([METADATA], ['proteanos']) + ] +) + +AC_CONFIG_FILES([Makefile]) +dnl New and improved kludge to generate system configuration for testing. +dnl TODO: Remove when no longer used. +AC_CONFIG_FILES([mksysconf]) +AC_OUTPUT() |