summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-11-07 20:00:42 (EST)
committer P. J. McDermott <pjm@nac.net>2012-11-07 20:00:42 (EST)
commitbcc1d7910f668b76c53606df892b27b39522fdaa (patch)
tree92c60a8e7d6b1b37b179222ba4c406790f4985da
parente77b32854807af6ce6b532996380d2a6a09d1ba3 (diff)
parent02ff44fe4d963f290347568833846b7d8b5db854 (diff)
Merge branch 'feature/build-sys-arches'.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.in4
-rwxr-xr-xconfigure23
-rw-r--r--lib/Makefile.in4
-rw-r--r--lib/buildsystem.sh18
-rw-r--r--lib/buildsystem/autoconf.sh23
-rw-r--r--man/oh-autoconfigure.1.in4
-rw-r--r--mkarchtab.in79
-rw-r--r--src/oh-autoconfigure.sh3
9 files changed, 146 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 8a6293e..347e204 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ Session.vim
# Generated files
Makefile
+mkarchtab
src/*[^.]??
lib/*.sm
lib/*/*.sm
diff --git a/Makefile.in b/Makefile.in
index acbf392..ab1ddb6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -32,6 +32,7 @@ libopkbuild_1 = @libopkbuild_1@
DESTDIR = /
sh = @sh@
+archtab = @archtab@
MACROS = \
'DESTDIR=$(DESTDIR)' \
@@ -41,7 +42,8 @@ MACROS = \
'datadir=$(datadir)' \
'mandir=$(mandir)' \
'libopkhelper=$(libopkhelper)' \
- 'libopkbuild_1=$(libopkbuild_1)'
+ 'libopkbuild_1=$(libopkbuild_1)' \
+ 'archtab=$(archtab)'
distdir = $(package_name)-$(package_version)
distfiles = configure Makefile.in COPYING.2 COPYING.3 \
diff --git a/configure b/configure
index f39846a..4427908 100755
--- a/configure
+++ b/configure
@@ -25,20 +25,22 @@ package_description='OPK Build Helper Tools'
srcdir="$(cd "${0%/*}" && pwd)"
prefix='/usr/local'
-bindir='$(prefix)/bin'
-libdir='$(prefix)/share'
-datadir='$(prefix)/share'
-mandir='$(datadir)/man'
-localedir='$(datadir)/locale'
-libopkhelper='$(libdir)/libopkhelper.3.0'
+bindir='${prefix}/bin'
+libdir='${prefix}/share'
+datadir='${prefix}/share'
+mandir='${datadir}/man'
+localedir='${datadir}/locale'
+libopkhelper='${libdir}/libopkhelper.3.0'
quiet='false'
missing_deps='false'
dep_cmds='
sh
+make
'
dep_libs='
libopkbuild.1
+archtab
'
long_opts_with_args='
@@ -158,6 +160,7 @@ Dependencies:
--with-sh=PATH use sh at PATH
--with-libopkbuild.1=PATH
use libopkbuild.1 at PATH
+ --with-archtab=PATH use archtab at PATH
EOF
}
@@ -286,10 +289,10 @@ find_dep_lib()
IFS=':'
- for _element in ${libdir}:${PATH}; do
+ for _element in $(eval echo "${libdir}") ${PATH}; do
unset IFS
: ${_element=-.}
- if [ -f "${_element}/${_dep}" -a -x "${_element}/${_dep}" ]; then
+ if [ -d "${_element}/${_dep}" ]; then
${quiet} || printf '%s/%s\n' "${_element}" "${_dep}"
eval "${_dep}"=\"${_element}/${_dep}\"
return 0
@@ -315,6 +318,10 @@ write_makefiles()
mkdir -p "${_dir}"
sed "${_sed_script}" "${srcdir}/${_dir}/Makefile.in" >"${_dir}/Makefile"
done
+
+ # New and improved kludge to generate an architecture table for testing.
+ # TODO: Remove when no longer used.
+ sed "${_sed_script}" "${srcdir}/mkarchtab.in" >'mkarchtab'
}
main "${@}"
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 5c2a6f9..f52a0b3 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -27,12 +27,14 @@ datadir = @datadir@
localedir = @localedir@
libopkhelper = @libopkhelper@
libopkbuild_1 = @libopkbuild_1@
+archtab = @archtab@
sed_script = s&@@PACKAGE_NAME@@&$(package_name)&;\
s&@@PACKAGE_VERSION@@&$(package_version)&;\
s&@@LOCALEDIR@@&$(localedir)&;\
s&@@LIBOPKHELPER@@&$(libopkhelper)&;\
- s&@@LIBOPKBUILD_1@@&$(libopkbuild_1)&;
+ s&@@LIBOPKBUILD_1@@&$(libopkbuild_1)&;\
+ s&@@ARCHTAB@@&$(archtab)&;
.SUFFIXES:
.SUFFIXES: .sh .sm
diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh
index 7cf70f5..0f9b8b0 100644
--- a/lib/buildsystem.sh
+++ b/lib/buildsystem.sh
@@ -66,6 +66,9 @@ oh_set_buildsystem_option()
'build-system')
_OH_BUILDSYSTEM_SYSTEM="${_ohsbso_value}"
;;
+ 'target-arch')
+ _OH_BUILDSYSTEM_TARGET_ARCH="${_ohsbso_value}"
+ ;;
*)
_oh_return 125
return ${?}
@@ -106,3 +109,18 @@ oh_buildsystem_do()
: error
fi
}
+
+oh_buildsystem_arch()
+{
+ _oh_local _ohbsa_arch _ohbsa_system
+
+ if [ ${#} -eq 2 ]; then
+ _ohbsa_arch="${1}"
+ _ohbsa_system="${2}"
+ else
+ _oh_return 125
+ return ${?}
+ fi
+
+ cat '@@ARCHTAB@@/'"${_ohbsa_arch}/${_ohbsa_system}"
+}
diff --git a/lib/buildsystem/autoconf.sh b/lib/buildsystem/autoconf.sh
index 13370ae..a1ae3ea 100644
--- a/lib/buildsystem/autoconf.sh
+++ b/lib/buildsystem/autoconf.sh
@@ -27,9 +27,25 @@ _oh_autoconf_can_configure()
_oh_autoconf_configure()
{
+ _oh_local _ohbsbac_arch_opts
+
mkdir -p "${_OH_BUILDSYSTEM_BUILD_DIR}"
cd "${_OH_BUILDSYSTEM_BUILD_DIR}"
+ _ohbsbac_arch_opts="
+ --build='$(oh_buildsystem_arch "${OPK_BUILD_ARCH}" 'autoconf')'
+ "
+ if [ "${OPK_BUILD_ARCH}" != "${OPK_HOST_ARCH}" ]; then
+ _ohbsbac_arch_opts="${_ohbsbac_arch_opts}
+ --host='$(oh_buildsystem_arch \
+ "${OPK_HOST_ARCH}" 'autoconf')'"
+ fi
+ if [ -n "${_OH_BUILDSYSTEM_TARGET_ARCH}" ]; then
+ _ohbsbac_arch_opts="${_ohbsbac_arch_opts}
+ --target='$(oh_buildsystem_arch \
+ "${_OH_BUILDSYSTEM_TARGET_ARCH}" 'autoconf')'"
+ fi
+
"${_OH_BUILDSYSTEM_SOURCE_DIR}/configure" \
--prefix='/usr' \
--bindir='${prefix}/bin' \
@@ -41,14 +57,15 @@ _oh_autoconf_configure()
--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}") \
+ ${_ohbsbac_arch_opts}
--disable-maintainer-mode \
--disable-dependency-tracking \
"${@}"
cd "${_OH_BUILDSYSTEM_WORK_AREA}"
+
+ _oh_return 0
+ return ${?}
}
_oh_autoconf_can_build()
diff --git a/man/oh-autoconfigure.1.in b/man/oh-autoconfigure.1.in
index 4394e72..423d6d0 100644
--- a/man/oh-autoconfigure.1.in
+++ b/man/oh-autoconfigure.1.in
@@ -29,6 +29,10 @@ instead of trying to detect the one used by the package.
Build in
.I builddir
instead of in the source directory.
+.TP
+.BI \-T \ targetarch
+Build a tool that cross builds for
+.IR targetarch .
.SH COPYRIGHT
Copyright (C) 2012 Patrick "P. J." McDermott
diff --git a/mkarchtab.in b/mkarchtab.in
new file mode 100644
index 0000000..a31a8e3
--- /dev/null
+++ b/mkarchtab.in
@@ -0,0 +1,79 @@
+#!@make@ -f
+# opkhelper
+# mkarchtab.in
+# Input makefile to generate an architecture table for testing.
+#
+# 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@
+bindir = @bindir@
+libdir = @libdir@
+datadir = @datadir@
+mandir = @mandir@
+libopkhelper = @libopkhelper@
+libopkbuild_1 = @libopkbuild_1@
+
+DESTDIR = /
+
+archtab = @archtab@
+
+# New and improved kludge to generate an architecture table for testing.
+# Now 10% less horrible!
+default:
+ @printf 'Generating build system architecture data...\n'
+ @mkdir -p '${archtab}' || \
+ { printf 'Error: Cannot make architecture table directory\n'; exit 1;}
+ @# core-linux-eglibc
+ @mkdir -p '${archtab}/core-linux-eglibc' || \
+ { printf 'Error: Cannot make architecture table directory\n'; exit 1;}
+ @printf 'x86_64-unknown-linux-gnu\n' \
+ >'${archtab}/core-linux-eglibc/autoconf' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @printf 'x86\ni386\n' \
+ >'${archtab}/core-linux-eglibc/kbuild' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @# i686-linux-eglibc
+ @mkdir -p '${archtab}/i686-linux-eglibc' || \
+ { printf 'Error: Cannot make architecture table directory\n'; exit 1;}
+ @printf 'i686-unknown-linux-gnu\n' \
+ >'${archtab}/i686-linux-eglibc/autoconf' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @printf 'x86\ni386\n' \
+ >'${archtab}/i686-linux-eglibc/kbuild' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @# i686-kfreebsd-eglibc
+ @mkdir -p '${archtab}/i686-kfreebsd-eglibc' || \
+ { printf 'Error: Cannot make architecture table directory\n'; exit 1;}
+ @printf 'i686-unknown-freebsd9.0\n' \
+ >'${archtab}/i686-kfreebsd-eglibc/autoconf' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @printf 'x86\ni386\n' \
+ >'${archtab}/i686-kfreebsd-eglibc/kbuild' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @# cortexa8-linux-eglibc
+ @mkdir -p '${archtab}/cortexa8-linux-eglibc' || \
+ { printf 'Error: Cannot make architecture table directory\n'; exit 1;}
+ @printf 'arm-cortex_a8-linux-gnueabi\n' \
+ >'${archtab}/cortexa8-linux-eglibc/autoconf' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @printf 'arm\n' \
+ >'${archtab}/cortexa8-linux-eglibc/kbuild' || \
+ { printf 'Error: Cannot write architecture data\n'; exit 1;}
+ @printf 'Done!\n'
diff --git a/src/oh-autoconfigure.sh b/src/oh-autoconfigure.sh
index cef8e7f..7e28b3e 100644
--- a/src/oh-autoconfigure.sh
+++ b/src/oh-autoconfigure.sh
@@ -35,6 +35,9 @@ main()
B)
oh_set_buildsystem_option 'build-dir' "${OPTARG}"
;;
+ T)
+ oh_set_buildsystem_option 'target-arch' "${OPTARG}"
+ ;;
?)
ob_error "$(ob_get_msg 'bad_opt')"
exit 1