Change default build type to 'minsize'

This commit is contained in:
shixuantong 2022-08-27 15:30:01 +08:00
parent 6c39ae6a52
commit 281e640ed9
2 changed files with 90 additions and 2 deletions

View File

@ -0,0 +1,80 @@
From f967b5a25509d7495445b392307fdaa046e84be7 Mon Sep 17 00:00:00 2001
From: Kurtis Rader <krader@skepticism.us>
Date: Sun, 26 Jan 2020 21:00:50 -0800
Subject: [PATCH] Change default build type to "minsize"
People (and distros) have been building ksh from this project using the
default "debug" build type since we switched from Nmake to Meson. That
results in a ksh program whose performance is far from optimal. So change
the default build type. If a debugging enabled binary is needed, such as
in a CI environment, it must be requested explicitly.
Related #1449
(cherry picked from commit db54d369002a0e942d695838986af6bf8962d763)
---
CHANGELOG.md | 3 +++
meson.build | 11 ++++++++++-
scripts/build-on-docker.sh | 2 +-
scripts/build-on-macos.sh | 2 +-
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e38b780456e..8657ab1a2a15 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## Notable fixes and improvements
+- The default build type is now "minsize" since that dramatically improves the
+ performance of ksh. You can still request a debug build via `meson
+ --buildtype=debug` (issue #1449).
- Fix `history` command behavior when the *~/.sh_history* file has
specific content (issue #1432).
diff --git a/meson.build b/meson.build
index 0e5dc2483fb1..aecfe737c3f1 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,13 @@
-project('ksh93', 'c', default_options: ['b_lundef=false', 'default_library=static'])
+project('ksh9', 'c', default_options: [
+ # This is the optimal production build type for this project. If you need
+ # a debug build you must explicitly run `meson --buildtype=debug`. This
+ # helps ensure that each distro (or user) gets a performance optimized build
+ # even if they don't know to add the `--buildtype=minsize` option.
+ 'buildtype=minsize',
+ 'b_lundef=false',
+ 'default_library=static',
+ 'c_std=c99', # we require the C99 (aka ISO9899:1999) language standard
+])
source_dir = meson.current_source_dir()
cc = meson.get_compiler('c')
diff --git a/scripts/build-on-docker.sh b/scripts/build-on-docker.sh
index cd8138be9ab2..0b5af4a1d698 100755
--- a/scripts/build-on-docker.sh
+++ b/scripts/build-on-docker.sh
@@ -18,7 +18,7 @@ mkdir build
cd build
echo ==== Configuring the build
-if ! meson -Dwarnings-are-errors=true
+if ! meson -Dwarnings-are-errors=true --buildtype=debug
then
cat meson-logs/meson-log.txt
exit 1
diff --git a/scripts/build-on-macos.sh b/scripts/build-on-macos.sh
index 2732e370f8d8..163195accfff 100755
--- a/scripts/build-on-macos.sh
+++ b/scripts/build-on-macos.sh
@@ -15,7 +15,7 @@ mkdir build
cd build
echo ==== Configuring the build
-if ! meson -Dwarnings-are-errors=true
+if ! meson -Dwarnings-are-errors=true --buildtype=debug
then
cat meson-logs/meson-log.txt
exit 1

View File

@ -1,6 +1,6 @@
Name: ksh
Version: 2020.0.0
Release: 9
Release: 10
Summary: The Original ATT Korn Shell
License: EPL-1.0
URL: http://www.kornshell.com/
@ -17,7 +17,9 @@ Patch6001: backport-functions-with-not-loaded-autoloaded-functions.patch
Patch6002: backport-Fix-interactive-restricted-shell-behavior.patch
Patch9000: openEuler-skip-some-test.patch
Patch9001: backport-Fix-handling-of-skipped-directories.patch
Patch6003: backport-Fix-handling-of-skipped-directories.patch
Patch6004: backport-Change-default-build-type-to-minsize-to-imporve-the-performance.patch
Provides: /bin/ksh /usr/bin/ksh
BuildRequires: meson gcc glibc-devel ed
@ -94,6 +96,12 @@ done
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
%changelog
* Sat Aug 27 2022 shixuantong <shixuantong@h-partners.com> - 1:2020.0.0-10
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Change default build type to "minsize"
* Thu Jun 30 2022 wangjiang <wangjiang37@h-partners.com> - 1:2020.0.0-9
- Type:bugfix
- CVE:NA