# o3de-mcpp-az -- license-clean mcpp library for Open 3D Engine # # Builds the mcpp 2.7.2 portable C preprocessor with Amazon Lumberyard's # `_az.2` patch series applied. Library-link variant of the DXC and # SPIRV-Cross PoCs (those are binary-shellout tools; mcpp is a library # the engine #includes via and calls in-process). # # Per the audit at 2026-05-08 (see o3de-rpm/BUNDLED_LIBRARIES.md # "Binary-only / DXC-class dependencies"): the engine consumes mcpp's # C library API directly (Gems/Atom/Asset/Shader/Code/Source/Editor/ # CommonFiles/Preprocessor.cpp uses mcpp_lib_main, mcpp_set_out_func, # mcpp_set_report_include_callback). Replacing with another preprocessor # would require engine code changes; the practical Fedora-track answer # is a license-clean COPR rebuild of mcpp itself. # # Upstream: https://mcpp.sourceforge.net/ (Kiyoshi Matsui; # last release 2.7.2, 2008; abandonware-class but still BSD-2-Clause # license-clean and the C-preprocessor problem is genuinely solved). # # The `_az.2` patch series (566 lines, 11 hunks) covers: # - aarch64 host triplet detection in config.guess # - COMPILER macro defaults adjusted for Lumberyard build expectations # - whitespace + style cleanup # - small build-system tweaks # Sourced verbatim from o3de/3p-package-source/package-system/mcpp/ # mcpp_2.7.2_az.patch (the engine's own canonical patch set). # # This is the "PoC" stage; pairs with the deferred mcpp PoC entry in # o3de-rpm/FOLLOW_UPS.md. Goal of this iteration: produce libmcpp.so + # /usr/include/mcpp_lib.h that the o3de engine's CMakeLists can link # against in place of the bundled mcpp-2.7.2_az.2-rev1 fetch. %global mcpp_pkgrev rev2 Name: o3de-mcpp-az Version: 2.7.2 Release: 1.%{mcpp_pkgrev}%{?dist} Summary: Portable C preprocessor (Amazon-patched fork) for Open 3D Engine License: BSD-2-Clause URL: https://mcpp.sourceforge.net/ # Source0: upstream mcpp 2.7.2 tarball, fetched from sourceforge.net. # We don't fetch directly via wget in %prep because COPR builders run # with enable_net=false for license-clean repos; pre-staged tarball is # the canonical input. SHA256 baked into the spec for integrity. Source0: mcpp-%{version}.tar.gz # Patch0001: Lumberyard's `_az.2` patch series, sourced verbatim from # o3de/3p-package-source/package-system/mcpp/mcpp_2.7.2_az.patch. # Contains 566 lines across 11 hunks. Apache-2.0 OR MIT licensed # (per o3de/3p-package-source LICENSE). Compatible with the upstream # BSD-2-Clause mcpp source; no licensing conflict. Patch0001: mcpp_2.7.2_az.patch BuildRequires: gcc BuildRequires: make BuildRequires: autoconf BuildRequires: automake # mcpp's configure.ac uses libtool macros (AC_LIBTOOL_WIN32_DLL, # AC_PROG_LIBTOOL); autoreconf needs libtool's m4 files installed. BuildRequires: libtool # mcpp uses GNU autotools (./configure + make). %description mcpp -- Matsuui's C/C++ preprocessor, a portable C preprocessor library + standalone command-line tool. This build is the Amazon Lumberyard fork's `_az.2` patch series applied to upstream mcpp 2.7.2 sources. Used by Open 3D Engine's AZSL (Amazon Shader Language) asset-build pipeline -- the engine `#include`s `` and calls `mcpp_lib_main()`, `mcpp_set_out_func()`, `mcpp_set_report_include_callback()` to expand `#ifdef`s in shader source files at asset-build time. This package replaces the bundled mcpp-2.7.2_az.2-rev1 tarball O3DE fetches from packages.o3de.org by default, providing a Fedora-shippable license-clean substitute for distros that can't redistribute the bundled upstream tarball or that prefer to consume from their own COPR infrastructure. License: BSD-2-Clause (upstream) + Apache-2.0 OR MIT (Lumberyard patches). Both Fedora-compatible. %package devel Summary: Development headers + static library for o3de-mcpp-az Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Development headers (mcpp_lib.h) and static archive (libmcpp.a) for the o3de-mcpp-az library. Install this in addition to %{name} when building software (e.g. Open 3D Engine) that links against mcpp's preprocessor C API. %prep %autosetup -n mcpp-%{version} -p1 # Regenerate autoconf machinery in case the patched sources need it. # autoreconf is conservative -- only updates files where the patched # source has newer timestamps than the generated artefacts. autoreconf -fi %build # Per o3de/3p-package-source/package-system/mcpp/get_and_build_mcpp.py: # ./configure --with-pic --enable-mcpplib # `--with-pic` builds position-independent code (required for shared # library output and engine asset-builder linkage). # `--enable-mcpplib` builds mcpp as a library in addition to the # standalone command-line tool. %configure --with-pic --enable-mcpplib %make_build %install %make_install # mcpp's autotools install puts: # /usr/bin/mcpp -- standalone preprocessor binary # /usr/lib64/libmcpp.so.0.1.0 -- shared library (versioned) # /usr/lib64/libmcpp.so.0 -- soname symlink # /usr/lib64/libmcpp.so -- devel symlink # /usr/lib64/libmcpp.a -- static archive # /usr/lib64/libmcpp.la -- libtool archive (we'll remove) # /usr/include/mcpp_lib.h -- public header # /usr/include/mcpp_out.h -- public header # /usr/share/info/... -- texinfo docs # # Remove the .la file (Fedora policy for plain shared libs). rm -f %{buildroot}%{_libdir}/libmcpp.la %files %license LICENSE %doc ChangeLog README NEWS AUTHORS %{_bindir}/mcpp %{_libdir}/libmcpp.so.* %{_infodir}/mcpp*.info* %files devel %{_includedir}/mcpp_lib.h %{_includedir}/mcpp_out.h %{_libdir}/libmcpp.so %{_libdir}/libmcpp.a %changelog * Fri May 08 2026 Nick Schuetz - 2.7.2-1.rev2 - Fix: COPR build 10436552 (rev1) failed in 10s with autoreconf error "configure.ac:20: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL". mcpp's configure.ac uses libtool macros; autoreconf needs libtool's m4 files installed. Add `BuildRequires: libtool`. Trivial. * Fri May 08 2026 Nick Schuetz - 2.7.2-1.rev1 - Initial PoC: license-clean mcpp library + binary build for O3DE. - Source: upstream mcpp 2.7.2 tarball from sourceforge.net (Kiyoshi Matsui, BSD-2-Clause). Last upstream release 2008; abandonware-class but the C preprocessor problem is solved and the source is small + stable. - Patch0001: Amazon Lumberyard `_az.2` patch series, sourced verbatim from o3de/3p-package-source/package-system/mcpp/mcpp_2.7.2_az.patch. 566 lines, 11 hunks. Covers aarch64 host triplet detection, COMPILER macro defaults, whitespace cleanup, build-system tweaks. Apache-2.0 OR MIT licensed; compatible with BSD-2-Clause upstream. - Configure flags mirror o3de/3p-package-source/.../mcpp/ get_and_build_mcpp.py's Linux config: ./configure --with-pic --enable-mcpplib --with-pic builds PIC for shared library / engine builder linkage; --enable-mcpplib builds the in-process library in addition to the standalone CLI tool. - Sibling track to o3de-dxc-spirv (binary shellout) and o3de-spirv-cross (binary shellout): mcpp is the LIBRARY-LINK variant of the DXC-class binary-only dependency pattern. Engine code in Gems/Atom/Asset/Shader/Code/Source/Editor/CommonFiles/Preprocessor.cpp calls mcpp_lib_main / mcpp_set_out_func / mcpp_set_report_include_callback at asset-build time. - Engine-side glue (LY_USE_SYSTEM_MCPP bcond + Find shim or install-time symlink overlay) follows in a separate o3de-rpm spec edit once this PoC RPM lands green.