: 1
name: odb
version: 2.6.0
summary: ODB compiler
license: GPL-3.0-only
topics: C++, ORM, source code generation, object persistence, \
  relational database
description-file: README.md
package-description-file: PACKAGE-README.md
changes-file: NEWS
url: https://www.codesynthesis.com/products/odb/
doc-url: https://www.codesynthesis.com/products/odb/doc/manual.xhtml
src-url: https://git.codesynthesis.com/cgit/odb/odb/
email: odb-users@codesynthesis.com
build-warning-email: odb-builds@codesynthesis.com
builds: all relocatable
builds: -( +windows -gcc ) ; Requires MinGW GCC.
builds: &gcc               ; Requires GCC with plugin support enabled.
builds: &gcc-5+            ; Requires GCC 5 or later.
builds: -static            ; Implementation uses plugins and requires -fPIC.
requires: host
requires: c++11
depends: * build2 >= 0.18.0
depends: * bpkg >= 0.18.0

depends: libstudxml ^1.1.0
depends: libcutl ^1.11.0

#depends: libstudxml == 1.1.0-b.10
#depends: libcutl == 1.11.0-b.1

depends: libstud-optional ^1.0.0

depends: * cli ^1.2.0 ? ($config.odb.develop)

# Binary distribution packages. Overall notes:
#
# - Link dependencies that don't come from system packages statically. Note
#   that duplicate symbols are not an issue since the plugin shared library is
#   loaded by the GCC compiler, not ODB.
#
# - We suppress generating binary packages for dependencies (libstudxml,
#   libcutl) with --recursive=auto since they are linked statically.
#

# Linux binary distributions packages.
#
# - Compile (static) dependencies with -fPIC since they are linked to the ODB
#   plugin shared library.
#
# - Note that Fedora's rpmbuild and Ubuntu's dpkg-buildpackage compile the
#   ODB's sources with the -flto=auto option, which breaks the plugin. Thus,
#   we always disable the link-time optimization by adding -fno-lto.
#
bindist-debian-builds: bindist
bindist-debian-build-include: linux_debian*-**
bindist-debian-build-include: linux_ubuntu*-**
bindist-debian-build-exclude: **
bindist-debian-build-config:
\
+bpkg.bindist.debian:
+bbot.bindist.upload:
bpkg.bindist.debian:--recursive=auto
bpkg.bindist.debian:--debian-main-extradep=g++

# Prepend system package manager options instead of overriding.
#
bpkg.bindist.debian:--debian-buildflags=prepend

bpkg.create:config.bin.lib=static

# Reset common options for dependencies (because we are prepending).
#
bpkg.create:config.cc.poptions=[null]
bpkg.create:config.cc.coptions=[null]
bpkg.create:config.cc.loptions=[null]

# Append custom options for dependencies.
#
bpkg.create:config.c.coptions="-fPIC -fno-lto"
bpkg.create:config.cxx.coptions="-fPIC -fno-lto"

# Reset common options for odb (because we are prepending).
#
bpkg.configure.build:config.cc.poptions=[null]
bpkg.configure.build:config.cc.coptions=[null]
bpkg.configure.build:config.cc.loptions=[null]

# Append custom options for odb.
#
bpkg.configure.build:config.cxx.coptions=-fno-lto
\

bindist-fedora-builds: bindist
bindist-fedora-build-include: linux_fedora*-**
bindist-fedora-build-include: linux_rhel*-**
bindist-fedora-build-exclude: **
bindist-fedora-build-config:
\
+bpkg.bindist.fedora:
+bbot.bindist.upload:
bpkg.bindist.fedora:--recursive=auto
bpkg.bindist.fedora:--fedora-main-extrareq=gcc-c++

# Prepend system package manager options instead of overriding.
#
bpkg.bindist.fedora:--fedora-buildflags=prepend

bpkg.create:config.bin.lib=static

# Reset common options for dependencies (because we are prepending).
#
bpkg.create:config.cc.poptions=[null]
bpkg.create:config.cc.coptions=[null]
bpkg.create:config.cc.loptions=[null]

# Append custom options for dependencies.
#
bpkg.create:config.c.coptions="-fPIC -fno-lto"
bpkg.create:config.cxx.coptions="-fPIC -fno-lto"

# Reset common options for odb (because we are prepending).
#
bpkg.configure.build:config.cc.poptions=[null]
bpkg.configure.build:config.cc.coptions=[null]
bpkg.configure.build:config.cc.loptions=[null]

# Append custom options for odb.
#
bpkg.configure.build:config.cxx.coptions=-fno-lto
\

# Windows binary distribution archive.
#
# - Strip the default compiler name from metadata in the archive name since it
#   is built with GCC and the run-time libraries are supposed to be bundled
#   (see below for details).
#
# - Note that the contents of this archive can be overlaid with the contents
#   of the ODB runtime library archives extracted into the root directory.
#
bindist-windows-builds: bindist
bindist-windows-build-include: windows*-gcc**
bindist-windows-build-exclude: **
bindist-windows-build-config:
\
+bpkg.bindist.archive:
+bbot.bindist.upload:
bpkg.bindist.archive:--recursive=auto
bpkg.bindist.archive:--archive-lang-impl=cc=

# Relocatable by default (see target configuration for details).
#
#bpkg.bindist.archive:config.install.relocatable=true

# Supplement the generated archive with the GCC compiler and run-time
# libraries by overlaying it with the contents of the
# build2-mingw-X.Y.Z-x86_64-windows.tar.xz archive (located at
# https://download.build2.org/) extracted into the mingw/ subdirectory and
# mingw/bin/{libgcc_s_seh-*,libstdc++-*,libwinpthread-*}.dll files copied into
# the bin/ subdirectory.
#
# Note that since the resulting archive is quite big (about 120MB for zip), we
# use the tar.xz archive type to reduce its size (to about 45MB).
#
+bpkg.bindist.archive.post:build/bindist-archive-post.bx
bpkg.bindist.archive:--archive-type=tar.xz

# At the bpkg.bindist.archive step, configure odb to refer to g++ using the
# relative ../mingw/bin/g++ path (see above for details).
#
bpkg.bindist.archive:config.odb.gxx_name=../mingw/bin/g++

bpkg.create:config.bin.lib=static
b.create:config.cc.coptions="-Wall -O3"
\
