diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | Makefile.d/build-release.mk | 24 | ||||
-rw-r--r-- | config.mk.in | 9 | ||||
-rw-r--r-- | configure.ac | 133 | ||||
-rw-r--r-- | m4/ax_check_compile_flag.m4 | 74 | ||||
-rw-r--r-- | m4/ax_check_link_flag.m4 | 73 |
7 files changed, 268 insertions, 58 deletions
@@ -5,5 +5,7 @@ /libreboot-* /configure -/config.log +/config.mk +/config.status +/*.log /autom4te.cache/ @@ -1,8 +1,8 @@ -VERSION := $(shell if test -f version.txt; then cat version.txt; else git describe; fi) +-include config.mk host_arch := $(shell uname -m) export SHARED=0 -export CC = gcc -static $(if $(findstring i686,$@),-m32) +export CC = gcc $(if $(MAINTAINER_MODE),-static) $(if $(findstring i686,$@),-m32,-m64) # Just for convenience keymapdir = resources/utilities/grub-assemble/keymap @@ -28,7 +28,7 @@ roms = $(foreach board,$(boards),\ all: PHONY build -build: PHONY roms tools # $(addprefix tools-,$(arches)) +build: PHONY roms $(if $(MAINTAINER_MODE),$(addprefix tools-,$(arches)),tools) roms: PHONY $(foreach rom,$(roms),roms/$(rom).rom roms/$(rom)_with_seabios.rom) tools: PHONY tools-$(host_arch) @@ -60,6 +60,9 @@ multiglob = $(if $(strip $2),\ configure: configure.ac autoconf +config.mk: configure config.mk.in + ./configure + Makefile.d/keymap-list.mk: $(keymapdir)/original/ echo keymaps = $(notdir $(wildcard $</*)) > $@ Makefile.d/modules-list.mk: Makefile.d/modules/ diff --git a/Makefile.d/build-release.mk b/Makefile.d/build-release.mk index 09c0808..b3fa125 100644 --- a/Makefile.d/build-release.mk +++ b/Makefile.d/build-release.mk @@ -23,31 +23,31 @@ dist_files = \ dist_dirs = docs bin resources distdir: PHONY \ - libreboot-$(VERSION)/version.txt \ - $(addprefix libreboot-$(VERSION)/utils/$(arch)/,$(dist_utils)) \ - $(addprefix libreboot-$(VERSION)/,$(dist_files) $(dist_dirs)) + $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/version.txt \ + $(addprefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/utils/$(arch)/,$(dist_utils)) \ + $(addprefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/,$(dist_files) $(dist_dirs)) -libreboot-$(VERSION)/utils/$(arch)/bucts: src/bucts/bucts +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/utils/$(arch)/bucts: src/bucts/bucts mkdir -p $(@D) cp $< $@ -libreboot-$(VERSION)/utils/$(arch)/flashrom_%: src/flashrom/flashrom_% +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/utils/$(arch)/flashrom_%: src/flashrom/flashrom_% mkdir -p $(@D) cp $< $@ -libreboot-$(VERSION)/utils/$(arch)/cbfstool: src/coreboot/util/cbfstool/cbfstool +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/utils/$(arch)/cbfstool: src/coreboot/util/cbfstool/cbfstool mkdir -p $(@D) cp $< $@ -libreboot-$(VERSION)/utils/$(arch)/nvramtool: src/coreboot/util/nvramtool/nvramtool +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/utils/$(arch)/nvramtool: src/coreboot/util/nvramtool/nvramtool mkdir -p $(@D) cp $< $@ -$(addprefix libreboot-$(VERSION)/,$(dist_files)): \ -libreboot-$(VERSION)/%: % +$(addprefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/,$(dist_files)): \ +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/%: % mkdir -p $(@D) cp $< $@ -$(addprefix libreboot-$(VERSION)/,$(dist_dirs)): \ -libreboot-$(VERSION)/%: % +$(addprefix $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/,$(dist_dirs)): \ +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/%: % mkdir -p $(@D) cp -r $< $@ -libreboot-$(VERSION)/version.txt: PHONY +$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)/version.txt: PHONY mkdir -p $(@D) echo $(VERSION) > $@ diff --git a/config.mk.in b/config.mk.in new file mode 100644 index 0000000..5bf1cba --- /dev/null +++ b/config.mk.in @@ -0,0 +1,9 @@ +# Empty to disable +MAINTAINER_MODE=@MAINTAINER_MODE@ + +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION := $(shell if test -f version.txt; then cat version.txt; else git describe; fi) +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_URL = @PACKAGE_URL@ diff --git a/configure.ac b/configure.ac index 9c67699..4c48a18 100644 --- a/configure.ac +++ b/configure.ac @@ -1,55 +1,48 @@ +dnl My goal with this file is to check for all of the dependencies +dnl that aren't in 'base-devel' on Parabola, or 'build-essential' on +dnl Trisquel 7. + AC_PREREQ([2.69]) if test -f version.txt ; then - VERSION=`cat version.txt` + PACKAGE_VERSION=`cat version.txt` else - VERSION=`git describe` + PACKAGE_VERSION=`git describe` fi -AC_INIT([libreboot], $VERSION, [info@gluglug.org.uk]) +AC_INIT([libreboot], ${PACKAGE_VERSION}, [info@gluglug.org.uk], [], [http://libreboot.org/]) +m4_include(m4/ax_check_compile_flag.m4) +m4_include(m4/ax_check_link_flag.m4) -dnl TODO: wait until the end to exit with an error? +missing='' -dnl My goal with this file is to check for all of the dependencies -dnl that aren't in 'base-devel' on Parabola, or 'build-essential' on -dnl Trisquel 7. +dnl 'sh' does not nescessarily imply 'bash' +AC_CHECK_PROG(HAVE_BASH,bash,yes) +test "x$HAVE_BASH" = xyes || missing="$missing bash" -AC_CHECK_PROG(HAVE_SVN,svn,yes) -if test "x$HAVE_SVN" = x ; then - AC_MSG_ERROR([Please install the 'svn' utility]) -fi +AC_CHECK_PROG(HAVE_BSDTAR,bsdtar,yes) +test "x$HAVE_BSDTAR" = xyes || missing="$missing bsdtar" AC_CHECK_PROG(HAVE_GIT,git,yes) -if test "x$HAVE_GIT" = x ; then - AC_MSG_ERROR([Please install the 'git' utility]) -fi +test "x$HAVE_GIT" = xyes || missing="$missing git" -AC_CHECK_PROG(HAVE_WGET,wget,yes) -if test "x$HAVE_WGET" = x ; then - AC_MSG_ERROR([Please install the 'wget' utility]) -fi - -AC_CHECK_PROG(HAVE_BSDTAR,bsdtar,yes) -if test "x$HAVE_BSDTAR" = x ; then - AC_MSG_ERROR([Please install the 'bsdtar' utility]) -fi - -dnl 'sh' does not nescessarily imply 'bash' -AC_CHECK_PROG(HAVE_BASH,bash,yes) -if test "x$HAVE_BASH" = x ; then - AC_MSG_ERROR([Please install the 'bash' utility]) -fi +AC_CHECK_PROG(HAVE_IASL,iasl,yes) +test "x$HAVE_IASL" = xyes || missing="$missing iasl" dnl I know that /bin/python => Python 3 works, dnl I haven't verified that /bin/python => Python 2 works. +dnl (needed for grub's build) AC_CHECK_PROG(HAVE_PYTHON,python,yes) -if test "x$HAVE_PYTHON" = x ; then - AC_MSG_ERROR([Please install the 'python' utility]) -fi +test "x$HAVE_PYTHON" = xyes || missing="$missing python" -AC_CHECK_PROG(HAVE_IASL,iasl,yes) -if test "x$HAVE_IASL" = x ; then - AC_MSG_ERROR([Please install the 'iasl' utility, it is needed for SeaBIOS]) +AC_CHECK_PROG(HAVE_SVN,svn,yes) +test "x$HAVE_SVN" = xyes || missing="$missing svn" + +AC_CHECK_PROG(HAVE_WGET,wget,yes) +test "x$HAVE_WGET" = xyes || missing="$missing wget" + +if test "x$missing" != x ; then + AC_MSG_ERROR([The following needed programs were not found:$missing]) fi dnl This check is from grub's configure.ac @@ -73,12 +66,68 @@ if test "x$FONT_SOURCE" = x ; then fi AC_MSG_RESULT([yes]) -dnl This is at least needed by memtest +dnl This test is based on memtest86+ AC_LANG_PUSH([C]) -AC_MSG_NOTICE([-----------------------------------------------------------------------------]) -AC_MSG_NOTICE([The remaining tests are for 32-bit C, NOT necessarily the native architecture]) -AC_MSG_NOTICE([-----------------------------------------------------------------------------]) -AC_MSG_NOTICE([If you have GCC, but these fail, look for a 'gcc-multilib' package]) -CFLAGS='-march=i486 -m32' -AC_CHECK_HEADERS([stdint.h sys/io.h],,[AC_MSG_ERROR([Could not find libc headers])]) +AX_CHECK_COMPILE_FLAG([-march=i486 -m32], [], [AC_MSG_ERROR([Cannot compile for 32-bit])], [], [AC_LANG_SOURCE +#include <stdint.h> +#include <sys/io.h> +]) + +MAINTAINER_MODE=y +AC_SUBST(MAINTAINER_MODE) + +dnl This check is from flashrom's Makefile +AX_CHECK_LINK_FLAG([-static -m64], [], + [ + if test "x$MAINTAINER_MODE" != x ; then + AC_MSG_NOTICE([Cannot compile statically for 64-bit; disabling maintainer mode]) + MAINTAINER_MODE= + fi + ], + [-lz -lpci], + [AC_LANG_SOURCE + #define index shadow_workaround_index +#if !defined __NetBSD__ && !defined __DragonFly__ +#include <pci/pci.h> +#else +#include <pciutils/pci.h> +#endif +struct pci_access *pacc; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + pacc = pci_alloc(); + return 0; +} +]) + +dnl This check is from flashrom's Makefile +AX_CHECK_LINK_FLAG([-static -m32], [], + [ + if test "x$MAINTAINER_MODE" != x ; then + AC_MSG_NOTICE([Cannot compile statically for 32-bit; disabling maintainer mode]) + MAINTAINER_MODE= + fi + ], + [-lz -lpci], + [AC_LANG_SOURCE +#define index shadow_workaround_index +#if !defined __NetBSD__ && !defined __DragonFly__ +#include <pci/pci.h> +#else +#include <pciutils/pci.h> +#endif +struct pci_access *pacc; +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + pacc = pci_alloc(); + return 0; +} +]) AC_LANG_POP([C]) + +AC_CONFIG_FILES([config.mk]) +AC_OUTPUT diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 0000000..51df0c0 --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# 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 <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 3 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_check_link_flag.m4 b/m4/ax_check_link_flag.m4 new file mode 100644 index 0000000..db899dd --- /dev/null +++ b/m4/ax_check_link_flag.m4 @@ -0,0 +1,73 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the linker or gives an error. +# (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the linker's default flags +# when the check is done. The check is thus made with the flags: "LDFLAGS +# EXTRA-FLAGS FLAG". This can for example be used to force the linker to +# issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_LINK_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# 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 <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 3 + +AC_DEFUN([AX_CHECK_LINK_FLAG], +[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl +AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ + ax_check_save_flags=$LDFLAGS + LDFLAGS="$LDFLAGS $4 $1" + AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + LDFLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_LINK_FLAGS |