# https://docs.fedoraproject.org/en-US/quick-docs/publish-rpm-on-copr # http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html # https://rpm-software-management.github.io/rpm/manual/macros.html # https://rpm-packaging-guide.github.io/ %global _owner pgnd %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} # %%global __os_install_post %%{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 # %%global __brp_mangle_shebangs %%{nil} # %%global __brp_strip %%{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # RHEL8 rpmbuild and /usr/lib/.build-id # https://access.redhat.com/discussions/5045161 # %%global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with # MARIADB # https://github.com/MariaDB/server.git # https://src.fedoraproject.org/rpms/mariadb/blob/rawhide/f/mariadb.spec %global _mdb_name mariadb %global _mdb_pkgnm mariadb-current %global _mdb_unitnm mariadb %global _mdb_comment MariaDB Server (Current) %global _mdb_descrip %{expand: %{_mdb_comment}.} # https://spdx.org/licenses/GPL-2.0-only.html %global _mdb_license GPL-2.0-only %global _mdb_usr mysql %global _mdb_grp mysql %global _mdb_build_dir mdb-build %global _mdb_data_dir /data/db/mariadb %global _mdb_conf_dir /usr/local/etc/mariadb %global _mdb_install_dir /usr/local/%{_mdb_pkgnm} %global _mdb_ldconf_dir /etc/ld.so.conf.d %global _mdb_lib_dir_r lib64 %global _mdb_libexec_dir_r libexec %global _mdb_log_dir /var/log/mariadb %global _mdb_socket /run/mariadb/mariadb.sock %global _mdb_src_dir mariadb_%{_mdb_scm_branch} %global _mdb_tmp_dir /var/cache/mariadbtmp %global _mdb_unit_dir /etc/systemd/system %global _mdb_c /usr/bin/gcc %global _mdb_cxx /usr/bin/g++ %global _mdb_linker /usr/bin/ld.bfd %global _mdb_make_type ninja # https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/ %global _mdb_scm_repo MariaDB/server # %%global _mdb_scm_branch 10.11 # https://mariadb.com/kb/en/mariadb-server-release-dates/ %global _mdb_scm_branch 11.6 %global _mdb_scm_repo_esc %( echo %{_mdb_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _mdb_scm_repo_norm %( echo %{_mdb_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _mdb_scm_branch_norm %( echo %{_mdb_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _mdb_scm_host https://github.com %global _mdb_scm_host_api https://api.github.com/repos %global _mdb_scm_url %{_mdb_scm_host}/%{_mdb_scm_repo}.git %global _mdb_scm_tarball %{_mdb_scm_host_api}/%{_mdb_scm_repo}/tarball/%{commit0} # !!NOTE!! GH API tarball extracts to: %global _mdb_scm_extract_dir %{_mdb_scm_repo_norm}-%{shortcommit0} %global forgeurl0 %{_mdb_scm_url} %global commit0 %( git ls-remote %{forgeurl0} | grep /%{_mdb_scm_branch}$ | cut -f1 ) %global shortcommit0 %( c=%{commit0}; echo ${c} | head -c 7 ) %global forgesource0 %{_mdb_scm_tarball} %global extractdir0 %{_mdb_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} %forgemeta -i -a %global dist %{_dist} # NEVRA (n-e:v-r.a) Name: %{_mdb_pkgnm} Epoch: 0 Version: %{scm0}_%( echo %{_mdb_scm_branch} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_mdb_comment} License: %{_mdb_license} URL: %{forgeurl0} Source0: %{forgesource0} Source100: %{_mdb_unitnm}.service Source101: %{_mdb_unitnm}.target Source200: %{_mdb_name}-ld.conf BuildRequires: bash BuildRequires: bison BuildRequires: bison-devel BuildRequires: boost-devel BuildRequires: boost-http-server-devel BuildRequires: boost-mpich-devel BuildRequires: boost-mpich-python3-devel BuildRequires: boost-openmpi-devel BuildRequires: boost-openmpi-python3-devel BuildRequires: bzip2-devel BuildRequires: check BuildRequires: check-devel BuildRequires: cmake BuildRequires: cmake-filesystem BuildRequires: cmake-rpm-macros BuildRequires: coreutils BuildRequires: fmt BuildRequires: fmt-devel BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: grep BuildRequires: Judy-devel BuildRequires: libaio-devel BuildRequires: liburing-devel BuildRequires: libedit-devel BuildRequires: lzo-devel BuildRequires: lz4-devel BuildRequires: make BuildRequires: multilib-rpm-config BuildRequires: ncurses-devel BuildRequires: ninja-build BuildRequires: openssl BuildRequires: openssl-devel BuildRequires: pam-devel BuildRequires: pcre2-devel BuildRequires: perl-interpreter BuildRequires: perl-generators BuildRequires: perl(base) BuildRequires: perl(Cwd) BuildRequires: perl(Data::Dumper) BuildRequires: perl(English) BuildRequires: perl(Env) BuildRequires: perl(Errno) BuildRequires: perl(Exporter) BuildRequires: perl(Fcntl) BuildRequires: perl(File::Basename) BuildRequires: perl(File::Copy) BuildRequires: perl(File::Find) BuildRequires: perl(File::Spec) BuildRequires: perl(File::Spec::Functions) BuildRequires: perl(File::Temp) BuildRequires: perl(Getopt::Long) BuildRequires: perl(IO::File) BuildRequires: perl(IO::Handle) BuildRequires: perl(IO::Select) BuildRequires: perl(IO::Socket) BuildRequires: perl(IO::Socket::INET) BuildRequires: perl(IPC::Open3) BuildRequires: perl(lib) BuildRequires: perl(Memoize) BuildRequires: perl(POSIX) BuildRequires: perl(Socket) BuildRequires: perl(strict) BuildRequires: perl(Symbol) BuildRequires: perl(Sys::Hostname) BuildRequires: perl(Term::ANSIColor) BuildRequires: perl(Test::More) BuildRequires: perl(Time::HiRes) BuildRequires: perl(Time::localtime) BuildRequires: perl(warnings) BuildRequires: pkgconf BuildRequires: pigz BuildRequires: procps BuildRequires: python3 BuildRequires: python3-scons BuildRequires: selinux-policy-devel BuildRequires: snappy-devel BuildRequires: systemd BuildRequires: systemtap-devel BuildRequires: systemtap-sdt-devel BuildRequires: time BuildRequires: valgrind-devel BuildRequires: xz-devel BuildRequires: zlib-devel BuildRequires: systemd BuildRequires: systemd-rpm-macros %{?systemd_requires} Requires(pre): (user(%{_mdb_name}) and group(%{_mdb_name})) Requires: bash Requires: coreutils Requires: grep # Weak Dependencies Policy # https://docs.fedoraproject.org/en-US/packaging-guidelines/WeakDependencies/ Recommends: mariadb-java-client # Packaging:Conflicts # https://fedoraproject.org/wiki/Packaging:Conflicts Provides: %{_mdb_pkgnm} = %{_same_evr} Obsoletes: %{_mdb_pkgnm} < %{_same_evr} Conflicts: mariadb-lts Conflicts: galera Conflicts: mariadb Conflicts: mariadb-backup Conflicts: mariadb-common Conflicts: mariadb-connector-c Conflicts: mariadb-connector-c-config Conflicts: mariadb-connector-odbc Conflicts: mariadb-devel Conflicts: mariadb-embedded Conflicts: mariadb-server Conflicts: mariadb-server-galera Conflicts: community-mysql Conflicts: community-mysql-common Conflicts: community-mysql-devel Conflicts: community-mysql-libs Conflicts: community-mysql-server Conflicts: mysql Conflicts: mysql-libs Conflicts: mysql-server %description %{_mdb_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a cd %{_builddir} echo '##### MDB SINGLE BRANCH GIT CHECKOUT + SUBMODULE PREP #####' git clone --recurse-submodules -b %{_mdb_scm_branch} --single-branch %{_mdb_scm_url} %{_mdb_src_dir} rm -rf %{_mdb_src_dir}/storage/rocksdb #??? # https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html#prop_tgt:C_STANDARD # https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD sed -i 's|\([^ ]*SET(CMAKE_C_STANDARD\).*)|\1 17)|g' %{_mdb_src_dir}/CMakeLists.txt sed -i 's|\([^ ]*SET(CMAKE_CXX_STANDARD\).*)|\1 17)|g' %{_mdb_src_dir}/CMakeLists.txt grep -E "CMAKE_C_STANDARD|CMAKE_CXX_STANDARD" %{_mdb_src_dir}/CMakeLists.txt # SET(CMAKE_C_STANDARD 17) # SET(CMAKE_CXX_STANDARD 17) mkdir -p %{_mdb_src_dir}/scripts/ cp %{SOURCE100} %{SOURCE101} %{_mdb_src_dir}/scripts/ rm -rf %{archivename0} mv %{_mdb_src_dir} %{archivename0} %build # cref: # https://github.com/MariaDB/server.git # PLUGINS # Specifying Which Plugins to Build # https://mariadb.com/kb/en/specifying-which-plugins-to-build/ # https://mariadb.com/docs/server/ref/mdb/plugins/ echo '##### STARTING BUILD #####' cd %{_builddir} echo '##### MDB SOURCE FLAGS PREP #####' _this_CFLAGS="${CFLAGS}" _this_CFLAGS=$(echo ${_this_CFLAGS} | sed 's| -g | |g' \ | sed 's| -grecord-gcc-switches | |g' \ | sed 's| [^ ]*-flto=[^ ]* | |g' \ | sed 's| [^ ]*-lto-[^ ]* | |g' \ | sed 's| [^ ]*-std=[^ ]*| |g' \ ) _this_CFLAGS+=" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" _this_CFLAGS+=" -fPIC" _this_CFLAGS+=" -DDBUG_OFF" _this_CPPFLAGS="${_this_CFLAGS}" _this_CXXFLAGS="${_this_CFLAGS}" _this_LDFLAGS="${LDFLAGS}" BDO="" #BDO+=" --debug-output" #BDO+=" --debug-find" BDO+=" -Wno-dev" #BDO+=" -DNDEBUG" BDO+=" -DWITH_INNODB_EXTRA_DEBUG=0" BDO+=" -DWITH_VALGRIND=0" BDO+=" -DMYSQL_MAINTAINER_MODE=NO" BDO+=" -DENABLE_DTRACE=0" BDO+=" -DWITH_DBUG_TRACE=0" # How to compile install mariadb without mysql-test # https://jira.mariadb.org/browse/MDEV-14972 BDO+=" -DINSTALL_MYSQLTESTDIR=" # How to Compile MariaDB with Sanitizers # https://mariadb.com/kb/en/compile-and-using-mariadb-with-sanitizers-asan-ubsan-tsan-msan/ BDO+=" -DWITH_ASAN=0" BDO+=" -DWITH_UBSAN=0" BDO+=" -DWITH_TSAN=0" BDO+=" -DWITH_MSAN=0" _this_BUILD_DEBUG_OPTS=${BDO} export _this_CFLAGS _this_CXXFLAGS _this_CPPFLAGS _this_LDFLAGS unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS rm -rf "%{_mdb_build_dir}" mkdir -p "%{_mdb_build_dir}" # !! BROKEN @ MariaDB !! # CPackRPM broken on Fedora39 # https://gitlab.kitware.com/cmake/cmake/-/issues/25421 ## -DRPM=%%{fedora%%{fedora}} \ # CMAKE_BUILD_TYPE-STRINGS:INTERNAL=None;Debug;Release;MinSizeRel;RelWithDebInfo _this_CMAKE_BUILD_TYPE="None" #_this_CMAKE_BUILD_TYPE="Release" #_this_CMAKE_BUILD_TYPE="Debug" %if "%{_mdb_make_type}" == "ninja" _this_MAKEFILE_TYPE="Ninja" %else _this_MAKEFILE_TYPE="Unix Makefiles" %endif echo '##### MDB CMAKE DEFAULT CONFIG #####' cmake \ -LAH \ -S "%{archivename0}" \ -B "%{_mdb_build_dir}" \ -DCMAKE_POLICY_DEFAULT_CMP0056=NEW echo '##### MDB CMAKE CONFIG #####' cmake \ --fresh \ -DCMAKE_BUILD_TYPE=${_this_CMAKE_BUILD_TYPE} \ -S "%{archivename0}" \ -B "%{_mdb_build_dir}" \ -G "${_this_MAKEFILE_TYPE}" \ ${_this_BUILD_DEBUG_OPTS} \ -DBUILD_CONFIG=mysql_release \ -DCMAKE_VERBOSE_MAKEFILE=1 \ -DSECURITY_HARDENED=0 \ -DCMAKE_C_COMPILER="%{_mdb_c}" \ -DCMAKE_C_FLAGS="${_this_CFLAGS}" \ -DCMAKE_CXX_COMPILER="%{_mdb_cxx}" \ -DCMAKE_CXX_FLAGS="${_this_CXXFLAGS}" \ -DCMAKE_LINKER="%{_mdb_linker}" \ -DBUILD_SHARED_LIBS=1 \ -DCMAKE_EXE_LINKER_FLAGS="${_this_LDFLAGS}" \ -DCMAKE_SHARED_LINKER_FLAGS="${_this_LDFLAGS}" \ -DCMAKE_SKIP_INSTALL_RPATH=0 \ -DCMAKE_SKIP_RPATH=0 \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=1 \ -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci \ -DWITH_EXTRA_CHARSETS=all \ -DCMAKE_POLICY_DEFAULT_CMP0056=NEW \ -DCMAKE_INSTALL_PREFIX="%{_mdb_install_dir}" \ -DINSTALL_LAYOUT=STANDALONE \ -DDEFAULT_SYSCONFDIR=%{_mdb_conf_dir} \ -DINSTALL_INFODIR=share/info \ -DINSTALL_LIBDIR=lib64/%{_mdb_name} \ -DINSTALL_MANDIR=share/man \ -DINSTALL_MYSQLDATADIR=data \ -DINSTALL_MYSQLSHAREDIR=share/%{_mdb_name} \ -DINSTALL_PLUGINDIR=lib64/%{_mdb_name}/plugin \ -DINSTALL_SBINDIR=%{_mdb_libexec_dir_r} \ -DINSTALL_SCRIPTDIR=bin \ -DINSTALL_SUPPORTFILESDIR=share/%{_mdb_name} \ -DMARIADB_UNIX_ADDR=%{_mdb_socket} \ -DMYSQL_DATADIR=%{_mdb_data_dir} \ -DTMPDIR=%{_mdb_tmp_dir} \ -DWITH_LIBAIO=0 \ -DWITH_EMBEDDED_SERVER=0 \ -DWITH_LIBWRAP=0 \ -DWITH_MARIABACKUP=1 \ -DWITH_NUMA=0 \ -DWITH_PCRE=system \ -DWITH_PMEM=0 \ -DWITH_READLINE=1 \ -DWITH_SSL=system \ -DWITH_UNIT_TESTS=0 \ -DWITH_URING=1 \ -DWITH_VALGRIND=0 \ -DWITH_WSREP=1 \ -DWITH_INNODB_DISALLOW_WRITES=1 \ -DWITH_ZLIB=system \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_ARIA_STORAGE_ENGINE=1 \ -DUSE_ARIA_FOR_TMP_TABLES=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \ -DWITH_S3_STORAGE_ENGINE=0 \ -DPLUGIN_ARCHIVE=DYNAMIC \ -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ -DPLUGIN_DEBUG_KEY_MANAGEMENT=NO \ -DPLUGIN_EXAMPLE_KEY_MANAGEMENT=NO \ -DPLUGIN_FILE_KEY_MANAGEMENT=DYNAMIC \ -DPLUGIN_HASHICORP_KEY_MANAGEMENT=NO \ -DPLUGIN_BLACKHOLE=NO \ -DPLUGIN_CLIENT_ED25519=DYNAMIC \ -DPLUGIN_COLUMNSTORE=NO \ -DPLUGIN_CONNECT=DYNAMIC \ -DCONNECT_WITH_JDBC=1 \ -DCONNECT_WITH_MONGO=0 \ -DPLUGIN_CRACKLIB_PASSWORD_CHECK=DYNAMIC \ -DPLUGIN_FEDERATED=NO \ -DPLUGIN_FEDERATEDX=NO \ -DPLUGIN_FEEDBACK=NO \ -DPLUGIN_INNOBASE=YES \ -DPLUGIN_MROONGA=DYNAMIC \ -DPLUGIN_OQGRAPH=NO \ -DPLUGIN_PARTITION=YES \ -DPLUGIN_PERFSCHEMA=YES \ -DPLUGIN_ROCKSDB=NO \ -DPLUGIN_SEQUENCE=YES \ -DPLUGIN_SPHINX=NO \ -DPLUGIN_SPIDER=YES \ -DPLUGIN_S3=NO \ -DPLUGIN_TEST_SQL_DISCOVERY=NO # echo '##### RESULT CMAKECACHE #####' # cat "%%{_mdb_build_dir}/CMakeCache.txt" echo '##### MDB CMAKE BUILD #####' %if "%{_mdb_make_type}" == "ninja" _this_verbosity="--quiet" #_this_verbosity="--verbose" ninja -C "%{_mdb_build_dir}" -j${RPM_BUILD_NCPUS} ${_this_verbosity} %else cmake --build "%%{_mdb_build_dir}" -j${RPM_BUILD_NCPUS} --verbose %endif %install echo '##### STARTING INSTALL #####' cd %{_builddir} # _this_DESTDIR="/builddir/build/BUILDROOT/%%{_mdb_pkgnm}-%%{version}-%%{release}.%%{_arch}" %if "%{_mdb_make_type}" == "ninja" #_this_verbosity="--quiet" _this_verbosity="--verbose" DESTDIR="${RPM_BUILD_ROOT}" ninja install -C "%{_mdb_build_dir}" ${_this_verbosity} %else _this_verbosity="" _this_verbosity="--verbose" DESTDIR="${RPM_BUILD_ROOT}" cmake --install "%{_mdb_build_dir}" ${_this_verbosity} %endif rm ${RPM_BUILD_ROOT}/suite/plugins/pam/mariadb_mtr rm ${RPM_BUILD_ROOT}/suite/plugins/pam/pam_mariadb_mtr.so mkdir -p ${RPM_BUILD_ROOT}/%{_mdb_unit_dir} mkdir -p ${RPM_BUILD_ROOT}/%{_mdb_ldconf_dir} # GENERATE .service FILES, scripts sed -i \ -e 's|__MDB_CONFDIR__|%{_mdb_conf_dir}|g' \ -e 's|__MDB_EXEC__|%{_mdb_install_dir}/%{_mdb_libexec_dir_r}/mariadbd|g' \ -e 's|__MDB_LIBDIR__|%{_mdb_install_dir}/%{_mdb_lib_dir_r}|g' \ %{SOURCE100} %{SOURCE200} install -D --preserve-timestamps --mode=644 --verbose \ %{SOURCE100} \ ${RPM_BUILD_ROOT}/%{_mdb_unit_dir}/%{_mdb_unitnm}.service install -D --preserve-timestamps --mode=644 --verbose \ %{SOURCE101} \ ${RPM_BUILD_ROOT}/%{_mdb_unit_dir}/%{_mdb_unitnm}.target install -D -p -m 644 -v \ %{SOURCE200} \ ${RPM_BUILD_ROOT}/%{_mdb_ldconf_dir}/%{_mdb_pkgnm}.conf %check %pre %post %systemd_post %{_mdb_unitnm}.service %preun %systemd_preun %{_mdb_unitnm}.service %postun %systemd_postun_with_restart %{_mdb_unitnm}.service %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %{_mdb_install_dir} %{_mdb_unit_dir}/%{_mdb_unitnm}* %{_mdb_ldconf_dir}/%{_mdb_pkgnm}.conf %changelog * Thu Dec 5 2024 pgnd _ - bump 1733414169