diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..30f0d5c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/build2-0.11.0.tar.gz +/libbutl-0.11.0.tar.gz +/libbpkg-0.11.0.tar.gz +/bpkg-0.11.0.tar.gz +/bdep-0.11.0.tar.gz +/libodb-2.5.0-b.15.tar.gz +/libodb-sqlite-2.5.0-b.15.tar.gz diff --git a/build2.spec b/build2.spec new file mode 100644 index 0000000..052bba5 --- /dev/null +++ b/build2.spec @@ -0,0 +1,489 @@ +%bcond_without bootstrap +%bcond_without check +%bcond_without bundle_libodb +%bcond_with network_checks +%bcond_with static + +Name: build2 +Version: 0.11.0 +Release: 1%{?dist} +Summary: Cross-platform build toolchain for developing and packaging C++ code + +License: MIT +URL: https://build2.org/ +Source0: https://pkg.cppget.org/1/alpha/%{name}/%{name}-%{version}.tar.gz +Source1: https://pkg.cppget.org/1/alpha/%{name}/libbutl-%{version}.tar.gz +Source2: https://pkg.cppget.org/1/alpha/%{name}/libbpkg-%{version}.tar.gz +Source3: https://pkg.cppget.org/1/alpha/%{name}/bpkg-%{version}.tar.gz +Source4: https://pkg.cppget.org/1/alpha/%{name}/bdep-%{version}.tar.gz +Source5: macros.%{name} + +# The latest official release of libodb is not compatible with build2 +%if %{with bundle_libodb} +%global libodb_bundle_version 2.5.0-b.15 +Source100: https://pkg.cppget.org/1/beta/odb/libodb-%{libodb_bundle_version}.tar.gz +Source101: https://pkg.cppget.org/1/beta/odb/libodb-sqlite-%{libodb_bundle_version}.tar.gz +%endif + +BuildRequires: gcc-c++ +BuildRequires: libpkgconf-devel +%if %{with bootstrap} +BuildRequires: make +BuildRequires: pkgconf +%else +BuildRequires: %{name} +BuildRequires: %{name}-rpm-macros +%endif +%if %{with check} +# build2, bpkg +BuildRequires: bzip2 +# install: build2; sha256sum: build2, bpkg, bdep +BuildRequires: coreutils +# libbutl, build2 +BuildRequires: diffutils +%if %{with network_checks} +# libbutl, bpkg, bdep +BuildRequires: curl +%endif +# build2, bpkg, bdep +BuildRequires: git +# build2, bpkg +BuildRequires: gzip +# libbutl, bpkg +BuildRequires: openssl +# build2, bpkg +BuildRequires: tar +# build2, bpkg +BuildRequires: xz +%endif +Requires: bzip2 +Requires: coreutils +Requires: diffutils +Requires: git +Requires: gzip +Requires: tar +Requires: xz +Recommends: %{name}-rpm-macros + +%description +%{name} is an open source (MIT), cross-platform build toolchain for developing +and packaging C++ code. It is a hierarchy of tools that includes the build +system, package dependency manager (for package consumption), and project +dependency manager (for project development). Key features: + + * Next-generation, Cargo-like integrated build toolchain for C++. + * Covers entire project life cycle: creation, development, testing, and + delivery. + * Uniform and consistent interface across all platforms and compilers. + * Fast, multi-threaded build system with parallel building and testing. + * Archive and version control-based package repositories. + * Dependency-free, all you need is a C++ compiler. + +%package -n %{name}-doc +Summary: %{name} documentation +BuildArch: noarch + +%description -n %{name}-doc +This package contains the %{name} documentation. + +%package -n libbutl +Summary: %{name} utility library +# BSD-2 clause: +# libbutl/sha256c.c +# libbutl/strptime.c +# libbutl/timelocal.c +# libbutl/timelocal.h +# BSD-3 clause: +# libbutl/sha1.c +License: MIT and BSD +Requires: curl +Requires: openssl + +%description -n libbutl +This package contains the %{name} utility library. + +%package -n libbutl-devel +Summary: Development files for %{name} utility library +License: MIT and BSD +Requires: libbutl%{?_isa} = %{version}-%{release} + +%description -n libbutl-devel +The libbutl-devel package contains libraries and header files for +developing applications that use libbutl. + +%if %{with static} +%package -n libbutl-static +Summary: Static libraries for %{name} utility library +License: MIT and BSD +Requires: libbutl-devel%{?_isa} = %{version}-%{release} + +%description -n libbutl-static +The libbutl-static package contains static libraries for developing +applications that use libbutl. +%endif + +%package -n libbpkg +Summary: %{name} package dependency manager library + +%description -n libbpkg +This package contains the %{name} package dependency manager library. + +%package -n libbpkg-devel +Summary: Development files for %{name} package dependency manager library +Requires: libbpkg%{?_isa} = %{version}-%{release} + +%description -n libbpkg-devel +The libbpkg-devel package contains libraries and header files for +developing applications that use libbpkg. + +%if %{with static} +%package -n libbpkg-static +Summary: Static libraries for %{name} package dependency manager library +Requires: libbpkg-devel%{?_isa} = %{version}-%{release} + +%description -n libbpkg-static +The libbpkg-static package contains static libraries for developing +applications that use libbpkg. +%endif + +%package -n bpkg +Summary: %{name} package dependency manager +%if %{with bundle_libodb} +Provides: bundled(libodb) = %{libodb_bundle_version} +Provides: bundled(libodb-sqlite) = %{libodb_bundle_version} +%else +BuildRequires: pkgconfig(libodb) +BuildRequires: pkgconfig(libodb-sqlite) +%endif +BuildRequires: pkgconfig(sqlite3) +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: bzip2 +Requires: coreutils +Requires: curl +Requires: git +Requires: gzip +Requires: openssl +Requires: tar +Requires: xz + +%description -n bpkg +The %{name} package dependency manager is used to manipulate build +configurations, packages, and repositories. + +%package -n bpkg-doc +Summary: bpkg documentation +BuildArch: noarch + +%description -n bpkg-doc +This package contains the bpkg documentation. + +%package -n bdep +Summary: %{name} project dependency manager +%if %{with bundle_libodb} +Provides: bundled(libodb) = %{libodb_bundle_version} +Provides: bundled(libodb-sqlite) = %{libodb_bundle_version} +%else +BuildRequires: pkgconfig(libodb) +BuildRequires: pkgconfig(libodb-sqlite) +%endif +BuildRequires: pkgconfig(sqlite3) +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: bpkg%{?_isa} = %{version}-%{release} +Requires: coreutils +Requires: curl +Requires: git + +%description -n bdep +The %{name} project dependency manager is used to manage the dependencies of a +project during development. + +%package -n bdep-doc +Summary: bdep documentation +BuildArch: noarch + +%description -n bdep-doc +This package contains the bdep documentation. + +%package -n %{name}-rpm-macros +Summary: %{name} RPM macros +BuildArch: noarch +Requires: %{name} + +%description -n %{name}-rpm-macros +This package contains the %{name} RPM macros. + +%prep +%if ! %{with bundle_libodb} +%setup -q -c -n %{name}-toolchain-%{version} -a 1 -a 2 -a 3 -a 4 +%else +%setup -q -c -n %{name}-toolchain-%{version} -a 1 -a 2 -a 3 -a 4 -a 100 -a 101 +%endif +mv libbutl-%{version} %{name}-%{version} +# fix PostScript documentation character encoding +for f in $(find -name "*.ps"); do + encoding=$(file -bi "${f}" | cut -f 2 -d';' | cut -f 2 -d'=') + if [ "${encoding}" != "utf-8" ]; then + iconv -f "${encoding}" -t utf-8 "${f}" -o "${f}.utf8" + mv "${f}.utf8" "${f}" + fi +done + +%build +# Define basic installation configuration. Note that this does not include: +# %%{_sysconfdir} /etc +# %%{_libexecdir} %%{_exec_prefix}/libexec +# %%{_sharedstatedir} /var/lib +# %%{_datadir} %%{_prefix}/share +# %%{_infodir} /usr/share/info +# %%{_localstatedir} /var +# config.install.data and config.install.libexec seems to default to a value +# like %%{_datadir}/${project} and %%{_libexecdir}/${project} so that data files +# are not installed directly in %%{_datadir} or %%{_libexecdir} +# By specifying the installation location, the default file install mode will be +# 644, so we should set mode 755 for executable target install directories +# explicitly +%global config_install \\\ + config.install.root=%{_prefix} \\\ + config.install.exec_root=%{_exec_prefix} \\\ + config.install.bin=%{_bindir} \\\ + config.install.sbin=%{_sbindir} \\\ + config.install.include=%{_includedir} \\\ + config.install.lib=%{_libdir} \\\ + config.install.man=%{_mandir} \\\ + config.install.pkgconfig=%{_libdir}/pkgconfig \\\ + config.install.bin.mode=755 \\\ + config.install.sbin.mode=755 \\\ + config.install.lib.mode=755 \\\ + config.install.chroot=%{?buildroot} +%if %{with bootstrap} +CXX=g++ +CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" +LDFLAGS="${LDFLAGS:-%{build_ldflags}}" +export LD_LIBRARY_PATH=$PWD/%{name}-%{version}/libbutl-%{version}/libbutl:${LD_LIBRARY_PATH} +pushd %{name}-%{version} +# bootstrap, phase 1: minimal build system +export CXX +export CXXFLAGS +export LDFLAGS +%make_build -f bootstrap.gmake +# bootstrap, phase 2: statically linked build system +build2/b-boot \ + config.bin.lib=static \ + config.cxx=${CXX} \ + config.cxx.coptions="${CXXFLAGS}" \ + config.cxx.poptions+="$(pkgconf --cflags-only-I libpkgconf)" \ + config.cxx.loptions+="$(pkgconf --libs-only-L libpkgconf) ${LDFLAGS}" \ + build2/exe{b} +mv build2/b build2/b-boot +# configure and build final, shared library build system +build2/b-boot configure \ +%if ! %{with static} + config.bin.lib=shared \ +%endif + config.bin.rpath.auto=false \ + config.bin.rpath_link.auto=false \ + config.cxx=${CXX} \ + config.cxx.coptions="${CXXFLAGS}" \ + config.cxx.loptions="${LDFLAGS}" \ +%{config_install} +build2/b-boot +popd +%if %{with bundle_libodb} +# configure libodb to build static and not install +%{name}-%{version}/build2/b configure: \ + libodb-%{libodb_bundle_version}/ \ + libodb-sqlite-%{libodb_bundle_version}/ \ + config.bin.lib=static \ + config.cxx=${CXX} \ + config.cxx.coptions="${CXXFLAGS}" \ + config.cxx.loptions="${LDFLAGS}" \ + config.import.libodb="libodb-%{libodb_bundle_version}/" \ + config.install=false +%endif +# configure bpkg and bdep and their dependencies +%{name}-%{version}/build2/b configure: \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ \ +%if ! %{with static} + config.bin.lib=shared \ +%endif + config.bin.rpath.auto=false \ + config.bin.rpath_link.auto=false \ + config.cxx=${CXX} \ + config.cxx.coptions="${CXXFLAGS}" \ + config.cxx.loptions="${LDFLAGS}" \ +%if %{with bundle_libodb} + config.import.libodb="libodb-%{libodb_bundle_version}/" \ + config.import.libodb_sqlite="libodb-sqlite-%{libodb_bundle_version}/" \ +%endif + config.import.libbutl="%{name}-%{version}/libbutl-%{version}/" \ + config.import.libbpkg="libbpkg-%{version}/" \ +%{config_install} +# build bpkg and bdep and their dependencies +%{name}-%{version}/build2/b \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ +%else +# ! %%{with bootstrap} +%if %{with bundle_libodb} +# configure libodb to build static and not install +%build2 configure: \ + libodb-%{libodb_bundle_version}/ \ + libodb-sqlite-%{libodb_bundle_version}/ \ + config.bin.lib=static \ + config.import.libodb="libodb-%{libodb_bundle_version}/" \ + config.install=false +%endif +# configure build2, bpkg, and bdep and their dependencies +%build2_configure \ + %{name}-%{version}/ \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ \ +%if %{with static} + config.bin.lib=both \ +%endif +%if %{with bundle_libodb} + config.import.libodb="libodb-%{libodb_bundle_version}/" \ + config.import.libodb_sqlite="libodb-sqlite-%{libodb_bundle_version}/" \ +%endif + config.import.libbutl="%{name}-%{version}/libbutl-%{version}/" \ + config.import.libbpkg="libbpkg-%{version}/" +# build build2, bpkg, and bdep and their dependencies +b %{name}-%{version}/ \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ +%endif + +%install +%if %{with bootstrap} +%{name}-%{version}/build2/b-boot install: \ +%else +b install: \ +%endif + %{name}-%{version}/libbutl-%{version}/ \ + %{name}-%{version}/ \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ +# move licenses from %%{_docdir} to %%{_defaultlicensedir} +for p in %{name} libbutl libbpkg bpkg bdep; do + mkdir -p %{buildroot}%{_defaultlicensedir}/${p} + mv %{buildroot}%{_docdir}/${p}/LICENSE %{buildroot}%{_defaultlicensedir}/${p} +done +install -Dpm0644 %{SOURCE5} %{buildroot}%{_rpmmacrodir}/macros.%{name} + +%check +%if %{with check} +export PATH=$PWD/bpkg-%{version}/bpkg:$PATH +export PATH=$PWD/%{name}-%{version}/build2:$PATH +export LD_LIBRARY_PATH=$PWD/libbpkg-%{version}/libbpkg:${LD_LIBRARY_PATH} +export LD_LIBRARY_PATH=$PWD/%{name}-%{version}/libbutl-%{version}/libbutl:${LD_LIBRARY_PATH} +b test: \ + %{name}-%{version}/libbutl-%{version}/ \ + %{name}-%{version}/ \ + libbpkg-%{version}/ \ + bpkg-%{version}/ \ + bdep-%{version}/ \ +%if ! %{with network_checks} + config.bdep.test.repository='' +%endif +%endif + +%ldconfig_scriptlets + +%files +%dir %{_defaultlicensedir}/%{name} +%dir %{_docdir}/%{name} +%license %{_defaultlicensedir}/%{name}/LICENSE +%doc %{_docdir}/%{name}/NEWS +%doc %{_docdir}/%{name}/README +%{_bindir}/b +%{_mandir}/man1/b.1* + +%files -n %{name}-doc +%dir %{_docdir}/%{name} +%doc %{_docdir}/%{name}/%{name}-build-system-manual* +%doc %{_docdir}/%{name}/b.xhtml +%doc %{_docdir}/%{name}/manifest + +%files -n libbutl +%dir %{_defaultlicensedir}/libbutl +%license %{_defaultlicensedir}/libbutl/LICENSE +%{_libdir}/libbutl-0.11.so + +%files -n libbutl-devel +%dir %{_docdir}/libbutl +%doc %{_docdir}/libbutl/manifest +%doc %{_docdir}/libbutl/NEWS +%doc %{_docdir}/libbutl/README +%{_includedir}/libbutl +%{_libdir}/libbutl.so +%{_libdir}/pkgconfig/libbutl.shared.pc + +%if %{with static} +%files -n libbutl-static +%{_libdir}/libbutl.a +%{_libdir}/pkgconfig/libbutl.static.pc +%endif + +%files -n libbpkg +%dir %{_defaultlicensedir}/libbpkg +%license %{_defaultlicensedir}/libbpkg/LICENSE +%{_libdir}/libbpkg-0.11.so + +%files -n libbpkg-devel +%dir %{_docdir}/libbpkg +%doc %{_docdir}/libbpkg/manifest +%doc %{_docdir}/libbpkg/NEWS +%doc %{_docdir}/libbpkg/README +%{_includedir}/libbpkg +%{_libdir}/libbpkg.so +%{_libdir}/pkgconfig/libbpkg.shared.pc + +%if %{with static} +%files -n libbpkg-static +%{_libdir}/libbpkg.a +%{_libdir}/pkgconfig/libbpkg.static.pc +%endif + +%files -n bpkg +%dir %{_defaultlicensedir}/bpkg +%dir %{_docdir}/bpkg +%license %{_defaultlicensedir}/bpkg/LICENSE +%doc %{_docdir}/bpkg/NEWS +%doc %{_docdir}/bpkg/README +%{_bindir}/bpkg +%{_mandir}/man1/bpkg.1* +%{_mandir}/man1/bpkg-*1.* + +%files -n bpkg-doc +%dir %{_docdir}/bpkg +%doc %{_docdir}/bpkg/%{name}-package-manager-manual* +%doc %{_docdir}/bpkg/bpkg*.xhtml +%doc %{_docdir}/bpkg/manifest + +%files -n bdep +%dir %{_defaultlicensedir}/bdep +%dir %{_docdir}/bdep +%license %{_defaultlicensedir}/bdep/LICENSE +%doc %{_docdir}/bdep/NEWS +%doc %{_docdir}/bdep/README +%{_bindir}/bdep +%{_mandir}/man1/bdep.1* +%{_mandir}/man1/bdep-*1.* + +%files -n bdep-doc +%dir %{_docdir}/bdep +%doc %{_docdir}/bdep/bdep*.xhtml +%doc %{_docdir}/bdep/manifest + +%files -n %{name}-rpm-macros +%{_rpmmacrodir}/macros.%{name} + +%changelog +* Tue Jun 11 2019 Matthew Krupcale - 0.11.0-1 +- Initial package diff --git a/macros.build2 b/macros.build2 new file mode 100644 index 0000000..1226a82 --- /dev/null +++ b/macros.build2 @@ -0,0 +1,65 @@ +%__build2 %{_bindir}/b +# Define compilation and linker options: +# - Build only shared libraries by default +# - Disable automatic prerequisite library rpaths +# - cc.* configuration is for C-common, applying to both C and C++ +%__build2_build_config \\\ + config.bin.lib=shared \\\ + config.bin.rpath.auto=false \\\ + config.bin.rpath_link.auto=false \\\ + config.c.coptions="%{build_cflags}" \\\ + config.cxx.coptions="%{build_cxxflags}" \\\ + config.cc.loptions="%{build_ldflags}" +# Define basic installation configuration. Note that this does not include: +# %%{_sysconfdir} /etc +# %%{_libexecdir} %%{_exec_prefix}/libexec +# %%{_sharedstatedir} /var/lib +# %%{_datadir} %%{_prefix}/share +# %%{_infodir} /usr/share/info +# %%{_localstatedir} /var +# config.install.data and config.install.libexec seems to default to a value +# like %%{_datadir}/${project} and %%{_libexecdir}/${project} so that data files +# are not installed directly in %%{_datadir} or %%{_libexecdir} +# By specifying the installation location, the default file install mode will be +# 644, so we should set mode 755 for executable target install directories +# explicitly +%__build2_install_config \\\ + config.install.root=%{_prefix} \\\ + config.install.exec_root=%{_exec_prefix} \\\ + config.install.bin=%{_bindir} \\\ + config.install.sbin=%{_sbindir} \\\ + config.install.include=%{_includedir} \\\ + config.install.lib=%{_libdir} \\\ + config.install.man=%{_mandir} \\\ + config.install.pkgconfig=%{_libdir}/pkgconfig \\\ + config.install.bin.mode=755 \\\ + config.install.sbin.mode=755 \\\ + config.install.lib.mode=755 \\\ + config.install.chroot=%{?buildroot} +%__build2_config \\\ + %{__build2_build_config} \\\ + %{__build2_install_config} + +# Performs the default operation, update, on a target +%build2 \ + %{__build2} \\\ + %{__build2_build_config} \\\ + %{nil} + +# Configures all operations on a target +%build2_configure \ + %{__build2} configure: \\\ + %{__build2_config} \\\ + %{nil} + +# Performs the update and install operations on a target +%build2_install \ + %{__build2} install: \\\ + %{__build2_config} \\\ + %{nil} + +# Performs the update and test operations on a target +%build2_test \ + %{__build2} test: \\\ + %{__build2_build_config} \\\ + %{nil} diff --git a/sources b/sources new file mode 100644 index 0000000..4c14697 --- /dev/null +++ b/sources @@ -0,0 +1,7 @@ +SHA512 (build2-0.11.0.tar.gz) = e84ad21f318cb34c86c148164ba873f14c7cce9f5efca89d45dd8198af752eaebc4f3b702ba38757d7312f00285da21681b7820a0bab7a9028b074fe508f93e7 +SHA512 (libbutl-0.11.0.tar.gz) = c954a317d3eb5c57ccf7d86a52a0f4548b142d319ea6b27d45af8de6211487854e8e61e6a45ddcf940b87332c0478e5b550dcadb2fbca85e4d59cea8510a07b3 +SHA512 (libbpkg-0.11.0.tar.gz) = 1a85edad2016db67c7ea4d37fc5c01cd0d346a464154d2459f5c078d6cddf8ad520e64ae830db2cd131b86787e1e8a0ff526677c573524db74d9dbe1c63fb0b3 +SHA512 (bpkg-0.11.0.tar.gz) = bb11d602f67a9876655ff4c03ad7c221032f0c0ca979f35cc4e5ec1a3561fc9b705f23e9190b9564edd09dc34b1be3a8be4bbe94b9d979b470006ae1a72997c5 +SHA512 (bdep-0.11.0.tar.gz) = 5a89eac0338e1903208a55e6e7dcf5c3fd4baaa57fa9a02fd51cfd8ef21ba8d5267d61d7b5b411bb9179c69e58467894bab1406717fdd4e8af529aa3d5d9fcb9 +SHA512 (libodb-2.5.0-b.15.tar.gz) = 658e8c1e820ed720a515e9b1486384284f3ae031bf1166d1a36cc78c6224db3d1e789bb20ea26ed21524c552d61292c21743b80aee51acf789fd8477edf7decc +SHA512 (libodb-sqlite-2.5.0-b.15.tar.gz) = 62f1956325f412cc28dad28945f6428ed2803487c8071e8243c169c9ef134bbfe4e55a601e22500bbef1fb4efad7bf318b7b2587ec31dcfc9f514b8da0f018c5