From 7e15185a31343f9186826461b5bd9ceec17c4bf6 Mon Sep 17 00:00:00 2001 From: xuchongyu Date: Fri, 3 Mar 2023 18:04:20 +0800 Subject: [PATCH] Add safe compilation option -fPIE for GN --- add_safe_compilation_options.patch | 18 ++++++++++++++++++ gn.spec | 11 ++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 add_safe_compilation_options.patch diff --git a/add_safe_compilation_options.patch b/add_safe_compilation_options.patch new file mode 100644 index 0000000..0d1e023 --- /dev/null +++ b/add_safe_compilation_options.patch @@ -0,0 +1,18 @@ +From: "xuchogyu" +Date: Tue, 7 Mar 2023 09:52:37 +0800 +Subject: [PATCH] Add safe compilation option -fPIE for GN + +--- +diff -Nur a/build/gen.py b/build/gen.py +--- a/build/gen.py 2022-11-25 10:58:41.000000000 +0800 ++++ b/build/gen.py 2023-03-06 09:49:35.648580670 +0800 +@@ -371,7 +371,8 @@ + '-Wall', + '-Wextra', + '-Wno-unused-parameter', +- '-std=c++17' ++ '-std=c++17', ++ '-fPIE' + ]) + + if platform.is_linux() or platform.is_mingw() or platform.is_msys(): diff --git a/gn.spec b/gn.spec index 7810182..22d24eb 100644 --- a/gn.spec +++ b/gn.spec @@ -2,13 +2,14 @@ Name: gn Version: 1.0.0 -Release: 1 +Release: 2 Summary: Meta-build system that generates build files for Ninja License: BSD-3-Clause URL: https://gn.googlesource.com/gn Source0: %{url}/+archive/gn-%{commit}.tar.gz Source1: last_commit_position.h -Patch0: gn-always-python3.patch +Patch0000: gn-always-python3.patch +Patch0001: add_safe_compilation_options.patch BuildRequires: python3-devel ninja-build gcc-c++ clang emacs-common help2man @@ -71,10 +72,11 @@ find '%{buildroot}%{_datadir}/vim/vimfiles' \ install -t '%{buildroot}%{_emacs_sitestartdir}' -D -p -m 0644 misc/emacs/*.el install -t '%{buildroot}%{_mandir}/man1' -D -m 0644 -p out/gn.1 -rm -rf %{buildroot}%{_datadir}/vim/vimfiles/__pycache__ + %check out/gn_unittests +rm -rf %{buildroot}%{_datadir}/vim/vimfiles/__pycache__ %files @@ -100,5 +102,8 @@ out/gn_unittests %changelog +* Tue Mar 07 2023 xuchongyu 1.0.0-2 +- Add safe compilation options + * Tue Nov 29 2022 xuchongyu 1.0.0-1 - init