summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <ssssam@gmail.com>2016-03-27 19:51:13 +0100
committerSam Thursfield <ssssam@gmail.com>2016-03-27 19:51:13 +0100
commit870c815569bbff0e1eeea74126f12c3ab8f4e5bf (patch)
treefc81c408b2c53f9963ee5a46329a34e674c8b979
parent44f9a8af8544d5656f3bbb73b41d3b983c99e8f2 (diff)
downloadbinutils-gdb-baserock/sam/meson.tar.gz
WIP: totally impractical attempt to convert to Meson build systembaserock/sam/meson
-rw-r--r--bfd/Makefile.am20
-rw-r--r--bfd/config.h.meson.in5
-rwxr-xr-xbfd/generate-bfdver-h25
-rw-r--r--bfd/meson-options.txt24
-rw-r--r--bfd/meson.build107
5 files changed, 163 insertions, 18 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 6720f863047..0ef9a1b4066 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -1046,25 +1046,9 @@ CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
-bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
+bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/generate-bfdver-h
@echo "creating $@"
- @bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
- bfd_version_string="\"$(VERSION)\"" ;\
- bfd_soversion="$(VERSION)" ;\
- bfd_version_package="\"$(PKGVERSION)\"" ;\
- report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\
- . $(srcdir)/development.sh ;\
- if test "$$development" = true ; then \
- bfd_version_date=`$(SED) -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\
- bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\
- bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
- fi ;\
- $(SED) -e "s,@bfd_version@,$$bfd_version," \
- -e "s,@bfd_version_string@,$$bfd_version_string," \
- -e "s,@bfd_version_package@,$$bfd_version_package," \
- -e "s,@report_bugs_to@,$$report_bugs_to," \
- < $(srcdir)/version.h > $@; \
- echo "$${bfd_soversion}" > libtool-soversion
+ @VERSION="$(VERSION)" PKGVERSION="$(PKGVERSION)" REPORT_BUGS_TO="$(REPORT_BUGS_TO)" builddir="$(builddir)" srcdir="$(srcdir)" ./generate-bfdver-h
# Disable -Werror, if it has been enabled, since coffswap.h won't
# compile with gcc 4.5 and above.
diff --git a/bfd/config.h.meson.in b/bfd/config.h.meson.in
new file mode 100644
index 00000000000..d35a82300d1
--- /dev/null
+++ b/bfd/config.h.meson.in
@@ -0,0 +1,5 @@
+#define HAVE_ASPRINTF "@HAVE_ASPRINTF"
+#define HAVE_VASPRINTF "@HAVE_VASPRINTF"
+#
+#define PACKAGE "@PACKAGE@"
+#define PACKAGE_VERSION "@PACKAGE_VERSION@"
diff --git a/bfd/generate-bfdver-h b/bfd/generate-bfdver-h
new file mode 100755
index 00000000000..a3c25e9301a
--- /dev/null
+++ b/bfd/generate-bfdver-h
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Generate the bfdver.h file, from version.h.
+
+if [ -z "$SED" ]; then
+ SED=sed
+fi
+
+bfd_version=`echo "${VERSION}" | ${SED} -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'`
+bfd_version_string="\"${VERSION}\""
+bfd_soversion="${VERSION}"
+bfd_version_package="\"${PKGVERSION}\""
+report_bugs_to="\"${REPORT_BUGS_TO}\""
+. ${srcdir}/development.sh
+if test "$development" = true ; then
+ bfd_version_date=`${SED} -n -e 's/.*DATE //p' < ${srcdir}/version.h`
+ bfd_version_string="\"${VERSION}.${bfd_version_date}\""
+ bfd_soversion="${VERSION}.${bfd_version_date}"
+fi
+${SED} -e "s,@bfd_version@,$bfd_version," \
+ -e "s,@bfd_version_string@,$bfd_version_string," \
+ -e "s,@bfd_version_package@,$bfd_version_package," \
+ -e "s,@report_bugs_to@,$report_bugs_to," \
+ < ${srcdir}/version.h > ${builddir}/bfdver.h
+echo "${bfd_soversion}" > libtool-soversion
diff --git a/bfd/meson-options.txt b/bfd/meson-options.txt
new file mode 100644
index 00000000000..c7e2210c41e
--- /dev/null
+++ b/bfd/meson-options.txt
@@ -0,0 +1,24 @@
+option('64-bit-bfd',
+ type: 'boolean',
+ value: false,
+ description: "64-bit support (on hosts with narrower word sizes")
+
+option('targets',
+ type: 'string',
+ description: "alternative target configurations")
+
+option('secureplt',
+ type: 'boolean',
+ value: true,
+ description: "Default to creating read-only plt entries")
+
+option('leading-mingw64-underscores',
+ type: 'boolean',
+ value: false,
+ description: "Enable leading underscores on 64 bit mingw targets")
+
+default_debug_dir = get_option('libdir') + '/debug'
+option('seperate-debug-dir',
+ type: 'string',
+ value: default_debug_dir,
+ description: "Look for global separate debug info in DIR (default=" + default_debug_dir + ")")
diff --git a/bfd/meson.build b/bfd/meson.build
new file mode 100644
index 00000000000..9eff9c496d3
--- /dev/null
+++ b/bfd/meson.build
@@ -0,0 +1,107 @@
+project('bfd', 'c')
+
+gettext('bfd',
+ languages: ['fr', 'tr', 'ja', 'es', 'sv', 'da', 'zh_CN', 'ro', 'rw', 'vi', 'fi', 'id', 'ru', 'uk'])
+
+#run_command('configure.host')
+
+zlib = dependency('zlib')
+
+host_cc = meson.get_compiler('c', native: true)
+
+if host_cc.sizeof('void *') == 8
+ host64 = true
+else
+ host64 = false
+endif
+
+if host_cc.sizeof('long') == 8
+ BFD_HOST_64BIT_LONG = true
+ BFD_HOST_64BIT_LONG_LONG = false
+ BFD_HOST_64_BIT_DEFINED = true
+ BFD_HOST_64_BIT = 'long'
+ BFD_HOST_U_64_BIT = 'unsigned long'
+ BFD_HOSTPTR_T='unsigned long'
+elif host_cc.sizeof('long long') == 8
+ BFD_HOST_64BIT_LONG = false
+ BFD_HOST_64BIT_LONG_LONG = true
+ BFD_HOST_64_BIT_DEFINED = true
+ BFD_HOST_64_BIT = 'long long'
+ BFD_HOST_U_64_BIT = 'unsigned long long'
+ if host_cc.sizeof('long long') == 8
+ BFD_HOSTPTR_T='unsigned long long'
+ else
+ BFD_HOSTPTR_T='unsigned long'
+ endif
+else
+ BFD_HOST_64BIT_LONG = false
+ BFD_HOST_64BIT_LONG_LONG = false
+ BFD_HOST_64_BIT_DEFINED = false
+ #BFD_HOST_64_BIT = ''
+ #BFD_HOST_U_64_BIT = ''
+endif
+
+if host_cc.has_function('ftello64') and host_cc.has_function('fseeko64')
+ bfd_file_ptr = BFD_HOST_64_BIT
+ bfd_ufile_ptr = BFD_HOST_U_64_BIT
+else
+ bfd_file_ptr = 'long'
+ bfd_ufile_ptr = 'unsigned long'
+endif
+
+general_conf = configuration_data()
+general_conf.set('HAVE_ASPRINTF', host_cc.has_function('asprintf'))
+general_conf.set('HAVE_VASPRINTF', host_cc.has_function('vasprintf'))
+general_conf.set('PACKAGE', 'bfd')
+general_conf.set('PACKAGE_VERSION', meson.project_version())
+configure_file(input: 'config.h.meson.in',
+ output: 'config.h',
+ configuration: general_conf)
+
+# FIXME: the necessary code to do this is still part of the `make bfdver.h`
+# rule, for now
+configure_file(
+ input: 'version.h',
+ output: 'bfdver.h',
+ command: [
+ 'env',
+ 'builddir=' + meson.current_build_dir(),
+ 'srcdir=' + meson.current_source_dir(),
+ 'VERSION=' + meson.project_version(),
+ 'PKGVERSION="GNU Binutils"',
+ 'REPORT_BUGS_TO=http://www.sourceware.org/bugzilla/',
+ meson.current_source_dir() + '/generate-bfdver-h'])
+
+bfd_conf = configuration_data()
+bfd_conf.set('bfd_default_target_size', 4) ## FIXME
+bfd_conf.set('bfd_file_ptr', bfd_file_ptr)
+bfd_conf.set('BFD_HOST_64_BIT', BFD_HOST_64_BIT)
+bfd_conf.set('BFD_HOST_U_64_BIT', BFD_HOST_U_64_BIT)
+bfd_conf.set10('BFD_HOST_64_BIT_DEFINED', BFD_HOST_64_BIT_DEFINED)
+bfd_conf.set('BFD_HOSTPTR_T', BFD_HOSTPTR_T)
+bfd_conf.set('BFD_HOST_64BIT_LONG', BFD_HOST_64BIT_LONG)
+bfd_conf.set('BFD_HOST_64BIT_LONG_LONG', BFD_HOST_64BIT_LONG_LONG)
+bfd_conf.set10('supports_plugins', true) ## FIXME
+bfd_conf.set('wordsize', 4) ## FIXME
+
+# FIXME: bfd-in2.h is generated by the `make headers` rule, so
+# this step currently depends on that Makefile target
+configure_file(input: 'bfd-in2.h',
+ output: 'bfd.h',
+ configuration: bfd_conf)
+
+bfd32_libs_sources = files(
+ 'archive.c', 'archures.c', 'bfd.c', 'bfdio.c', 'bfdwin.c',
+ 'cache.c', 'coff-bfd.c', 'compress.c', 'corefile.c', 'format.c', 'hash.c',
+ 'init.c', 'libbfd.c', 'linker.c', 'merge.c', 'opncls.c', 'reloc.c',
+ 'section.c', 'simple.c', 'stab-syms.c', 'stabs.c', 'syms.c', 'targets.c',
+ 'binary.c', 'ihex.c', 'srec.c', 'tekhex.c', 'verilog.c')
+
+bfd64_libs_sources = files('archive64.c')
+
+library(
+ 'libbfd',
+ bfd32_libs_sources,
+ c_args: [
+ '-I' + meson.current_source_dir() + '/../include',
+ ])