!2 openEuler-rpm-config

Merge pull request !2 from syyhao/dev
This commit is contained in:
openeuler-ci-bot 2020-01-13 15:42:35 +08:00 committed by Gitee
commit 21b8361039
33 changed files with 4260 additions and 943 deletions

View File

@ -1,36 +0,0 @@
# openEuler-rpm-config
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,39 +0,0 @@
# openEuler-rpm-config
#### 介绍
{**以下是码云平台说明,您可以替换此简介**
码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN。专为开发者提供稳定、高效、安全的云端软件开发协作平台
无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

8
brp-ldconfig Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh -efu
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
/sbin/ldconfig -N -r "$RPM_BUILD_ROOT"

1462
config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1823
config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +1,27 @@
%global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler} %global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler}
Name: %{vendor}-rpm-config Name: %{vendor}-rpm-config
Version: 29 Version: 30
Release: 20 Release: 1
License: GPL+ License: GPL+
Summary: specific rpm configuration files Summary: specific rpm configuration files
URL: https://src.fedoraproject.org/rpms/redhat-rpm-config URL: https://gitee.com/src-openeuler/openEuler-rpm-config
# Core rpm settings Source1: brp-ldconfig
#fedora 29 snapshots from https://src.fedoraproject.org/rpms/redhat-rpm-config Source2: rpmrc
Source0: redhat-rpm-config-118.tar.gz Source3: macros
#https://src.fedoraproject.org/rpms/fpc-srpm-macros/blob/f29/f/macros.fpc-srpm Source4: config.guess
Source1: macros.fpc-srpm Source5: config.sub
#https://src.fedoraproject.org/rpms/ghc-srpm-macros/blob/f29/f/macros.ghc-srpm
Source2: macros.ghc-srpm
#https://src.fedoraproject.org/rpms/gnat-srpm-macros/blob/f29/f/macros.gnat-srpm
Source3: macros.gnat-srpm
#https://src.fedoraproject.org/rpms/nim-srpm-macros/tree/f29
Source4: macros.nim-srpm
#https://src.fedoraproject.org/rpms/ocaml-srpm-macros/blob/f29/f/macros.ocaml-srpm
Source5: macros.ocaml-srpm
#https://src.fedoraproject.org/rpms/openblas-srpm-macros/blob/f29/f/macros.openblas-srpm
Source6: macros.openblas-srpm
#https://src.fedoraproject.org/rpms/perl-srpm-macros/blob/f29/f/macros.perl-srpm
Source7: macros.perl-srpm
#https://pagure.io/fedora-rust/rust2rpm
Source8: macros.rust-srpm
#https://github.com/gofed/go-macros
Source9: macros.go-srpm
Source10: macros.perl
Source11: macros.python
Source12: macros.go
Source13: macros.forge
#python https://src.fedoraproject.org/rpms/python-rpm-macros/blob/f29/ Source20: openEuler-hardened-cc1
Source10: macros.python Source21: openEuler-hardened-ld
Source11: macros.python-srpm Source22: openEuler-pie-cc1
Source12: macros.python2 Source23: openEuler-pie-ld
Source13: macros.python3
Source14: macros.pybytecompile
Source99: macros.openEuler
Patch0: genericOS.patch
Patch1: remove-fcf-protection-for-gcc-7.3.0-x86_64.patch
Provides: python-rpm-macros = %{version}-%{release} Provides: python-rpm-macros = %{version}-%{release}
Provides: python2-rpm-macros = %{version}-%{release} Provides: python2-rpm-macros = %{version}-%{release}
@ -55,6 +36,8 @@ Provides: openblas-srpm-macros
Provides: perl-srpm-macros Provides: perl-srpm-macros
Provides: rust-srpm-macros Provides: rust-srpm-macros
Provides: go-srpm-macros Provides: go-srpm-macros
Provides: kernel-rpm-macros
Obsoletes: kernel-rpm-macros
Obsoletes: python-rpm-macros Obsoletes: python-rpm-macros
Obsoletes: python2-rpm-macros Obsoletes: python2-rpm-macros
Obsoletes: python3-rpm-macros Obsoletes: python3-rpm-macros
@ -73,7 +56,6 @@ Requires: efi-srpm-macros
Requires: qt5-srpm-macros Requires: qt5-srpm-macros
Requires: rpm >= 4.11.0 Requires: rpm >= 4.11.0
Requires: dwz >= 0.4
Requires: zip Requires: zip
#Requires: (annobin if gcc) #Requires: (annobin if gcc)
@ -81,7 +63,7 @@ Requires: zip
Requires: %{_bindir}/find Requires: %{_bindir}/find
Requires: %{_bindir}/file Requires: %{_bindir}/file
Requires: %{_bindir}/grep Requires: %{_bindir}/grep
Requires: sed Requires: %{_bindir}/sed
Requires: %{_bindir}/xargs Requires: %{_bindir}/xargs
# -fstack-clash-protection and -fcf-protection require GCC 8. # -fstack-clash-protection and -fcf-protection require GCC 8.
@ -89,83 +71,37 @@ Conflicts: gcc < 7
Provides: system-rpm-config = %{version}-%{release} Provides: system-rpm-config = %{version}-%{release}
%global rrcdir /usr/lib/rpm/%{vendor} %global rpmvdir /usr/lib/rpm/%{vendor}
%description %description
specific rpm configuration files for %{vendor}. specific rpm configuration files for %{vendor}.
%package -n kernel-rpm-macros
Summary: Macros and scripts for building kernel module packages
Requires: %{vendor}-rpm-config
%description -n kernel-rpm-macros
Macros and scripts for building kernel module packages.
%prep %prep
sed -i "s/generic_os/%{vendor}/g" $RPM_SOURCE_DIR/genericOS.patch %setup -c -T
cp -p %{sources} .
%setup -T -c
tar -xf %{SOURCE0} --strip-components 1
%patch0 -p1
%patch1 -p1
mv redhat-hardened-cc1 %{vendor}-hardened-cc1
mv redhat-hardened-ld %{vendor}-hardened-ld
mv redhat-annobin-cc1 %{vendor}-annobin-cc1
%install %install
mkdir -p %{buildroot}%{rrcdir} mkdir -p %{buildroot}%{rpmvdir}
install -p -m 644 -t %{buildroot}%{rrcdir} macros rpmrc install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc
install -p -m 444 -t %{buildroot}%{rrcdir} %{vendor}-hardened-* install -p -m 755 -t %{buildroot}%{rpmvdir} config.*
install -p -m 444 -t %{buildroot}%{rrcdir} %{vendor}-annobin-* install -p -m 755 -t %{buildroot}%{rpmvdir} brp-*
install -p -m 755 -t %{buildroot}%{rrcdir} config.* install -p -m 644 -t %{buildroot}%{rpmvdir} openEuler-*
install -p -m 755 -t %{buildroot}%{rrcdir} dist.sh rpmsort symset-table kmodtool
install -p -m 755 -t %{buildroot}%{rrcdir} brp-*
install -p -m 755 -t %{buildroot}%{rrcdir} find-*
mkdir -p %{buildroot}%{rrcdir}/find-provides.d
install -p -m 644 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalias.prov
install -p -m 755 -t %{buildroot}%{rrcdir} brp-*
mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.* install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ %{SOURCE11} %{SOURCE12} %{SOURCE13}
mkdir -p %{buildroot}%{_fileattrsdir} mkdir -p %{buildroot}%{_fileattrsdir}
install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr
install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
install -m 644 %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} \
%{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE99}\
%{buildroot}/%{rpmmacrodir}/
%files %files
%dir %{rrcdir} %dir %{rpmvdir}
%{rrcdir}/macros %{rpmvdir}/macros
%{rrcdir}/rpmrc %{rpmvdir}/rpmrc
%{rrcdir}/brp-* %{rpmvdir}/brp-*
%{rrcdir}/dist.sh %{rpmvdir}/config.*
%{rrcdir}/%{vendor}-hardened-* %{rpmvdir}/openEuler-*
%{rrcdir}/%{vendor}-annobin-* %{_fileattrsdir}/
%{rrcdir}/config.* %{_rpmconfigdir}/macros.d/
%{rrcdir}/find-provides %{_rpmconfigdir}/macros.d/*
%{rrcdir}/find-requires
%{rrcdir}/brp-ldconfig
%{_fileattrsdir}/*.attr
%{_rpmconfigdir}/kmod.prov
%{_rpmconfigdir}/macros.d/macros.*
%doc buildflags.md
%exclude %{_rpmconfigdir}/macros.d/macros.kmp
%files -n kernel-rpm-macros
%dir %{rrcdir}/find-provides.d
%{rrcdir}/kmodtool
%{rrcdir}/rpmsort
%{rrcdir}/symset-table
%{rrcdir}/find-provides.ksyms
%{rrcdir}/find-requires.ksyms
%{rrcdir}/find-provides.d/firmware.prov
%{rrcdir}/find-provides.d/modalias.prov
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> 29-20 * Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> 29-20

View File

@ -1,193 +0,0 @@
diff -urN a/buildflags.md b/buildflags.md
--- a/buildflags.md 2019-08-08 06:06:41.000000000 +0000
+++ b/buildflags.md 2019-08-09 06:55:22.060000000 +0000
@@ -208,7 +208,7 @@
For hardened builds (which are enabled by default, see above for how
to disable them), the flag
-`-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1` is added to the
+`-specs=/usr/lib/rpm/generic_os/redhat-hardened-cc1` is added to the
command line. It adds the following flag to the command line:
* `-fPIE`: Compile for a position-independent executable (PIE),
@@ -231,7 +231,7 @@
To support [binary watermarks for ELF
objects](https://fedoraproject.org/wiki/Toolchain/Watermark) using
-annobin, the `-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1` flag is
+annobin, the `-specs=/usr/lib/rpm/generic_os/redhat-annobin-cc1` flag is
added by default. This can be switched off by undefining the
`%_annotated_build` RPM macro (see above).
@@ -314,7 +314,7 @@
(optional, see above).
For hardened builds, the
-`-specs=/usr/lib/rpm/redhat/redhat-hardened-ld` flag is added to the
+`-specs=/usr/lib/rpm/generic_os/redhat-hardened-ld` flag is added to the
compiler driver command line. (This can be disabled by undefining the
`%_hardened_build` macro; see above) This activates the following
linker flags:
diff -urN a/dist.sh b/dist.sh
--- a/dist.sh 2019-08-08 06:06:41.000000000 +0000
+++ b/dist.sh 2019-08-09 06:55:22.060000000 +0000
@@ -11,7 +11,7 @@
# If we successfully detect the version number, we output the
# dist tag. Otherwise, we exit with no output.
-RELEASEFILE=/etc/redhat-release
+RELEASEFILE=/etc/generic_os-release
function check_num {
MAINVER=`cut -d "(" -f 1 < $RELEASEFILE | \
diff -urN a/find-provides b/find-provides
--- a/find-provides 2019-08-08 06:06:41.000000000 +0000
+++ b/find-provides 2019-08-09 06:55:22.060000000 +0000
@@ -15,7 +15,7 @@
#
# --- any other extra find-provides scripts
-for i in /usr/lib/rpm/redhat/find-provides.d/*.prov
+for i in /usr/lib/rpm/generic_os/find-provides.d/*.prov
do
[ -x $i ] &&
(echo $filelist | tr '[:blank:]' \\n | $i | sort -u)
@@ -44,7 +44,7 @@
unset is_kmod
fi
-[ -x /usr/lib/rpm/redhat/find-provides.ksyms ] && [ "$is_kmod" ] &&
- printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-provides.ksyms
+[ -x /usr/lib/rpm/generic_os/find-provides.ksyms ] && [ "$is_kmod" ] &&
+ printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/generic_os/find-provides.ksyms
exit 0
diff -urN a/find-requires b/find-requires
--- a/find-requires 2019-08-08 06:06:41.000000000 +0000
+++ b/find-requires 2019-08-09 06:55:22.060000000 +0000
@@ -33,7 +33,7 @@
done
# Disabling for now while the Fedora kernel doesn't produce kABI deps.
-#[ -x /usr/lib/rpm/redhat/find-requires.ksyms ] && [ "$is_kmod" ] &&
-# printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/redhat/find-requires.ksyms
+#[ -x /usr/lib/rpm/generic_os/find-requires.ksyms ] && [ "$is_kmod" ] &&
+# printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/generic_os/find-requires.ksyms
exit 0
diff -urN a/macros b/macros
--- a/macros 2019-08-08 06:06:41.000000000 +0000
+++ b/macros 2019-08-09 06:57:55.040000000 +0000
@@ -3,7 +3,7 @@
#==============================================================================
# ---- per-platform macros.
#
-%_vendor redhat
+%_vendor generic_os
%_os linux
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
@@ -77,7 +77,7 @@
%configure \
%{set_build_flags}; \
[ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
- [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
+ [ -f /usr/lib/rpm/generic_os/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/generic_os/$(basename $i) $i ; \
done ; \
[ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
for i in $(find . -name ltmain.sh) ; do \
@@ -136,7 +136,7 @@
# Build root policy macros. Standard naming:
# convert all '-' in basename to '_', add two leading underscores.
-%__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig
+%__brp_ldconfig /usr/lib/rpm/generic_os/brp-ldconfig
%__brp_compress /usr/lib/rpm/brp-compress
%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
@@ -147,7 +147,7 @@
# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
# __brp_mangle_shebangs_exclude_from - files to ignore
# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
-%__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
+%__brp_mangle_shebangs /usr/lib/rpm/generic_os/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
%__os_install_post \
%{?__brp_ldconfig} \
@@ -193,9 +193,9 @@
# Use XZ compression for binary payloads
%_binary_payload w2.xzdio
-%_hardening_cflags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
+%_hardening_cflags -specs=/usr/lib/rpm/generic_os/generic_os-hardened-cc1
# we don't escape symbols '~', '"', etc. so be careful when changing this
-%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
+%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/generic_os/generic_os-hardened-ld
# Harden packages by default for Fedora 23:
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
@@ -204,12 +204,14 @@
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
-%_annobin_cflags -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
+#%_annobin_cflags -specs=/usr/lib/rpm/generic_os/generic_os-annobin-cc1
+%_annobin_cflags %{nil}
# Add extra information to binary objects created by gcc for Fedora 28:
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
# Use "%undefine _annotated_build" to disable.
-%_annotated_build 1
+#%_annotated_build 1
+%undefine _annotated_build
%_annotated_cflags %{?_annotated_build:%{_annobin_cflags}}
# Fail linking if there are undefined symbols. Required for proper
diff -urN a/macros.kmp b/macros.kmp
--- a/macros.kmp 2019-08-08 06:06:41.000000000 +0000
+++ b/macros.kmp 2019-08-09 06:55:22.060000000 +0000
@@ -2,8 +2,8 @@
redhat_kernel_module_package 1
kernel_module_package_release 1
-%__find_provides /usr/lib/rpm/redhat/find-provides
-%__find_requires /usr/lib/rpm/redhat/find-requires
+%__find_provides /usr/lib/rpm/generic_os/find-provides
+%__find_requires /usr/lib/rpm/generic_os/find-requires
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
# [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
@@ -12,10 +12,10 @@
kernel-devel
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
- %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
+ %define kmodtool %{-s*}%{!-s:/usr/lib/rpm/generic_os/kmodtool} \
%define kmp_version %{-v*}%{!-v:%{version}} \
%define kmp_release %{-r*}%{!-r:%{release}} \
- %define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
+ %define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/generic_os/rpmsort -r | head -n 1` | head -n 1) \
%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
flavors="default" \
diff -urN a/redhat-rpm-config.spec b/redhat-rpm-config.spec
--- a/redhat-rpm-config.spec 2019-08-08 06:06:41.000000000 +0000
+++ b/redhat-rpm-config.spec 2019-08-09 06:55:22.060000000 +0000
@@ -110,7 +110,7 @@
Provides: system-rpm-config = %{version}-%{release}
-%global rrcdir /usr/lib/rpm/redhat
+%global rrcdir /usr/lib/rpm/generic_os
%description
Red Hat specific rpm configuration files.
@@ -952,7 +952,7 @@
* Mon Jul 7 2003 Jens Petersen <petersen@redhat.com> - 8.0.25-1
- update config.{guess,sub} to 2003-06-17
-- define VENDOR to be redhat only when /etc/redhat-release present
+- define VENDOR to be redhat only when /etc/generic_os-release present
[suggested by jbj]
- put VENDOR in vendor field in our config.guess file for
ia64, ppc, ppc64, s390, s390x, x86_64 and elf32-i386 Linux

294
macros Normal file
View File

@ -0,0 +1,294 @@
# Per-platform rpm configuration file.
%_vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler}
%_os linux
%_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
#==============================================================================
# ---- configure macros. note that most of these are inherited
# from the defaults.
#
%_localstatedir /var
%_pkgdocdir %{_docdir}/%{name}
%_docdir_fmt %%{NAME}
%_fmoddir %{_libdir}/gfortran/modules
%_enable_debug_packages 1
#%_include_minidebuginfo 1
%_include_gdb_index 1
%_debugsource_packages 1
#%_debuginfo_subpackages 1
#==============================================================================
# ---- compiler flags.
%build_cflags %{optflags}
%build_cxxflags %{optflags}
%build_fflags %{optflags} -I%{_fmoddir}
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags}
%set_build_flags \
CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
#For backwards compatibility only.
%__global_cflags %{build_cflags}
%__global_cxxflags %{build_cxxflags}
%__global_fflags %{build_fflags}
%__global_fcflags %{build_fflags}
%__global_ldflags %{build_ldflags}
#==============================================================================
# ---- configure and makeinstall.
%_configure_gnuconfig_hack 1
%_configure_libtool_hardening_hack 1
%configure \
%{set_build_flags}; \
[ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
[ -f /usr/lib/rpm/openEuler/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/openEuler/$(basename $i) $i ; \
done ; \
[ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
for i in $(find . -name ltmain.sh) ; do \
%{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \
done ; \
%{_configure} --build=%{_build} --host=%{_host} \\\
--program-prefix=%{?_program_prefix} \\\
--disable-dependency-tracking \\\
%{?_configure_disable_silent_rules:--disable-silent-rules} \\\
--prefix=%{_prefix} \\\
--exec-prefix=%{_exec_prefix} \\\
--bindir=%{_bindir} \\\
--sbindir=%{_sbindir} \\\
--sysconfdir=%{_sysconfdir} \\\
--datadir=%{_datadir} \\\
--includedir=%{_includedir} \\\
--libdir=%{_libdir} \\\
--libexecdir=%{_libexecdir} \\\
--localstatedir=%{_localstatedir} \\\
--sharedstatedir=%{_sharedstatedir} \\\
--mandir=%{_mandir} \\\
--infodir=%{_infodir}
# ---- Build policy macros.
%__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
mkdir -p `dirname "$RPM_BUILD_ROOT"`\
mkdir "$RPM_BUILD_ROOT"\
%{nil}
# ---- Expanded at end of %install scriptlet.
%__arch_install_post /usr/lib/rpm/check-buildroot
# Build root policy macros. Standard naming:
# convert all '-' in basename to '_', add two leading underscores.
%__brp_ldconfig /usr/lib/rpm/openEuler/brp-ldconfig
%__brp_compress /usr/lib/rpm/brp-compress
%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
%__os_install_post \
%{?__brp_ldconfig} \
%{?__brp_compress} \
%{!?__debug_package:\
%{?__brp_strip} \
%{?__brp_strip_comment_note} \
} \
%{?__brp_strip_static_archive} \
%{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \
%{?__brp_python_hardlink} \
%{nil}
%__spec_install_post\
%{?__debug_package:%{__debug_install_post}}\
%{__arch_install_post}\
%{__os_install_post}\
%{nil}
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
%%install\
%{nil}
#
# Should missing buildids terminate a build?
%_missing_build_ids_terminate_build 1
#
## Automatically compile python files
%py_auto_byte_compile 1
#
## Should python bytecompilation errors terminate a build?
%_python_bytecompile_errors_terminate_build 1
## Should python bytecompilation compile outisde python specific directories?
%_python_bytecompile_extra 1
# Use SHA-256 for FILEDIGESTS instead of default MD5
%_source_filedigest_algorithm 8
%_binary_filedigest_algorithm 8
# Use XZ compression for binary payloads
%_binary_payload w2.xzdio
# secure options for rpmbuild
#
# #hardened options
%_hardening_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-hardened-cc1
%_hardening_ldflags -Wl,-z,now -specs=/usr/lib/rpm/%{_vendor}/openEuler-hardened-ld
# Use "%undefine _hardened_build" to disable.
%_hardened_build 1
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}}
#secure options pie
%_sec_opt_build 1
#Use "%undefine _sec_opt_build" to disable.
#Use "%undefine _pie_build" to disable.
%_pie_build 1
%_pie_pre_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-pie-cc1
%_pie_pre_ldflags -Wl,-z,now -specs=/usr/lib/rpm/%{_vendor}/openEuler-pie-ld
%_pie_cflags %{?_sec_opt_build:?_pie_build:%{_pie_pre_cflags}}
%_pie_ldflags %{?_sec_opt_build:?_pie_build:%{_pie_pre_ldflags}}
#Use "%undefine _fs_build" to disable.
%_fs_build 1
%_fs_pre_cflags -specs=/usr/lib/rpm/%{_vendor}/openEuler-fs-cc1
%_fs_cflags %{?_fs_build:%{_fs_pre_cflags}}
# Fail linking if there are undefined symbols. Required for proper
# ELF symbol versioning support. Disabled by default.
# Use "%define _ld_strict_symbol_defs 1" to enable.
#%_ld_strict_symbol_defs 1
%_ld_symbols_flags %{?_ld_strict_symbol_defs:-Wl,-z,defs}
# use "%define _ld_as_needed 1" to enable.
#%_ld_as_needed 1
%_ld_as_needed_flags %{?_ld_as_needed:-Wl,--as-needed}
%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags}
# Automatically trim changelog entries after 2 years
%_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)}
#==============================================================================
# ---- Generic auto req/prov filtering macros
# prevent anything matching from being scanned for provides
%filter_provides_in(P) %{expand: \
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
}
# prevent anything matching from being scanned for requires
%filter_requires_in(P) %{expand: \
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
}
# filter anything matching out of the provides stream
%filter_from_provides() %{expand: \
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
}
# filter anything matching out of the requires stream
%filter_from_requires() %{expand: \
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
}
# actually set up the filtering bits
%filter_setup %{expand: \
%global _use_internal_dependency_generator 0 \
%global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
%global __find_requires /bin/sh -c "%{?__filter_req_cmd} %{__deploop R} %{?__filter_from_req}" \
}
# compare two versions, returns -1, 0, 1, ~~~
%rpm_vercmp() %{lua:print(rpm.expand('%1') == '~~~' and '~~~' or rpm.vercmp(rpm.expand('%1'), rpm.expand('%2')))}
# expand to the installed version of a package/provides
%pkg_version() %(LC_ALL=C rpm -q --whatprovides --qf "%%{version}" "%1" | sed -e "s/^no package provides .*/~~~/")
# compare the installed version to a value. returns -1, 0, 1, ~~~
%pkg_version_cmp() %{expand:%{expand:%%%%{rpm_vercmp %%{pkg_version %1} %%2}}}
# convenience/readability
%pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0)
#arches macros
%generic_arches %{ix86} x86_64 %{arm} aarch64
%ldc_arches %{generic_arches}
%valgrind_arches %{generic_arches}
%nodejs_arches %{generic_arches}
%ldc_arches %{generic_arches}
%mono_arches %{generic_arches}
%fpc_arches %{generic_arches}
%ghc_arches_with_ghci %{generic_arches}
%ghc_arches %{generic_arches}
%GNAT_arches %{GPRbuild_arches} %{generic_arches}
%GPRbuild_arches %{generic_arches}
%nim_arches %{generic_arches}
%nodejs_arches %{generic_arches}
%ocaml_native_compiler %{generic_arches}
%ocaml_natdynlink %{generic_arches}
%ocaml_native_profiling %{generic_arches}
%openblas_arches %{generic_arches}
#%ldconfig /sbin/ldconfig
%ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_postun(n:) %{?ldconfig:%postun -p %ldconfig %{?*} %{-n:-n %{-n*}}\
%end}
%ldconfig_scriptlets(n:) %{?ldconfig:\
%ldconfig_post %{?*} %{-n:-n %{-n*}}\
%ldconfig_postun %{?*} %{-n:-n %{-n*}}\
}
# Some miscellaneous macros
%_metainfodir %{_datadir}/metainfo
%rpmmacrodir /usr/lib/rpm/macros.d
# arches that mono builds on
%_monogacdir %{_monodir}/gac
%_monodir %{_prefix}/lib/mono
# ---- VPATH default settings
%_vpath_builddir %_target_platform
%_vpath_srcdir .
# ---- custom macros
%disable_rpath \
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool \
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%delete_la_and_a \
find $RPM_BUILD_ROOT -type f -name "*.la" -delete \
find $RPM_BUILD_ROOT -type f -name "*.a" -delete
%delete_la find $RPM_BUILD_ROOT -type f -name "*.la" -delete
%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\<ELF\>" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {}
%package_help \
%package help \
Summary: Documents for %{name} \
Buildarch: noarch \
Requires: man info \
\
%description help \
Man pages and other related documents for %{name}.
#%sbin_installinfo_rm bc.info
#%sbin_installinfo_rm bc.info.gz
%install_info() \
/sbin/install-info %1 %{_infodir}/dir || :
%install_info_rm() \
/sbin/install-info --remove %1 %{_infodir}/dir || :

283
macros.forge Normal file
View File

@ -0,0 +1,283 @@
# Map forge information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variables SHOULD be set before calling the macro:
#
# forgeurl the project url on the forge, strongly recommended;
# alternatively, use -u <url>
# Version if applicable, set it with Version: <version>
# tag if applicable
# commit if applicable
# date if applicable (to override the mtime of the Source archive)
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
# forgesource an URL that can be used as SourceX: value
# forgesetupargs the correct arguments to pass to %setup for this source
# used by %forgesetup and %forgeautosetup
# archivename the source archive filename, without extentions
# archiveext the source archive filename extensions, without leading dot
# archiveurl the url that can be used to download the source archive,
# without renaming
# scm the scm type, when packaging code snapshots: commits or tags
#
# If the macro is unable to parse your forgeurl value set at least archivename
# and archiveurl before calling it.
#
# Most of the computed variables are both overridable and optional. However,
# the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag).
# The previous %{dist} value will be lost. Dont call the macro if you dont
# wish %{dist} to be changed.
#
# Optional parameters:
# -u <url> Ignore forgeurl even if it exists and use <url> instead. Note
# that the macro will still end up setting <url> as the forgeurl
# spec variable if it manages to parse it.
# -s Silently ignore problems in forgeurl, use it if it can be parsed,
# ignore it otherwise.
# -p Restore problem handling, override -s.
# -v Be verbose and print every spec variable the macro sets.
# -i Print some info about the state of spec variables the macro may use or
# set at the end of the processing.
%forgemeta(u:spvi) %{lua:
local forgeurl = rpm.expand("%{?-u*}")
if (forgeurl == "") then
forgeurl = rpm.expand("%{?forgeurl}")
end
local silent = false
local verbose = false
local informative = false
if (rpm.expand("%{?-s}") ~= "") then
silent = true
end
if (rpm.expand("%{?-p}") ~= "") then
silent = false
end
if (rpm.expand("%{?-v}") ~= "") then
verbose = true
end
if (rpm.expand("%{?-i}") ~= "") then
informative = true
end
local tag = rpm.expand("%{?tag}")
local commit = rpm.expand("%{?commit}")
-- Be explicit about the spec variables were setting
local function explicitset(rpmvariable,value)
rpm.define(rpmvariable .. " " .. value)
if verbose then
rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\\n}")
end
end
-- Never ever stomp on a spec variable the packager already set
local function safeset(rpmvariable,value)
if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then
explicitset(rpmvariable,value)
end
end
-- Set spec variable values for each known software publishing service
if (forgeurl ~= "") then
local forge = string.match(forgeurl, "^[^:]+://([^/]+)/")
if (forge == nil) then
if not silent then
rpm.expand("%{error:URLs must include a protocol such as https:// and a path starting with / !\\n}")
end
else
if (string.match(forge, "^gitlab[%.-]") or string.match(forge, "[%.-]gitlab[%.]")) then
forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
if (forgeurl == nil) then
if not silent then
rpm.expand("%{error:Gitlab URLs must match https://(…[-.])gitlab[-.]…/owner/repo !\\n}")
end
else
explicitset("forgeurl", forgeurl)
if (commit == "") then
rpm.expand("%{error:All Gitlab URLs require commit value knowledge: you need to define %{commit}!\\nPlease vote on https://gitlab.com/gitlab-org/gitlab-ce/issues/38830\\n}")
end
safeset("archiveext", "tar.bz2")
safeset("forgesetupargs", "-n %{archivename}")
if (commit ~= "") or (tag ~= "") then
safeset("scm", "git")
end
local owner = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
local repo = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
local version = rpm.expand("%{?version}")
if (version ~= "") and (version ~= "0") and (tag == "") then
-- GitLab does not have strong versionning semantics
-- Some projects use "version" as release tag, others "v" + "version"
-- Tag value needs to be explicitly declared before calling the macro
-- in the second case
tag = version
safeset("tag", tag)
end
if (tag ~= "") then
safeset("archivename", repo .. "-%{tag}-%{commit}")
safeset("archiveurl", "%{forgeurl}/repository/%{tag}/archive.%{archiveext}")
else
safeset("archivename", repo .. "-%{commit}")
safeset("archiveurl", "%{forgeurl}/repository/%{commit}/archive.%{archiveext}")
end
end
end
if (string.match(forge, "^github[%.-]") or string.match(forge, "[%.-]github[%.]")) then
forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
if (forgeurl == nil) then
if not silent then
rpm.expand("%{error:GitHub URLs must match https://(…[-.])github[-.]…/owner/repo !\\n}")
end
else
explicitset("forgeurl", forgeurl)
safeset("archiveext", "tar.gz")
local forgesetupargs = "-n %{archivename}"
if (commit ~= "") or (tag ~= "") then
safeset("scm", "git")
end
local owner = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
local repo = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
if (tag ~= "") then
-- if upstream used a version suffix such as -rc1 or -beta it will not
-- be a valid version string for rpm but github will accept it fine and
-- use the same naming as for other versions: v prefix in the tag and
-- archivename, no v prefix in the topdir naming inside the archive
local version = rpm.expand("%{?version}")
if version ~= "" and
(string.match(tag, "^v" .. version .. "[^%d]") or
string.match(tag, "^v" .. version .. "$")) then
forgesetupargs = "-n " .. repo .. "-" .. string.gsub(tag, "^v", "")
end
safeset("archivename", repo .. "-%{tag}")
safeset("archiveurl", "%{forgeurl}/archive/%{tag}.%{archiveext}")
else
if (commit ~= "") then
safeset("archivename", repo .. "-%{commit}")
safeset("archiveurl", "%{forgeurl}/archive/%{commit}/" .. repo .. "-%{commit}.%{archiveext}")
else
safeset("archivename", repo .. "-%{version}")
safeset("archiveurl", "%{forgeurl}/archive/v%{version}.%{archiveext}")
end
end
safeset("forgesetupargs", forgesetupargs)
end
end
if (forge == "code.googlesource.com") then
forgeurl = string.match(forgeurl, "https://code.googlesource.com/[^#?]*[^/#?]+")
if (forgeurl == nil) then
if not silent then
rpm.expand("%{error:Googlesource URLs must match https://code.googlesource.com/…/repo !\\n}")
end
else
explicitset("forgeurl", forgeurl)
safeset("archiveext", "tar.gz")
safeset("forgesetupargs", "-c")
if (commit ~= "") or (tag ~= "") then
safeset("scm", "git")
end
local repo = string.match(forgeurl, "^[^:]+://.+/([^/?#]+)")
if (tag ~= "") then
safeset("archivename", repo .. "-%{tag}")
safeset("archiveurl", "%{forgeurl}/+archive/%{tag}.%{archiveext}")
else
if (commit ~= "") then
safeset("archivename", repo .. "-%{commit}")
safeset("archiveurl", "%{forgeurl}/+archive/%{commit}.%{archiveext}")
else
safeset("archivename", repo .. "-v%{version}")
safeset("archiveurl", "%{forgeurl}/+archive/v%{version}.%{archiveext}")
end
end
end
end
if (forge == "bitbucket.org") then
forgeurl = string.match(forgeurl, "https://[^/]+/[^/]+/[^/#?]+")
if (forgeurl == nil) then
if not silent then
rpm.expand("%{error:BitBucket URLs must match https://bitbucket.org/owner/repo !\\n}")
end
else
explicitset("forgeurl", forgeurl)
if (commit == "") then
rpm.expand("%{error:All BitBucket URLs require commit value knowledge: you need to define %{commit}!\\n}")
end
local shortcommit = string.sub(commit, 1, 12)
safeset("archiveext", "tar.bz2")
-- Default to git even though BitBucket allows choosing between several SCMs
-- Set scm to hg for example before calling the macro if your project does not use git
safeset("scm", "git")
local owner = string.match(forgeurl, "^[^:]+://[^/]+/([^/]+)")
local repo = string.match(forgeurl, "^[^:]+://[^/]+/[^/]+/([^/]+)")
safeset("archivename", owner .. "-" .. repo .. "-" .. shortcommit)
safeset("forgesetupargs", "-n %{archivename}")
if (tag ~= "") then
safeset("archiveurl", "%{forgeurl}/get/%{tag}.%{archiveext}")
else
safeset("archiveurl", "%{forgeurl}/get/%{commit}.%{archiveext}")
end
end
end
if (forge == "pagure.io") then
if not silent then
rpm.expand("%{error:https://pagure.io/pagure/issue/861 needs to be resolved before the “pagure.io”\\nsoftware publishing service can be supported.\\n}")
end
end
-- Final tests to check forgeurl was successfuly parsed
if not silent then
if (rpm.expand("%{?archivename}") == "") or (rpm.expand("%{?archiveurl}") == "") then
rpm.expand("%{error:Automation for the “" .. forge .. "”\\nsoftware publishing service is not implemented yet.\\nPlease extend the %%forgemeta macro!\\n}")
end
end
end
end
-- Set defaults if forgeurl is missing or does not parse
local archivename = rpm.expand("%{?archivename}")
safeset("archiveext", "tar.gz")
if (archivename ~= "") then
safeset("forgesetupargs", "-n %{archivename}")
end
if (commit ~= "") or (tag ~= "") then
safeset("scm", "git")
end
-- Source URL processing (computing the forgesource spec variable)
local archiveurl = rpm.expand("%{?archiveurl}")
local archiveext = rpm.expand("%{?archiveext}")
if (archivename ~= "") and (archiveurl ~= "") then
if (string.match(archiveurl, "/([^/]+)$") == archivename .. "." .. archiveext) then
safeset("forgesource", "%{archiveurl}")
else
safeset("forgesource", "%{?archiveurl}#/%{?archivename}.%{archiveext}")
end
end
-- dist processing (computing the correct pefix for snapshots)
local distprefix = rpm.expand("%{?tag}")
local version = rpm.expand("%{?version}")
if (distprefix == version) or (distprefix == "v" .. version) then
distprefix = ""
end
if (distprefix == "") then
distprefix = string.sub(rpm.expand("%{?commit}"), 1, 7)
end
if (distprefix ~= "") then
local dist = ".%{?date}%{!?date:%([ -r %{_sourcedir}/%{archivename}.%{archiveext} ] && date +%Y%m%d -u -r %{_sourcedir}/%{archivename}.%{archiveext})}%{scm}" .. string.gsub(distprefix, "-",".") .. rpm.expand("%{?dist}")
explicitset("dist", dist)
end
-- Final spec variable summary if the macro was called with -i
if informative then
rpm.expand("%{echo:Forge-specific packaging variables\\n}")
rpm.expand("%{echo: forgeurl: %{?forgeurl}\\n}")
rpm.expand("%{echo: forgesource: %{?forgesource}\\n}")
rpm.expand("%{echo: forgesetupargs: %{?forgesetupargs}\\n}")
rpm.expand("%{echo:Generic variables\\n}")
rpm.expand("%{echo: archivename: %{?archivename}\\n}")
rpm.expand("%{echo: archiveext: %{?archiveext}\\n}")
rpm.expand("%{echo: archiveurl: %{?archiveurl}\\n}")
rpm.expand("%{echo: scm: %{?scm}\\n}")
rpm.expand("%{echo: tag: %{?tag}\\n}")
rpm.expand("%{echo: commit: %{?commit}\\n}")
rpm.expand("%{echo: dist: %{?dist} (snapshot date is either manually supplied or computed once %%{_sourcedir}/%%{archivename}.%%{archiveext} is available)\\n}")
end
}
# Convenience macro to relay computed arguments to %setup
%forgesetup(a:b:cDn:Tq) %setup %{?forgesetupargs} %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{-q}
# Convenience macro to relay computed arguments to %autosetup
%forgeautosetup(a:b:cDn:TvNS:p:) %autosetup %{?forgesetupargs} %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{-v} %{-N} %{-S} %{-p}

View File

@ -1,3 +0,0 @@
%fpc_arches %{ix86} %{arm} x86_64 ppc64
# fpc_arches lists the architectures where the Free Pascal Compiler is
# available in Fedora.

View File

@ -1,7 +0,0 @@
# Macros needed for building srpms of Haskell packages
# from ghc-7.8 ghci is supported on all arch's
# former archs: armv5tel ppc sparcv9
%ghc_arches_with_ghci %{ix86} x86_64 armv7hl ppc64 ppc64le aarch64 s390 s390x %{mips}
# ghc_arches is not used in current packages but still here for back compat
# former archs: alpha ppc sparcv9 armv5tel
%ghc_arches %{ix86} x86_64 armv7hl ppc64 ppc64le aarch64 s390 s390x

View File

@ -1,14 +0,0 @@
%GNAT_arches %{GPRbuild_arches} ia64 ppc alpha %{ix86}
# GNAT_arches lists the architectures where GNAT is available in Fedora. Ada
# packages won't build on other architectures until GNAT is bootstrapped for
# them.
# (Although not all of these architectures have active maintainer teams in
# Fedora, it seems appropriate to keep this list in agreement with the one in
# gcc.spec.)
%GPRbuild_arches x86_64 ppc64 ppc64p7 ppc64le s390x %{arm} aarch64
# GPRbuild_arches lists the architectures where GPRbuild is available in Fedora.
# If an architecture is included in GNAT_arches but not in GPRbuild_arches, then
# either GPRbuild hasn't been bootstrapped for that architecture, or there might
# be some architecture-specific problem.
# x86 is excluded from GPRbuild_arches because of
# https://bugzilla.redhat.com/show_bug.cgi?id=1444614

View File

@ -1,170 +1,170 @@
# Copyright (c) 2015-2018 Jakub Cajka <jcajka@redhat.com>, # Copyright (c) 2015-2018 Jakub Cajka <jcajka@redhat.com>,
# Jan Chaloupka <jchaloup@redhat.com>, # Jan Chaloupka <jchaloup@redhat.com>,
# Nicolas Mailhot <nim@fedoraproject.org> # Nicolas Mailhot <nim@fedoraproject.org>
# This file is distributed under the terms of GNU GPL license version 3, or # This file is distributed under the terms of GNU GPL license version 3, or
# any later version. # any later version.
# This file contains macros for building projects in golang for packages # This file contains macros for building projects in golang for packages
# with golang compiler or gcc-go compiler based on an architecture. # with golang compiler or gcc-go compiler based on an architecture.
# Golang is primarly for primary architectures, gcc-go for secondary. # Golang is primarly for primary architectures, gcc-go for secondary.
# #
# This file provides only macros and must not use any other package except # This file provides only macros and must not use any other package except
# redhat-rpm-macros. # redhat-rpm-macros.
# Define arches for PA and SA # Define arches for PA and SA
%golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x %golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x
%gccgo_arches %{mips} %gccgo_arches %{mips}
%go_arches %{golang_arches} %{gccgo_arches} %go_arches %{golang_arches} %{gccgo_arches}
# Where to set GOPATH for builds # Where to set GOPATH for builds
%gopath %{_datadir}/gocode %gopath %{_datadir}/gocode
# Define go_compilers macro to signal go-compiler package is available # Define go_compilers macro to signal go-compiler package is available
%go_compiler 1 %go_compiler 1
# Sanitize a Go import path that can then serve as rpm package name # Sanitize a Go import path that can then serve as rpm package name
# Mandatory parameter: a Go import path # Mandatory parameter: a Go import path
%gorpmname() %{lua: %gorpmname() %{lua:
local goname = rpm.expand("%1") local goname = rpm.expand("%1")
-- lowercase and end with '/' -- lowercase and end with '/'
goname = string.lower(goname .. "/") goname = string.lower(goname .. "/")
-- remove eventual protocol prefix -- remove eventual protocol prefix
goname = string.gsub(goname, "^http(s?)://", "") goname = string.gsub(goname, "^http(s?)://", "")
-- remove eventual .git suffix -- remove eventual .git suffix
goname = string.gsub(goname, "%.git/*", "") goname = string.gsub(goname, "%.git/*", "")
-- remove eventual git. prefix -- remove eventual git. prefix
goname = string.gsub(goname, "^git%.", "") goname = string.gsub(goname, "^git%.", "")
-- add golang prefix -- add golang prefix
goname = "golang-" .. goname goname = "golang-" .. goname
-- remove FQDN root (.com, .org, etc) -- remove FQDN root (.com, .org, etc)
goname = string.gsub(goname, "^([^/]+)%.([^%./]+)/", "%1/") goname = string.gsub(goname, "^([^/]+)%.([^%./]+)/", "%1/")
-- special-case x.y.z number-strings as thats an exception in our naming -- special-case x.y.z number-strings as thats an exception in our naming
-- guidelines -- guidelines
repeat repeat
goname, i = string.gsub(goname, "(%d)%.(%d)", "%1:%2") goname, i = string.gsub(goname, "(%d)%.(%d)", "%1:%2")
until i == 0 until i == 0
-- replace various separators rpm does not like with - -- replace various separators rpm does not like with -
goname = string.gsub(goname, "[%._/%-]+", "-") goname = string.gsub(goname, "[%._/%-]+", "-")
-- because of the Azure sdk -- because of the Azure sdk
goname = string.gsub(goname, "%-for%-go%-", "-") goname = string.gsub(goname, "%-for%-go%-", "-")
-- Tokenize along - separators and remove duplicates to avoid -- Tokenize along - separators and remove duplicates to avoid
-- golang-foo-foo-bar-foo names -- golang-foo-foo-bar-foo names
local result = "" local result = ""
local tokens = {} local tokens = {}
tokens["go"] = true tokens["go"] = true
for token in string.gmatch(goname, "[^%-]+") do for token in string.gmatch(goname, "[^%-]+") do
if not tokens[token] then if not tokens[token] then
result = result .. "-" .. token result = result .. "-" .. token
tokens[token] = true tokens[token] = true
end end
end end
-- reassemble the string, restore x.y.z runs, convert the vx.y.z -- reassemble the string, restore x.y.z runs, convert the vx.y.z
-- Go convention to x.y.z as prefered in rpm naming -- Go convention to x.y.z as prefered in rpm naming
result = string.gsub(result, "^-", "") result = string.gsub(result, "^-", "")
result = string.gsub(result, ":", ".") result = string.gsub(result, ":", ".")
-- some projects have a name that end up in a number, and *also* add release -- some projects have a name that end up in a number, and *also* add release
-- numbers on top of it, keep a - prefix before version strings -- numbers on top of it, keep a - prefix before version strings
result = string.gsub(result, "%-v([%.%d])", "-%1") result = string.gsub(result, "%-v([%.%d])", "-%1")
print(result) print(result)
} }
# Map Go information to rpm metadata. This macro will compute default spec # Map Go information to rpm metadata. This macro will compute default spec
# variable values. # variable values.
# #
# The following spec variable MUST be set before calling the macro: # The following spec variable MUST be set before calling the macro:
# #
# goipath the packaged Go project import path # goipath the packaged Go project import path
# #
# The following spec variables SHOULD be set before calling the macro: # The following spec variables SHOULD be set before calling the macro:
# #
# forgeurl the project url on the forge, strongly recommended, if it can not # forgeurl the project url on the forge, strongly recommended, if it can not
# be deduced from goipath; alternatively, use -u <url> # be deduced from goipath; alternatively, use -u <url>
# Version if applicable, set it with Version: <version> # Version if applicable, set it with Version: <version>
# tag if applicable # tag if applicable
# commit if applicable # commit if applicable
# #
# The macro will attempt to compute and set the following variables if they are # The macro will attempt to compute and set the following variables if they are
# not already set by the packager: # not already set by the packager:
# #
# goname an rpm-compatible package name derived from goipath # goname an rpm-compatible package name derived from goipath
# gosource an URL that can be used as SourceX: value # gosource an URL that can be used as SourceX: value
# gourl an URL that can be used as URL: value # gourl an URL that can be used as URL: value
# #
# It will delegate processing to the forgemeta macro for: # It will delegate processing to the forgemeta macro for:
# #
# forgesource an URL that can be used as SourceX: value # forgesource an URL that can be used as SourceX: value
# forgesetupargs the correct arguments to pass to %setup for this source # forgesetupargs the correct arguments to pass to %setup for this source
# used by %forgesetup and %forgeautosetup # used by %forgesetup and %forgeautosetup
# archivename the source archive filename, without extentions # archivename the source archive filename, without extentions
# archiveext the source archive filename extensions, without leading dot # archiveext the source archive filename extensions, without leading dot
# archiveurl the url that can be used to download the source archive, # archiveurl the url that can be used to download the source archive,
# without renaming # without renaming
# scm the scm type, when packaging code snapshots: commits or tags # scm the scm type, when packaging code snapshots: commits or tags
# #
# If the macro is unable to parse your forgeurl value set at least archivename # If the macro is unable to parse your forgeurl value set at least archivename
# and archiveurl before calling it. # and archiveurl before calling it.
# #
# Most of the computed variables are both overridable and optional. However, # Most of the computed variables are both overridable and optional. However,
# the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag). # the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag).
# The previous %{dist} value will be lost. Dont call the macro if you dont # The previous %{dist} value will be lost. Dont call the macro if you dont
# wish %{dist} to be changed. # wish %{dist} to be changed.
# #
# Optional parameters: # Optional parameters:
# -u <url> Ignore forgeurl even if it exists and use <url> instead. Note # -u <url> Ignore forgeurl even if it exists and use <url> instead. Note
# that the macro will still end up setting <url> as the forgeurl # that the macro will still end up setting <url> as the forgeurl
# spec variable if it manages to parse it. # spec variable if it manages to parse it.
# -s Silently ignore problems in forgeurl, use it if it can be parsed, # -s Silently ignore problems in forgeurl, use it if it can be parsed,
# ignore it otherwise. # ignore it otherwise.
# -p Restore problem handling, override -s. # -p Restore problem handling, override -s.
# -v Be verbose and print every spec variable the macro sets. # -v Be verbose and print every spec variable the macro sets.
# -i Print some info about the state of spec variables the macro may use or # -i Print some info about the state of spec variables the macro may use or
# set at the end of the processing. # set at the end of the processing.
%gometa(u:spvi) %{expand:%{lua: %gometa(u:spvi) %{expand:%{lua:
local forgeurl = rpm.expand("%{?-u*}") local forgeurl = rpm.expand("%{?-u*}")
if (forgeurl == "") then if (forgeurl == "") then
forgeurl = rpm.expand("%{?forgeurl}") forgeurl = rpm.expand("%{?forgeurl}")
end end
-- Be explicit about the spec variables were setting -- Be explicit about the spec variables were setting
local function explicitset(rpmvariable,value) local function explicitset(rpmvariable,value)
rpm.define(rpmvariable .. " " .. value) rpm.define(rpmvariable .. " " .. value)
if (rpm.expand("%{?-v}") ~= "") then if (rpm.expand("%{?-v}") ~= "") then
rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\\n}") rpm.expand("%{echo:Setting %%{" .. rpmvariable .. "} = " .. value .. "\\n}")
end end
end end
-- Never ever stomp on a spec variable the packager already set -- Never ever stomp on a spec variable the packager already set
local function safeset(rpmvariable,value) local function safeset(rpmvariable,value)
if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then if (rpm.expand("%{?" .. rpmvariable .. "}") == "") then
explicitset(rpmvariable,value) explicitset(rpmvariable,value)
end end
end end
-- All the Go packaging automation relies on goipath being set -- All the Go packaging automation relies on goipath being set
local goipath = rpm.expand("%{?goipath}") local goipath = rpm.expand("%{?goipath}")
if (goipath == "") then if (goipath == "") then
rpm.expand("%{error:Please set the Go import path in the “goipath” variable before calling “gometa”!}") rpm.expand("%{error:Please set the Go import path in the “goipath” variable before calling “gometa”!}")
end end
-- Compute and set spec variables -- Compute and set spec variables
if (forgeurl ~= "") then if (forgeurl ~= "") then
rpm.expand("%forgemeta %{?-v} %{?-i} %{?-s} %{?-p} -u " .. forgeurl .. "\\n") rpm.expand("%forgemeta %{?-v} %{?-i} %{?-s} %{?-p} -u " .. forgeurl .. "\\n")
safeset("gourl", forgeurl) safeset("gourl", forgeurl)
else else
safeset("gourl", "https://" .. goipath) safeset("gourl", "https://" .. goipath)
rpm.expand("%forgemeta %{?-v} %{?-i} -s %{?-p} -u %{gourl}\\n") rpm.expand("%forgemeta %{?-v} %{?-i} -s %{?-p} -u %{gourl}\\n")
end end
if (rpm.expand("%{?forgesource}") ~= "") then if (rpm.expand("%{?forgesource}") ~= "") then
safeset("gosource", "%{forgesource}") safeset("gosource", "%{forgesource}")
else else
safeset("gosource", "%{gourl}/%{archivename}.%{archiveext}") safeset("gosource", "%{gourl}/%{archivename}.%{archiveext}")
end end
safeset("goname", "%gorpmname %{goipath}") safeset("goname", "%gorpmname %{goipath}")
rpm.define("gosetup %forgesetup") rpm.define("gosetup %forgesetup")
-- Final spec variable summary if the macro was called with -i -- Final spec variable summary if the macro was called with -i
if (rpm.expand("%{?-i}") ~= "") then if (rpm.expand("%{?-i}") ~= "") then
rpm.expand("%{echo:Go-specific packaging variables}") rpm.expand("%{echo:Go-specific packaging variables}")
rpm.expand("%{echo: goipath: %{?goipath}}") rpm.expand("%{echo: goipath: %{?goipath}}")
rpm.expand("%{echo: goname: %{?goname}}") rpm.expand("%{echo: goname: %{?goname}}")
rpm.expand("%{echo: gourl: %{?gourl}}") rpm.expand("%{echo: gourl: %{?gourl}}")
rpm.expand("%{echo: gosource: %{?gosource}}") rpm.expand("%{echo: gosource: %{?gosource}}")
end} end}
BuildRequires: compiler(go-compiler) BuildRequires: compiler(go-compiler)
ExclusiveArch: %{go_arches} ExclusiveArch: %{go_arches}
} }

View File

@ -1 +0,0 @@
%nim_arches %{ix86} x86_64 %{arm} aarch64 %{power64}

View File

@ -1,11 +0,0 @@
# Note that OCaml is compiled on all architectures. However
# on some (rare) architectures, only bytecode compilation is
# available. Use these macros to find out if native code
# compilation is available on a particular architecture.
# Architectures that support the OCaml native code compiler.
%ocaml_native_compiler aarch64 %{arm} %{ix86} ppc ppc64 ppc64le riscv64 s390x sparc sparcv9 x86_64
# Architectures that support native dynamic linking of OCaml code.
%ocaml_natdynlink aarch64 %{arm} %{ix86} ppc ppc64 ppc64le riscv64 s390x sparc sparcv9 x86_64
# Architectures that support profiling of native code (ocamlopt -p).
%ocaml_native_profiling %{arm} %{ix86} ppc ppc64 ppc64le sparc sparcv9 x86_64

View File

@ -1,31 +0,0 @@
#custom macros
%disable_rpath \
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool \
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%delete_la_and_a \
find $RPM_BUILD_ROOT -type f -name "*.la" -delete \
find $RPM_BUILD_ROOT -type f -name "*.a" -delete
%delete_la find $RPM_BUILD_ROOT -type f -name "*.la" -delete
%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\<ELF\>" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {}
%package_help \
%package help \
Summary: Documents for %{name} \
Buildarch: noarch \
Requires: man info \
\
%description help \
Man pages and other related documents for %{name}.
#%sbin_installinfo_rm bc.info
#%sbin_installinfo_rm bc.info.gz
%install_info() \
/sbin/install-info %1 %{_infodir}/dir || :
%install_info_rm() \
/sbin/install-info --remove %1 %{_infodir}/dir || :

View File

@ -1,2 +0,0 @@
# Architectures that OpenBLAS supports
%openblas_arches x86_64 %{ix86} armv7hl %{power64} aarch64 s390x

151
macros.perl Normal file
View File

@ -0,0 +1,151 @@
# Sensible Perl-specific RPM build macros.
#
# Note that these depend on the generic filtering system being in place in
# rpm core; but won't cause a build to fail if they're not present.
#
# Chris Weyl <cweyl@alumni.drew.edu> 2009
# Marcela Mašláňová <mmaslano@redhat.com> 2011
# This macro unsets several common vars used to control how Makefile.PL (et
# al) build and install packages. We also set a couple to help some of the
# common systems be less interactive. This was blatantly stolen from
# cpanminus, and helps building rpms locally when one makes extensive use of
# local::lib, etc.
#
# Usage, in %build, before "%{__perl} Makefile.PL ..."
#
# %{?perl_ext_env_unset}
%perl_ext_env_unset %{expand:
unset PERL_MM_OPT MODULEBUILDRC PERL5INC
export PERL_AUTOINSTALL="--defaultdeps"
export PERL_MM_USE_DEFAULT=1
}
#############################################################################
# Filtering macro incantations
# keep track of what "revision" of the filtering we're at. Each time we
# change the filter we should increment this.
%perl_default_filter_revision 3
# By default, for perl packages we want to filter all files in _docdir from
# req/prov scanning.
# Filtering out any provides caused by private libs in vendorarch/archlib
# (vendor/core) is done by rpmbuild since Fedora 20
# <https://fedorahosted.org/fpc/ticket/353>.
#
# Note that this must be invoked in the spec file, preferably as
# "%{?perl_default_filter}", before any %description block.
%perl_default_filter %{expand: \
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_docdir}
%global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}^%{_docdir}
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\\\(VMS|^perl\\\\(Win32|^perl\\\\(DB\\\\)|^perl\\\\(UNIVERSAL\\\\)
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\\\(VMS|^perl\\\\(Win32
}
#############################################################################
# Macros to assist with generating a "-tests" subpackage in a semi-automatic
# manner.
#
# The following macros are still in a highly experimental stage and users
# should be aware that the interface and behaviour may change.
#
# PLEASE, PLEASE CONDITIONALIZE THESE MACROS IF YOU USE THEM.
#
# See http://gist.github.com/284409
# These macros should be invoked as above, right before the first %description
# section, and conditionalized. e.g., for the common case where all our tests
# are located under t/, the correct usage is:
#
# %{?perl_default_subpackage_tests}
#
# If custom files/directories need to be specified, this can be done as such:
#
# %{?perl_subpackage_tests:%perl_subpackage_tests t/ one/ three.sql}
#
# etc, etc.
%perl_version %(eval "`%{__perl} -V:version`"; echo $version)
%perl_testdir %{_libexecdir}/perl5-tests
%cpan_dist_name %(eval echo %{name} | %{__sed} -e 's/^perl-//')
# easily mark something as required by -tests and BR to the main package
%tests_req() %{expand:\
BuildRequires: %*\
%%tests_subpackage_requires %*\
}
# fixup (and create if needed) the shbang lines in tests, so they work and
# rpmlint doesn't (correctly) have a fit
%fix_shbang_line() \
TMPHEAD=`mktemp`\
TMPBODY=`mktemp`\
for file in %* ; do \
head -1 $file > $TMPHEAD\
tail -n +2 $file > $TMPBODY\
%{__perl} -pi -e '$f = /^#!/ ? "" : "#!%{__perl}$/"; $_="$f$_"' $TMPHEAD\
cat $TMPHEAD $TMPBODY > $file\
done\
%{__perl} -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(qw{%*})"\
%{__rm} $TMPHEAD $TMPBODY\
%{nil}
# additional -tests subpackage requires, if any
%tests_subpackage_requires() %{expand: \
%global __tests_spkg_req %{?__tests_spkg_req} %* \
}
# additional -tests subpackage provides, if any
%tests_subpackage_provides() %{expand: \
%global __tests_spkg_prov %{?__tests_spkg_prov} %* \
}
#
# Runs after the body of %check completes.
#
%__perl_check_pre %{expand: \
%{?__spec_check_pre} \
pushd %{buildsubdir} \
%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \
%{__mkdir_p} %{perl_br_testdir} \
%{__tar} -cf - %{__perl_test_dirs} | ( cd %{perl_br_testdir} && %{__tar} -xf - ) \
find . -maxdepth 1 -type f -name '*META*' -exec %{__cp} -vp {} %{perl_br_testdir} ';' \
find %{perl_br_testdir} -type f -exec %{__chmod} -c -x {} ';' \
T_FILES=`find %{perl_br_testdir} -type f -name '*.t'` \
%fix_shbang_line $T_FILES \
%{__chmod} +x $T_FILES \
%{_fixperms} %{perl_br_testdir} \
popd \
}
#
# The actual invoked macro
#
%perl_subpackage_tests() %{expand: \
%global __perl_package 1\
%global __perl_test_dirs %* \
%global __spec_check_pre %{expand:%{__perl_check_pre}} \
%package tests\
Summary: Test suite for package %{name}\
Group: Development/Debug\
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}\
Requires: /usr/bin/prove \
%{?__tests_spkg_req:Requires: %__tests_spkg_req}\
%{?__tests_spkg_prov:Provides: %__tests_spkg_prov}\
AutoReqProv: 0 \
%description tests\
This package provides the test suite for package %{name}.\
%files tests\
%defattr(-,root,root,-)\
%{perl_testdir}\
}
# shortcut sugar
%perl_default_subpackage_tests %perl_subpackage_tests t/

View File

@ -1,15 +0,0 @@
# Copyright (c) 2012 Petr Pisar <ppisar@redhat.com>.
# This file is distributed under the terms of GNU GPL license version 3, or
# any later version.
# This file contains macros that can be used for building source RPM package
# from git source repository. This file must present in minimal build root to
# take effect.
# This file must not use Perl or any non-minimal-build-root package. The
# purpose is to enable bootstrapping perl.
# Perl bootstrap For rebuild of Perl and all related packages is needed
# switch, which enable only vital build requires. This could help cyclic
# dependencies, for example: perl-Test-Minimum-Version <->
# perl-Perl-Minimum-Version Defined for bootstraping, undefined otherwise.
# Usage: %%if !%%{defined perl_bootstrap} ... %%endif
#%%perl_bootstrap 1

View File

@ -1,19 +0,0 @@
# Note that the path could itself be a python file, or a directory
# Python's compile_all module only works on directories, and requires a max
# recursion depth
# Usage:
# %py_byte_compile <interpereter> <path>
# Example:
# %py_byte_compile %{__python3} %{buildroot}%{_datadir}/spam/plugins/
# This will terminate build on SyntaxErrors, if you want to avoid that,
# use it in a subshell like this:
# (%{py_byte_compile <interpereter> <path>}) || :
%py_byte_compile()\
python_binary="%1"\
bytecode_compilation_path="%2"\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -O -m py_compile\
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -m py_compile

View File

@ -1,81 +0,0 @@
%py_setup setup.py
%py_shbang_opts -s
# Use the slashes after expand so that the command starts on the same line as
# the macro
%py_build() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
sleep 1
}
%py_build_egg() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
sleep 1
}
%py_build_wheel() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
sleep 1
}
%py_install() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
}
%py_install_egg() %{expand:\\\
mkdir -p %{buildroot}%{python_sitelib}
easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
}
%py_install_wheel() %{expand:\\\
pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
}
%python_provide() %{lua:
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
package = rpm.expand("%{?1}")
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
if (string.starts(package, "python2-")) then
if (rpm.expand("%{?buildarch}") ~= "noarch") then
str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr
print(rpm.expand(str))
end
print("\\nProvides: python-")
print(string.sub(package,9,string.len(package)))
print(" = ")
print(vr)
--Obsoleting the previous default python package
print("\\nObsoletes: python-")
print(string.sub(package,9,string.len(package)))
print(" < ")
print(vr)
elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
--No unversioned provides as python3 is not default
elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
--No unversioned provides as python3_other is not default
elseif (string.starts(package, "pypy-")) then
--No unversioned provides as pypy is not default
elseif (string.starts(package, "pypy3-")) then
--No unversioned provides as pypy is not default
elseif (string.starts(package, "python-")) then
--Providing the current default python
print("Provides: python2-")
print(string.sub(package,8,string.len(package)))
print(" = ")
print(vr)
else
print("%python_provide: ERROR: ")
print(package)
print(" not recognized.")
end
}
%python_enable_dependency_generator() \
%global __pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires \
%{nil}

View File

@ -1,107 +0,0 @@
# python3_pkgversion specifies the version of Python 3 in the distro. It can be
# a specific version (e.g. 34 in Fedora EPEL7)
%python3_pkgversion 3
# Set to /bin/true to avoid %ifdefs and %{? in specfiles
%__python3_other /bin/true
%py3_other_build /bin/true
%py3_other_install /bin/true
# === Macros for Build/Requires tags using Python dist tags ===
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
# - These macros need to be in macros.python-srpm, because BuildRequires tags
# get rendered as runtime requires into the metadata of SRPMs.
# Converts Python dist name to a canonical format
%py_dist_name() %{lua:\
name = rpm.expand("%{?1:%{1}}");\
canonical = string.gsub(string.lower(name), "[^%w%.]+", "-");\
print(canonical);\
}
# Creates Python 2 dist tag(s) after converting names to canonical format
# Needs to first put all arguments into a list, because invoking a different
# macro (%py_dist_name) overwrites them
%py2_dist() %{lua:\
args = {}\
arg = 1\
while (true) do\
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
if (name == nil or name == '') then\
break\
end\
args[arg] = name\
arg = arg + 1\
end\
for arg, name in ipairs(args) do\
canonical = rpm.expand("%py_dist_name " .. name);\
print("python2dist(" .. canonical .. ") ");\
end\
}
# Creates Python 3 dist tag(s) after converting names to canonical format
# Needs to first put all arguments into a list, because invoking a different
# macro (%py_dist_name) overwrites them
%py3_dist() %{lua:\
args = {}\
arg = 1\
while (true) do\
name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
if (name == nil or name == '') then\
break\
end\
args[arg] = name\
arg = arg + 1\
end\
for arg, name in ipairs(args) do\
canonical = rpm.expand("%py_dist_name " .. name);\
print("python3dist(" .. canonical .. ") ");\
end\
}
# Macro to replace overly complicated references to PyPI source files.
# Expands to the pythonhosted URL for a package
# Accepts zero to three arguments:
# 1: The PyPI project name, defaulting to %srcname if it is defined, then
# %pypi_name if it is defined, then just %name.
# 2: The PYPI version, defaulting to %version.
# 3: The file extension, defaulting to "tar.gz". (A period will be added
# automatically.)
# Requires %__pypi_url and %__pypi_default_extension to be defined.
%__pypi_url https://files.pythonhosted.org/packages/source/
%__pypi_default_extension tar.gz
%pypi_source() %{lua:
local src = rpm.expand('%1')
local ver = rpm.expand('%2')
local ext = rpm.expand('%3')
local url = rpm.expand('%__pypi_url')
\
-- If no first argument, try %srcname, then %pypi_name, then %name
-- Note that rpm leaves macros unchanged if they are not defined.
if src == '%1' then
src = rpm.expand('%srcname')
end
if src == '%srcname' then
src = rpm.expand('%pypi_name')
end
if src == '%pypi_name' then
src = rpm.expand('%name')
end
\
-- If no second argument, use %version
if ver == '%2' then
ver = rpm.expand('%version')
end
\
-- If no third argument, use the preset default extension
if ext == '%3' then
ext = rpm.expand('%__pypi_default_extension')
end
\
local first = string.sub(src, 1, 1)
\
print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
}

View File

@ -1,41 +0,0 @@
%__python2 /usr/bin/python2
%python2_sitelib %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python2_sitearch %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python2_version %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python2_version_nodots %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%py2_shbang_opts -s
# Use the slashes after expand so that the command starts on the same line as
# the macro
%py2_build() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*}
sleep 1
}
%py2_build_egg() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
sleep 1
}
%py2_build_wheel() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
sleep 1
}
%py2_install() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
}
%py2_install_egg() %{expand:\\\
mkdir -p %{buildroot}%{python2_sitelib}
easy_install-%{python2_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python2_version}.egg %{?*}
}
%py2_install_wheel() %{expand:\\\
pip%{python2_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
}

View File

@ -1,43 +0,0 @@
%__python3 /usr/bin/python3
%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write(sys.version[:3])")
%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write(sys.version[:3].replace('.',''))")
%python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
%py3_shbang_opts -s
# Use the slashes after expand so that the command starts on the same line as
# the macro
%py3_build() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}
sleep 1
}
%py3_build_egg() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python3} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
sleep 1
}
%py3_build_wheel() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python3} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
sleep 1
}
%py3_install() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
%{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
}
%py3_install_egg() %{expand:\\\
mkdir -p %{buildroot}%{python3_sitelib}
easy_install-%{python3_version} -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
}
%py3_install_wheel() %{expand:\\\
pip%{python3_version} install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
}

View File

@ -1 +0,0 @@
%rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x

2
openEuler-hardened-cc1 Normal file
View File

@ -0,0 +1,2 @@
*cc1_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}

2
openEuler-hardened-ld Normal file
View File

@ -0,0 +1,2 @@
*self_spec:
+ %{!static:%{!shared:%{!r:-pie}}}

2
openEuler-pie-cc1 Normal file
View File

@ -0,0 +1,2 @@
*cc1_options:
+ %{!r:%{!D__KERNEL__:%{!pie:%{!fpic:%{!fPIC:%{!fpie:%{!fPIE:%{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE:%{!shared:%{!static:%{!nostdlib:%{!nostartfiles:-fPIE}}}}}}}}}}}}}}}

2
openEuler-pie-ld Normal file
View File

@ -0,0 +1,2 @@
*self_spec:
+ %{!D__KERNEL__:%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r:%{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}}

2
openeuler-fs-cc1 Normal file
View File

@ -0,0 +1,2 @@
*cc1_options:
+ %{!D__KERNEL__:%{!nostdlib:%{!nodefaultlibs:%{!fno-stack-protector:%{!fstack-protector-all:-fstack-protector-strong}}}}}

Binary file not shown.

View File

@ -1,25 +0,0 @@
From b2723527bfbfa90d5fc77bf171a13e934d707471 Mon Sep 17 00:00:00 2001
From: jiangchuangang <jiangchuangang@huawei.com>
Date: Fri, 15 Nov 2019 11:13:48 +0800
Subject: [PATCH] remove -fcf-protection for gcc-7.3.0 x86_64, -fcf-protection require GCC 8.
---
rpmrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rpmrc b/rpmrc
index 630c8c0..0b516aa 100644
--- a/rpmrc
+++ b/rpmrc
@@ -6,7 +6,7 @@ optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasyn
optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection
optflags: ia64 %{__global_compiler_flags}
-optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
+optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
optflags: alpha %{__global_compiler_flags} -mieee
optflags: alphaev5 %{__global_compiler_flags} -mieee -mcpu=ev5
--
2.19.1

19
rpmrc Normal file
View File

@ -0,0 +1,19 @@
include: /usr/lib/rpm/rpmrc
optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection
optflags: ia64 %{__global_compiler_flags}
optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection
buildarchtranslate: athlon: i686
buildarchtranslate: geode: i686
buildarchtranslate: pentium4: i686
buildarchtranslate: pentium3: i686
buildarchtranslate: i686: i686
buildarchtranslate: i586: i586
buildarchtranslate: armv7l: armv5tel
buildarchtranslate: armv7hl: armv7hl
buildarchtranslate: armv7hnl: armv7hl