Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions build-ps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generate percona-server.spec from template
# This file is processed by CMake's CONFIGURE_FILE with @ONLY mode,
# substituting @VARIABLE@ markers with CMake variable values.

IF(NOT LINUX)
RETURN()
ENDIF()

# Derive Percona Server version from MYSQL_VERSION_EXTRA (strip leading dash)
STRING(REGEX REPLACE "^-" "" PERCONA_SERVER_VERSION "${MYSQL_VERSION_EXTRA}")

# Git revision for the spec
IF(NOT DEFINED PERCONA_REVISION)
EXECUTE_PROCESS(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE PERCONA_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
IF(NOT PERCONA_REVISION)
SET(PERCONA_REVISION "unknown")
ENDIF()
ENDIF()

# RPM release number
IF(NOT DEFINED RPM_RELEASE)
SET(RPM_RELEASE "1")
ENDIF()

# Copyright year
STRING(TIMESTAMP MYSQL_COPYRIGHT_YEAR "%Y")

SET(SPECFILENAME "percona-server.spec")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/percona-server.spec.in
${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME}
@ONLY
)

MESSAGE(STATUS "Generated ${SPECFILENAME} with version ${MYSQL_NO_DASH_VERSION}-${PERCONA_SERVER_VERSION}")

# Generate DEB packaging files from templates
# TokuDB backup version
SET(TOKUDB_BACKUP_VERSION "${MYSQL_NO_DASH_VERSION}-${PERCONA_SERVER_VERSION}")

IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/debian/rules.in")
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/debian/rules.in
${CMAKE_CURRENT_BINARY_DIR}/debian/rules
@ONLY
)
MESSAGE(STATUS "Generated debian/rules")
ENDIF()
100 changes: 77 additions & 23 deletions build-ps/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,39 +263,93 @@ then
V8DIR="$(cd "$WITH_V8"; pwd)"
fi

# PGO + LTO settings
# WITH_PGO=1 (default) - enable Profile-Guided Optimization (3-pass build)
# WITH_PGO=0 - skip PGO (single cmake pass)
# Debug builds always skip PGO (no value profiling an unoptimized binary).
WITH_PGO="${WITH_PGO:-1}"
if [ "${CMAKE_BUILD_TYPE:-}" = "Debug" ]; then
WITH_PGO=0
fi

# Suppress GCC false positives that fire during LTO link on Bison-generated
# parsers (sql_hints.yy.cc, pars0grm.cc, etc.) and on bundled libs.
# Distro-built RPMs/DEBs get these via redhat-hardened-cc1 / dpkg-buildflags;
# the standalone tarball build doesn't, so add them explicitly. Matches the
# suppressions Oracle uses in their official MySQL RPM/DEB INFO_BIN.
# Parameterized warnings (-Walloc-size-larger-than=N etc.) require -Wno- form,
# not -Wno-error= form, in GCC 14+.
TARBALL_WARN_SUPPRESS="-Wno-free-nonheap-object -Wno-stringop-overflow -Wno-stringop-overread -Wno-alloc-size-larger-than -Wno-array-bounds"

# Common cmake flags shared across PGO instrumentation, PGO consume, and
# non-PGO builds. Each invocation appends its unique pass-specific flag.
CMAKE_COMMON_FLAGS=(
"$SOURCEDIR"
-DBUILD_CONFIG=mysql_release
-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:-RelWithDebInfo}"
-DCMAKE_C_FLAGS="${TARBALL_WARN_SUPPRESS}"
-DCMAKE_CXX_FLAGS="${TARBALL_WARN_SUPPRESS}"
-DFEATURE_SET=community
-DCMAKE_INSTALL_PREFIX="/usr/local/$PRODUCT_FULL"
-DMYSQL_DATADIR="/usr/local/$PRODUCT_FULL/data"
-DROUTER_INSTALL_LIBDIR="/usr/local/$PRODUCT_FULL/lib/mysqlrouter/private"
-DROUTER_INSTALL_PLUGINDIR="/usr/local/$PRODUCT_FULL/lib/mysqlrouter/plugin"
-DCOMPILATION_COMMENT="$COMMENT"
-DWITH_PAM=ON
-DWITH_ROCKSDB=ON
-DROCKSDB_DISABLE_AVX2=1
-DROCKSDB_DISABLE_MARCH_NATIVE=1
-DWITH_INNODB_MEMCACHED=ON
-DWITH_ZLIB=bundled
-DWITH_CURL=bundled
-DWITH_NUMA=ON
-DWITH_LDAP=system
-DWITH_PACKAGE_FLAGS=OFF
-DFORCE_INSOURCE_BUILD=1
-DWITH_LIBEVENT=bundled
-DWITH_ZSTD=bundled
-DWITH_PERCONA_TELEMETRY=ON
-DWITH_LTO=ON
-DWITH_JS_LANG=ON
-DV8_INCLUDE_DIR=${WITH_V8}/include
-DV8_LIB_DIR=${WITH_V8}/out.gn/static/obj
)

# Build
(
rm -rf "$WORKDIR_ABS/bld"
mkdir "$WORKDIR_ABS/bld"
cd "$WORKDIR_ABS/bld"

cmake $SOURCEDIR ${CMAKE_OPTS:-} -DBUILD_CONFIG=mysql_release \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-RelWithDebInfo} \
PGO_FIRST_FLAG=""
[ "${WITH_PGO}" = "1" ] && PGO_FIRST_FLAG="-DFPROFILE_GENERATE=1"

cmake "${CMAKE_COMMON_FLAGS[@]}" \
${CMAKE_OPTS:-} \
$DEBUG_EXTRA \
-DFEATURE_SET=community \
-DCMAKE_INSTALL_PREFIX="/usr/local/$PRODUCT_FULL" \
-DMYSQL_DATADIR="/usr/local/$PRODUCT_FULL/data" \
-DROUTER_INSTALL_LIBDIR="/usr/local/$PRODUCT_FULL/lib/mysqlrouter/private" \
-DROUTER_INSTALL_PLUGINDIR="/usr/local/$PRODUCT_FULL/lib/mysqlrouter/plugin" \
-DCOMPILATION_COMMENT="$COMMENT" \
-DWITH_PAM=ON \
-DWITH_ROCKSDB=ON \
-DROCKSDB_DISABLE_AVX2=1 \
-DROCKSDB_DISABLE_MARCH_NATIVE=1 \
-DWITH_INNODB_MEMCACHED=ON \
-DWITH_ZLIB=bundled \
-DWITH_CURL=bundled \
-DWITH_NUMA=ON \
-DWITH_LDAP=system \
-DWITH_PACKAGE_FLAGS=OFF \
-DFORCE_INSOURCE_BUILD=1 \
-DWITH_LIBEVENT=bundled \
-DWITH_ZSTD=bundled \
-DWITH_PERCONA_TELEMETRY=ON \
-DWITH_JS_LANG=ON -DV8_INCLUDE_DIR=${WITH_V8}/include -DV8_LIB_DIR=${WITH_V8}/out.gn/static/obj \
$PGO_FIRST_FLAG \
$WITH_MECAB_OPTION $OPENSSL_INCLUDE $OPENSSL_LIBRARY $CRYPTO_LIBRARY

make $MAKE_JFLAG $QUIET

if [ "${WITH_PGO}" = "1" ]; then
echo "PGO: running MTR profile suite to generate .gcda profile data"
make run-profile-suite

echo "PGO: rebuilding with profile data (-DFPROFILE_USE=1)"
cd "$WORKDIR_ABS"
rm -rf bld
mkdir bld
cd bld
cmake "${CMAKE_COMMON_FLAGS[@]}" \
${CMAKE_OPTS:-} \
$DEBUG_EXTRA \
-DFPROFILE_USE=1 \
$WITH_MECAB_OPTION $OPENSSL_INCLUDE $OPENSSL_LIBRARY $CRYPTO_LIBRARY

make $MAKE_JFLAG $QUIET
fi

make DESTDIR="$INSTALLDIR" install

# Build jemalloc
Expand Down
2 changes: 1 addition & 1 deletion build-ps/build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ PRODUCT="Percona-Server-$MYSQL_VERSION-$PERCONA_SERVER_VERSION"
# Build information
DISTRO_NAME="$(lsb_release -is)"
REDHAT_RELEASE="$(lsb_release -rs)"
REVISION="$(cd "$SOURCEDIR"; bzr revno)"
REVISION="$(cd "$SOURCEDIR"; git rev-parse --short HEAD 2>/dev/null || echo unknown)"

# Compilation flags
export CC="${CC:-gcc}"
Expand Down
1 change: 0 additions & 1 deletion build-ps/debian/compat

This file was deleted.

81 changes: 68 additions & 13 deletions build-ps/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ Uploaders: George Lorch <george.lorch@percona.com>,
Tomislav Plavcic <tomislav.plavcic@percona.com>
Build-Depends: bison,
cmake,
debhelper (>= 9.0.0),
debhelper-compat (= 13),
dh-apparmor,
fakeroot,
pkg-config,
libaio-dev[linux-any],
libmecab-dev,
libncurses5-dev (>= 5.0-6),
Expand All @@ -16,8 +18,11 @@ Build-Depends: bison,
po-debconf,
psmisc,
zlib1g-dev (>= 1:1.1.3-5),
liblz4-dev,
libzstd-dev,
libpam-dev,
libssl-dev,
libsystemd-dev,
libnuma-dev,
gcc (>= 4.4),
g++ (>= 4.4),
Expand Down Expand Up @@ -128,9 +133,31 @@ Description: Percona Server database common files (e.g. /etc/mysql/my.cnf)
This package includes files needed by all versions of the client library
(e.g. /etc/mysql/my.cnf).

Package: percona-server-client-plugins
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: mysql-client-plugins
Description: Percona Server - Client Plugins
This package contains shared plugins for Percona Server client applications,
including authentication plugins for LDAP, Kerberos, WebAuthn, OpenID Connect,
and OCI.

Package: percona-server-client-core
Architecture: any
Depends: percona-server-client-plugins (= ${binary:Version}),
${shlibs:Depends}, ${misc:Depends}
Provides: virtual-mysql-client-core
Description: Percona Server database core client binaries
Percona Server is a fast, stable and true multi-user, multi-threaded SQL
database server.
.
This package includes the core client binaries (mysql, mysqldump).

Package: percona-server-client
Architecture: any
Depends: percona-server-common (= ${binary:Version}),
percona-server-client-core (= ${binary:Version}),
percona-server-client-plugins (= ${binary:Version}),
${shlibs:Depends}, ${misc:Depends}
Provides: mysql-client,
virtual-mysql-client, virtual-mysql-client-core,
Expand Down Expand Up @@ -184,12 +211,26 @@ Description: Percona Server database client binaries
.
This package includes the client binaries.

Package: percona-server-server-core
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Provides: virtual-mysql-server-core
Breaks: mysql-server-core-8.0, mysql-community-server-core
Replaces: mysql-server-core-8.0, mysql-community-server-core
Description: Percona Server database core server binaries
Percona Server is a fast, stable and true multi-user, multi-threaded SQL
database server.
.
This package includes the core server binaries (mysqld), plugins, and
private shared libraries.

Package: percona-server-server
Architecture: any
Pre-Depends: adduser,
debconf (>= 0.2.17)
Depends: percona-server-common (= ${binary:Version}),
percona-server-client (= ${binary:Version}),
percona-server-server-core (= ${binary:Version}),
percona-telemetry-agent,
${shlibs:Depends}, ${misc:Depends},
psmisc,
Expand Down Expand Up @@ -274,20 +315,34 @@ Description: Percona Server 8.0 source
This package includes the source code to Percona Server as configured before
building.

Package: percona-server-dbg
Architecture: any
Section: debug
Depends: percona-server-server (= ${binary:Version}), ${misc:Depends}
Description: Debugging package for Percona Server
Percona Server is a fast, stable and true multi-user, multi-threaded SQL
database server. SQL (Structured Query Language) is the most popular database
query language in the world. The main goals of Percona Server are speed,
robustness and ease of use.
.
This package contains the debugging symbols for the Percona Server binaries.

Package: percona-mysql-router
Architecture: any
Description: Percona MySQL Router
Depends: ${shlibs:Depends}, ${misc:Depends}

Package: percona-server
Architecture: any
Depends: percona-server-server (= ${binary:Version}),
percona-server-client (= ${binary:Version}),
${misc:Depends}
Description: Percona Server (metapackage depending on the latest version)
This is an empty package that depends on the current percona-server-server
and percona-server-client packages. Install this package to get the latest
Percona Server version.

Package: percona-client
Architecture: any
Depends: percona-server-client (= ${binary:Version}),
${misc:Depends}
Description: Percona Server client (metapackage depending on the latest version)
This is an empty package that depends on the current percona-server-client
package. Install this package to get the latest Percona Server client tools.

Package: percona-testsuite
Architecture: any
Depends: percona-server-test (= ${binary:Version}),
${misc:Depends}
Description: Percona Server test suite (metapackage depending on the latest version)
This is an empty package that depends on the current percona-server-test
package. Install this package to get the latest Percona Server test suite.

3 changes: 3 additions & 0 deletions build-ps/debian/extra/percona-telemetry-cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# Cleanup Percona telemetry directory on package removal
rm -rf /usr/local/percona/telemetry/ps
15 changes: 15 additions & 0 deletions build-ps/debian/extra/percona-telemetry-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Setup Percona telemetry directory with proper ownership and SELinux context
PS_TELEMETRY=/usr/local/percona/telemetry/ps

mkdir -p "$PS_TELEMETRY"
chown mysql:percona-telemetry "$PS_TELEMETRY" 2>/dev/null || :
chmod 775 "$PS_TELEMETRY" 2>/dev/null || :
chmod g+s "$PS_TELEMETRY" 2>/dev/null || :
chmod u+s "$PS_TELEMETRY" 2>/dev/null || :
chcon -t mysqld_db_t "$PS_TELEMETRY" 2>/dev/null || :
chcon -u system_u "$PS_TELEMETRY" 2>/dev/null || :

# Setup telemetry UUID file
chgrp percona-telemetry /usr/local/percona/telemetry_uuid 2>/dev/null || :
chmod 664 /usr/local/percona/telemetry_uuid 2>/dev/null || :
48 changes: 48 additions & 0 deletions build-ps/debian/not-installed
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Files intentionally not installed to any package
usr/cmake/coredumper-relwithdebinfo.cmake
usr/cmake/coredumper.cmake
usr/include/kmip.h
usr/include/kmippp.h
usr/lib/*/pkgconfig/perconaserverclient.pc
usr/lib/libkmip.a
usr/lib/libkmippp.a
usr/share/mysql/LICENSE
usr/share/mysql/README.md
usr/share/mysql/mysql.server
usr/src/percona-server/percona-server-source.tar.gz
# Plugins packaged in percona-server-test or intentionally excluded
usr/lib/mysql/plugin/ha_mock.so
usr/lib/mysql/plugin/debug/ha_mock.so
usr/lib/mysql/plugin/ddl_rewriter.so
usr/lib/mysql/plugin/debug/ddl_rewriter.so
usr/lib/mysql/plugin/pfs_example_plugin_employee.so
usr/lib/mysql/plugin/component_test_audit_api_message.so
usr/lib/mysql/plugin/debug/component_test_audit_api_message.so
usr/lib/mysql/plugin/component_test_host_application_signal.so
usr/lib/mysql/plugin/debug/component_test_host_application_signal.so
usr/lib/mysql/plugin/test_services_host_application_signal.so
usr/lib/mysql/plugin/debug/test_services_host_application_signal.so
usr/lib/mysql/plugin/component_test_sensitive_system_variables.so
usr/lib/mysql/plugin/debug/component_test_sensitive_system_variables.so
usr/lib/mysql/plugin/component_test_event_tracking_consumer.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_consumer.so
usr/lib/mysql/plugin/component_test_event_tracking_consumer_a.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_consumer_a.so
usr/lib/mysql/plugin/component_test_event_tracking_consumer_b.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_consumer_b.so
usr/lib/mysql/plugin/component_test_event_tracking_consumer_c.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_consumer_c.so
usr/lib/mysql/plugin/component_test_event_tracking_producer_a.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_producer_a.so
usr/lib/mysql/plugin/component_test_event_tracking_producer_b.so
usr/lib/mysql/plugin/debug/component_test_event_tracking_producer_b.so
# Debug plugins already in server-core
usr/lib/mysql/plugin/debug/component_audit_api_message_emit.so
usr/lib/mysql/plugin/debug/component_log_filter_dragnet.so
usr/lib/mysql/plugin/debug/component_log_sink_json.so
usr/lib/mysql/plugin/debug/component_log_sink_syseventlog.so
usr/lib/mysql/plugin/debug/component_validate_password.so
usr/lib/mysql/plugin/debug/authentication_ldap_simple.so
# Router plugins
usr/lib/mysqlrouter/plugin/mysql_rest_service.so
usr/lib/mysqlrouter/private/libprotobuf.so.*
6 changes: 6 additions & 0 deletions build-ps/debian/percona-server-client-core.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Core client binaries
usr/bin/mysql
usr/bin/mysqldump
# man pages
usr/share/man/man1/mysql.1
usr/share/man/man1/mysqldump.1
Loading