!1 openEuler-rpm-config

Merge pull request !1 from openeuler-basic/init
This commit is contained in:
openeuler-ci-bot 2019-12-26 19:56:27 +08:00 committed by Gitee
commit 2c40e063d1
19 changed files with 973 additions and 0 deletions

209
generic-rpm-config.spec Normal file
View File

@ -0,0 +1,209 @@
%global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler}
Name: %{vendor}-rpm-config
Version: 29
Release: 20
License: GPL+
Summary: specific rpm configuration files
URL: https://src.fedoraproject.org/rpms/redhat-rpm-config
# Core rpm settings
#fedora 29 snapshots from https://src.fedoraproject.org/rpms/redhat-rpm-config
Source0: redhat-rpm-config-118.tar.gz
#https://src.fedoraproject.org/rpms/fpc-srpm-macros/blob/f29/f/macros.fpc-srpm
Source1: macros.fpc-srpm
#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
#python https://src.fedoraproject.org/rpms/python-rpm-macros/blob/f29/
Source10: macros.python
Source11: macros.python-srpm
Source12: macros.python2
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: python2-rpm-macros = %{version}-%{release}
Provides: python3-rpm-macros = %{version}-%{release}
Provides: python-srpm-macros = %{version}-%{release}
Provides: fpc-srpm-macros
Provides: ghc-srpm-macros
Provides: gnat-srpm-macros
Provides: nim-srpm-macros
Provides: ocaml-srpm-macros
Provides: openblas-srpm-macros
Provides: perl-srpm-macros
Provides: rust-srpm-macros
Provides: go-srpm-macros
Obsoletes: python-rpm-macros
Obsoletes: python2-rpm-macros
Obsoletes: python3-rpm-macros
Obsoletes: python-srpm-macros
Obsoletes: fpc-srpm-macros
Obsoletes: ghc-srpm-macros
Obsoletes: gnat-srpm-macros
Obsoletes: nim-srpm-macros
Obsoletes: ocaml-srpm-macros
Obsoletes: openblas-srpm-macros
Obsoletes: perl-srpm-macros
Obsoletes: rust-srpm-macros
Obsoletes: go-srpm-macros
Requires: efi-srpm-macros
Requires: qt5-srpm-macros
Requires: rpm >= 4.11.0
Requires: dwz >= 0.4
Requires: zip
#Requires: (annobin if gcc)
# for brp-mangle-shebangs
Requires: %{_bindir}/find
Requires: %{_bindir}/file
Requires: %{_bindir}/grep
Requires: sed
Requires: %{_bindir}/xargs
# -fstack-clash-protection and -fcf-protection require GCC 8.
Conflicts: gcc < 7
Provides: system-rpm-config = %{version}-%{release}
%global rrcdir /usr/lib/rpm/%{vendor}
%description
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
sed -i "s/generic_os/%{vendor}/g" $RPM_SOURCE_DIR/genericOS.patch
%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
mkdir -p %{buildroot}%{rrcdir}
install -p -m 644 -t %{buildroot}%{rrcdir} macros rpmrc
install -p -m 444 -t %{buildroot}%{rrcdir} %{vendor}-hardened-*
install -p -m 444 -t %{buildroot}%{rrcdir} %{vendor}-annobin-*
install -p -m 755 -t %{buildroot}%{rrcdir} config.*
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
install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.*
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
%dir %{rrcdir}
%{rrcdir}/macros
%{rrcdir}/rpmrc
%{rrcdir}/brp-*
%{rrcdir}/dist.sh
%{rrcdir}/%{vendor}-hardened-*
%{rrcdir}/%{vendor}-annobin-*
%{rrcdir}/config.*
%{rrcdir}/find-provides
%{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
* Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> 29-20
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:delete unneeded provides
* Wed Nov 27 2019 fanghuiyu<fanghuiyu@huwei.com> - 29-19
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:change to generic-rpm-config
* Fri Nov 15 2019 jiangchuangang<jiangchuangang@huwei.com> - 29-18
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: remove fcf-protection for x86_64 from rpmrc
* Wed Oct 30 2019 hexiaowen <hexiaowen@huawei.com> - 29-17
- add custom macros
* Wed Sep 25 2019 hexiaowen <hexiaowen@huawei.com> - 29-16
- add rust-srpm-macros and go-srpm-macros
* Fri Sep 20 2019 hexiaowen <hexiaowen@huawei.com> - 29-15
- add version-release for python-rpm-macros
* Fri Sep 20 2019 hexiaowen <hexiaowen@huawei.com> - 29-14
- add python-rpm-macros fpc-srpm-macros ghc-srpm-macros gnat-srpm-macros
- nim-srpm-macros ocaml-srpm-macros openblas-srpm-macros perl-srpm-macros
* Thu Aug 29 2019 hexiaowen <hexiaowen@huawei.com> - 29-13
- fix typo
* Tue Aug 27 2019 hexiaowen <hexiaowen@huawei.com> - 29-2
- delete annobin
* Wed Jul 18 2018 openEuler Buildteam <buildteam@openeuler.org> - 29-1
- Package init

193
genericOS.patch Normal file
View File

@ -0,0 +1,193 @@
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

3
macros.fpc-srpm Normal file
View File

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

7
macros.ghc-srpm Normal file
View File

@ -0,0 +1,7 @@
# 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

14
macros.gnat-srpm Normal file
View File

@ -0,0 +1,14 @@
%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

170
macros.go-srpm Normal file
View File

@ -0,0 +1,170 @@
# Copyright (c) 2015-2018 Jakub Cajka <jcajka@redhat.com>,
# Jan Chaloupka <jchaloup@redhat.com>,
# Nicolas Mailhot <nim@fedoraproject.org>
# This file is distributed under the terms of GNU GPL license version 3, or
# any later version.
# This file contains macros for building projects in golang for packages
# with golang compiler or gcc-go compiler based on an architecture.
# Golang is primarly for primary architectures, gcc-go for secondary.
#
# This file provides only macros and must not use any other package except
# redhat-rpm-macros.
# Define arches for PA and SA
%golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x
%gccgo_arches %{mips}
%go_arches %{golang_arches} %{gccgo_arches}
# Where to set GOPATH for builds
%gopath %{_datadir}/gocode
# Define go_compilers macro to signal go-compiler package is available
%go_compiler 1
# Sanitize a Go import path that can then serve as rpm package name
# Mandatory parameter: a Go import path
%gorpmname() %{lua:
local goname = rpm.expand("%1")
-- lowercase and end with '/'
goname = string.lower(goname .. "/")
-- remove eventual protocol prefix
goname = string.gsub(goname, "^http(s?)://", "")
-- remove eventual .git suffix
goname = string.gsub(goname, "%.git/*", "")
-- remove eventual git. prefix
goname = string.gsub(goname, "^git%.", "")
-- add golang prefix
goname = "golang-" .. goname
-- remove FQDN root (.com, .org, etc)
goname = string.gsub(goname, "^([^/]+)%.([^%./]+)/", "%1/")
-- special-case x.y.z number-strings as thats an exception in our naming
-- guidelines
repeat
goname, i = string.gsub(goname, "(%d)%.(%d)", "%1:%2")
until i == 0
-- replace various separators rpm does not like with -
goname = string.gsub(goname, "[%._/%-]+", "-")
-- because of the Azure sdk
goname = string.gsub(goname, "%-for%-go%-", "-")
-- Tokenize along - separators and remove duplicates to avoid
-- golang-foo-foo-bar-foo names
local result = ""
local tokens = {}
tokens["go"] = true
for token in string.gmatch(goname, "[^%-]+") do
if not tokens[token] then
result = result .. "-" .. token
tokens[token] = true
end
end
-- reassemble the string, restore x.y.z runs, convert the vx.y.z
-- Go convention to x.y.z as prefered in rpm naming
result = string.gsub(result, "^-", "")
result = string.gsub(result, ":", ".")
-- 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
result = string.gsub(result, "%-v([%.%d])", "-%1")
print(result)
}
# Map Go information to rpm metadata. This macro will compute default spec
# variable values.
#
# The following spec variable MUST be set before calling the macro:
#
# goipath the packaged Go project import path
#
# The following spec variables SHOULD be set before calling the macro:
#
# forgeurl the project url on the forge, strongly recommended, if it can not
# be deduced from goipath; alternatively, use -u <url>
# Version if applicable, set it with Version: <version>
# tag if applicable
# commit if applicable
#
# The macro will attempt to compute and set the following variables if they are
# not already set by the packager:
#
# goname an rpm-compatible package name derived from goipath
# gosource an URL that can be used as SourceX: value
# gourl an URL that can be used as URL: value
#
# It will delegate processing to the forgemeta macro for:
#
# 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.
%gometa(u:spvi) %{expand:%{lua:
local forgeurl = rpm.expand("%{?-u*}")
if (forgeurl == "") then
forgeurl = rpm.expand("%{?forgeurl}")
end
-- Be explicit about the spec variables were setting
local function explicitset(rpmvariable,value)
rpm.define(rpmvariable .. " " .. value)
if (rpm.expand("%{?-v}") ~= "") 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
-- All the Go packaging automation relies on goipath being set
local goipath = rpm.expand("%{?goipath}")
if (goipath == "") then
rpm.expand("%{error:Please set the Go import path in the “goipath” variable before calling “gometa”!}")
end
-- Compute and set spec variables
if (forgeurl ~= "") then
rpm.expand("%forgemeta %{?-v} %{?-i} %{?-s} %{?-p} -u " .. forgeurl .. "\\n")
safeset("gourl", forgeurl)
else
safeset("gourl", "https://" .. goipath)
rpm.expand("%forgemeta %{?-v} %{?-i} -s %{?-p} -u %{gourl}\\n")
end
if (rpm.expand("%{?forgesource}") ~= "") then
safeset("gosource", "%{forgesource}")
else
safeset("gosource", "%{gourl}/%{archivename}.%{archiveext}")
end
safeset("goname", "%gorpmname %{goipath}")
rpm.define("gosetup %forgesetup")
-- Final spec variable summary if the macro was called with -i
if (rpm.expand("%{?-i}") ~= "") then
rpm.expand("%{echo:Go-specific packaging variables}")
rpm.expand("%{echo: goipath: %{?goipath}}")
rpm.expand("%{echo: goname: %{?goname}}")
rpm.expand("%{echo: gourl: %{?gourl}}")
rpm.expand("%{echo: gosource: %{?gosource}}")
end}
BuildRequires: compiler(go-compiler)
ExclusiveArch: %{go_arches}
}

1
macros.nim-srpm Normal file
View File

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

11
macros.ocaml-srpm Normal file
View File

@ -0,0 +1,11 @@
# 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

31
macros.openEuler Normal file
View File

@ -0,0 +1,31 @@
#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 || :

2
macros.openblas-srpm Normal file
View File

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

15
macros.perl-srpm Normal file
View File

@ -0,0 +1,15 @@
# 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

19
macros.pybytecompile Normal file
View File

@ -0,0 +1,19 @@
# 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

81
macros.python Normal file
View File

@ -0,0 +1,81 @@
%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}

107
macros.python-srpm Normal file
View File

@ -0,0 +1,107 @@
# 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)
}

41
macros.python2 Normal file
View File

@ -0,0 +1,41 @@
%__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
}

43
macros.python3 Normal file
View File

@ -0,0 +1,43 @@
%__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
}

1
macros.rust-srpm Normal file
View File

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

Binary file not shown.

View File

@ -0,0 +1,25 @@
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