From db2a9058457d123f0a30ac29e622a671a02543b8 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sun, 20 Feb 2022 13:13:43 +0100 Subject: [PATCH] - merged 2011 from PLD --- macros.arch | 21 ++++++++++++++++++ macros.go | 35 ++++++++++++++++++++++++++++++ macros.rust | 52 +++++++++++++++++++++++++++++++++++++++------ macros.tld | 2 +- rpm-tld-macros.spec | 10 +++++++-- rpmrc | 6 +++--- 6 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 macros.arch create mode 100644 macros.go diff --git a/macros.arch b/macros.arch new file mode 100644 index 0000000..2718e3c --- /dev/null +++ b/macros.arch @@ -0,0 +1,21 @@ +%x86_with_3dnow athlon +%x86_with_mmx %{x8664} x32 pentium2 pentium3 pentium4 athlon +%x86_with_sse %{x8664} x32 pentium3 pentium4 +%x86_with_sse2 %{x8664} x32 pentium4 + +%armv4 armv4b armv4l armv4tl +%armv5 armv5tl armv5tel armv5tejl +%armv6 armv6l armv6hl +%armv7 armv7l armv7hl armv7hnl +%armv8 armv8l armv8hl armv8hnl armv8hcnl +%arm32 %{armv4} %{armv5} %{armv6} %{armv7} %{armv8} +%arm64 aarch64 +%arm32_with_hf armv6hl armv7hl armv7hnl armv8hl armv8hnl armv8hcnl +%arm64_with_hf aarch64 +%arm_with_hf %{arm32_with_hf} %{arm64_with_hf} +%arm32_with_neon armv7hnl armv8hnl armv8hcnl +%arm64_with_neon aarch64 +%arm_with_neon %{arm32_with_neon} %{arm64_with_neon} + +%arch32 %{ix86} %{arm32} ppc sparc sparcv9 +%arch64 %{x8664} %{arm64} ppc64 sparc64 diff --git a/macros.go b/macros.go new file mode 100644 index 0000000..07efe21 --- /dev/null +++ b/macros.go @@ -0,0 +1,35 @@ +%go_arches %{ix86} %{x8664} %{armv5} %{armv6} %{armv7} aarch64 mips mipsel mips64 mips64le ppc64 ppc64le riscv64 s390x + +%__go \\\ +%ifarch aarch64 \ + GOARCH=${GOARCH-arm64} \\\ +%endif \ +%ifarch %{armv5} \ + GOARCH=${GOARCH-arm} \\\ + GOARM=${GOARM-5} \\\ +%endif \ +%ifarch %{armv6} \ + GOARCH=${GOARCH-arm} \\\ + GOARM=${GOARM-6} \\\ +%endif \ +%ifarch %{armv7} \ + GOARCH=${GOARCH-arm} \\\ + GOARM=${GOARM-7} \\\ +%endif \ +%ifarch mipsel \ + GOARCH=${GOARCH-mipsle} \\\ +%endif \ +%ifarch mips64el \ + GOARCH=${GOARCH-mips64le} \\\ +%endif \ +%ifarch %{ix86} \ + GOARCH=${GOARCH-386} \\\ +%endif \ +%ifarch %{x8664} \ + GOARCH=${GOARCH-amd64} \\\ +%endif \ +%ifarch mips mips64 ppc64 ppc64le riscv64 s390x \ + GOARCH=${GOARCH-%{_arch}} \\\ +%endif \ + GOOS=${GOOS-linux} \\\ + /usr/bin/go diff --git a/macros.rust b/macros.rust index e899292..3f61146 100644 --- a/macros.rust +++ b/macros.rust @@ -2,22 +2,62 @@ %rpmrustflags %debuginforustflags %rust_arches %{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl +%cargo_target \\\ +%ifarch i586\ +i586-unknown-linux-gnu\\\ +%endif\ +%ifarch i686 pentium3 pentium4 athlon\ +i686-unknown-linux-gnu\\\ +%endif\ +%ifarch %{x8664}\ +x86_64-unknown-linux-gnu\\\ +%endif\ +%ifarch x32\ +x86_64-unknown-linux-gnux32\\\ +%endif\ +%ifarch aarch64\ +aarch64-unknown-linux-gnu\\\ +%endif\ +%ifarch armv6hl\ +arm-unknown-linux-gnueabihf\\\ +%endif\ +%ifarch armv7hl \ +armv7-unknown-linux-gnueabihf\\\ +%endif\ +%ifarch armv7hnl\ +thumbv7neon-unknown-linux-gnueabihf\\\ +%endif\ +%{nil} + +%cargo_targetdir target +%cargo_objdir %{?buildsubdir:%{_builddir}/%{buildsubdir}/}%{cargo_targetdir}/%{cargo_target}/%{!?debug:release}%{?debug:debug} + %__cargo /usr/bin/cargo %__cargo_common_opts -v --offline %cargo_build \\\ + CC="%{__cc}" \\\ + CXX="%{__cxx}" \\\ + CFLAGS="%{rpmcppflags} %{rpmcflags}" \\\ + CXXFLAGS="%{rpmcppflags} %{rpmcxxflags}" \\\ + LDFLAGS="%{rpmldflags}" \\\ + PKG_CONFIG_ALLOW_CROSS=1 \\\ RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\ %{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\ %{__cargo} %{__cargo_common_opts} build %{!?debug:--release} \\\ -%ifarch x32 \ - --target x86_64-unknown-linux-gnux32 \\\ -%endif \ + --target %{cargo_target} \\\ + --target-dir %{cargo_targetdir} \\\ %{nil} %cargo_install \\\ + CC="%{__cc}" \\\ + CXX="%{__cxx}" \\\ + CFLAGS="%{rpmcppflags} %{rpmcflags}" \\\ + CXXFLAGS="%{rpmcppflags} %{rpmcxxflags}" \\\ + LDFLAGS="%{rpmldflags}" \\\ + PKG_CONFIG_ALLOW_CROSS=1 \\\ RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\ %{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\ %{__cargo} %{__cargo_common_opts} install \\\ -%ifarch x32 \ - --target x86_64-unknown-linux-gnux32 \\\ -%endif \ + --target %{cargo_target} \\\ + --target-dir %{cargo_targetdir} \\\ %{nil} diff --git a/macros.tld b/macros.tld index 6661f89..366637d 100644 --- a/macros.tld +++ b/macros.tld @@ -250,7 +250,7 @@ pakietu oraz przy odpluskwianiu samego pakietu.\ %__make /usr/bin/make %{?_make_opts} %{?_smp_mflags} %__scons /usr/bin/scons %{?_smp_mflags} %__waf /usr/bin/waf %{?_smp_mflags} -%__cmake /usr/bin/cmake -Wno-dev +%__cmake /usr/bin/cmake %__meson /usr/bin/meson %__meson_wrap_mode nodownload %__ninja /usr/bin/ninja diff --git a/rpm-tld-macros.spec b/rpm-tld-macros.spec index 41142de..386eee8 100644 --- a/rpm-tld-macros.spec +++ b/rpm-tld-macros.spec @@ -1,4 +1,4 @@ -%define rpm_macros_rev 2.006 +%define rpm_macros_rev 2.011 %define find_lang_rev 1.40 # split into individual X_prov_ver if there is a reason to desync %define prov_ver 4.15 @@ -6,7 +6,7 @@ Summary: TLD Linux RPM macros Summary(pl.UTF-8): Makra RPM dla Linuksa TLD Name: rpm-tld-macros Version: %{rpm_macros_rev} -Release: 1 +Release: 6 License: GPL v2+ Group: Development/Building Source0: macros.tld @@ -51,6 +51,8 @@ Source52: macros.xmms Source53: macros.xorg Source54: macros.selinux Source55: macros.rust +Source56: macros.arch +Source57: macros.go Source60: macros.gstreamer Source61: attr.gstreamer @@ -229,6 +231,8 @@ cp -p %{SOURCE52} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.xmms cp -p %{SOURCE53} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.xorg cp -p %{SOURCE54} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.selinux cp -p %{SOURCE55} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.rust +cp -p %{SOURCE56} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.arch +cp -p %{SOURCE57} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.go cp -p %{SOURCE60} $RPM_BUILD_ROOT%{_usrlibrpm}/macros.d/macros.gstreamer cp -p %{SOURCE61} $RPM_BUILD_ROOT%{_usrlibrpm}/fileattrs/gstreamer.attr @@ -249,10 +253,12 @@ rm -rf $RPM_BUILD_ROOT %{_usrlibrpm}/fileattrs/php.attr %{_usrlibrpm}/fileattrs/ruby.attr +%{_usrlibrpm}/macros.d/macros.arch %{_usrlibrpm}/macros.d/macros.browser-plugins %{_usrlibrpm}/macros.d/macros.cacti %{_usrlibrpm}/macros.d/macros.emacs %{_usrlibrpm}/macros.d/macros.ghc +%{_usrlibrpm}/macros.d/macros.go %{_usrlibrpm}/macros.d/macros.gstreamer %{_usrlibrpm}/macros.d/macros.java %{_usrlibrpm}/macros.d/macros.kernel diff --git a/rpmrc b/rpmrc index cbac36e..43f2d7b 100644 --- a/rpmrc +++ b/rpmrc @@ -14,9 +14,9 @@ optflags: aarch64 %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit optflags: riscv64 %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=rv64imafdc -mabi=lp64d %{!?nospecflags:%{?specflags_riscv64}} optflags: armv6j %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv6j -mfpu=vfp -mfloat-abi=hard %{!?nospecflags:%{?specflags_arm} %{?specflags_arm6j}} -optflags: armv7l %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7l}} -optflags: armv7hl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv7-a -mfloat-abi=hard %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7hl}} -optflags: armv7hnl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} %{?!_disable_neon:-mfpu=neon-vfpv4} -march=armv7-a -mfloat-abi=hard %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7hnl}} +optflags: armv7l %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7l}} +optflags: armv7hl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv7-a -mfloat-abi=hard -mthumb %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7hl}} +optflags: armv7hnl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} %{?!_disable_neon:-mfpu=neon-vfpv3} -march=armv7-a -mfloat-abi=hard -mthumb %{!?nospecflags:%{?specflags_arm} %{?specflags_arm7hnl}} optflags: armv8l %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv8-a -mfloat-abi=softfp -mfpu=vfpv3-d16 %{!?nospecflags:%{?specflags_arm} %{?specflags_arm8l}} optflags: armv8hl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} -march=armv8-a -mfloat-abi=hard %{!?nospecflags:%{?specflags_arm} %{?specflags_arm8hl}} optflags: armv8hnl %{?__common_cflags_with_ssp:%{__common_cflags_with_ssp} -fomit-frame-pointer}%{!?__common_cflags_with_ssp:-O2 -g} %{?!_disable_neon:-mfpu=neon-vfpv4} -march=armv8-a -mfloat-abi=hard %{!?nospecflags:%{?specflags_arm} %{?specflags_arm8hnl}} -- 2.46.0