diff options
58 files changed, 3164 insertions, 6963 deletions
@@ -0,0 +1 @@ +/30.tar.gz diff --git a/0001-1-Add-riscv64-to-golang_arches.patch b/0001-1-Add-riscv64-to-golang_arches.patch new file mode 100644 index 0000000..e52a168 --- /dev/null +++ b/0001-1-Add-riscv64-to-golang_arches.patch @@ -0,0 +1,27 @@ +From c1b9fdaa93bfe0b2c70be4a851500d15f891d2f8 Mon Sep 17 00:00:00 2001 +From: whoisxxx <whoisxxx@126.com> +Date: Sat, 28 Nov 2020 11:02:21 +0800 +Subject: [PATCH] !1 Add "riscv64" to golang_arches The golang version 1.14 has + support riscv64, so add "riscv64" to golang_arches to enable rpmbuild for + golang. + +--- + macros.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/macros.go b/macros.go +index c1e6e75..cd493e7 100644 +--- a/macros.go ++++ b/macros.go +@@ -12,7 +12,7 @@ + # redhat-rpm-macros. +  + # Define arches for PA and SA +-%golang_arches   %{ix86} x86_64 %{arm} aarch64 ppc64le s390x ++%golang_arches   %{ix86} x86_64 %{arm} aarch64 ppc64le s390x riscv64 + %gccgo_arches    %{mips} + %go_arches       %{golang_arches} %{gccgo_arches} +  +--  +1.8.3.1 + diff --git a/0001-Enable-LTO-By-Default.patch b/0001-Enable-LTO-By-Default.patch new file mode 100644 index 0000000..bac5897 --- /dev/null +++ b/0001-Enable-LTO-By-Default.patch @@ -0,0 +1,625 @@ +From 2a24fbc1bb28764c3577f3a9e108614cd2e108b2 Mon Sep 17 00:00:00 2001 +From: wangchunyang <wangchunyang15@huawei.com> +Date: Fri, 26 Jul 2024 12:54:56 +0800 +Subject: [PATCH] Enable LTO By Default + +--- + brp-strip-lto  |  17 ++ + lto_flag       |   5 + + lto_white_list | 536 +++++++++++++++++++++++++++++++++++++++++++++++++ + macros         |   6 +- + 4 files changed, 563 insertions(+), 1 deletion(-) + create mode 100644 brp-strip-lto + create mode 100755 lto_flag + create mode 100644 lto_white_list + +diff --git a/brp-strip-lto b/brp-strip-lto +new file mode 100644 +index 0000000..3df672a +--- /dev/null ++++ b/brp-strip-lto +@@ -0,0 +1,17 @@ ++#!/usr/bin/sh ++# If using normal root, avoid changing anything. ++if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then ++	exit 0 ++fi ++  ++STRIP=${1:-strip} ++NCPUS=${RPM_BUILD_NCPUS:-1} ++  ++case `uname -a` in ++Darwin*) exit 0 ;; ++*) ;; ++esac ++  ++# Strip ELF binaries ++find "$RPM_BUILD_ROOT" -type f -name '*.[ao]' \! -regex "$RPM_BUILD_ROOT/*usr/lib/debug.*" -print0 | \ ++  eu-elfclassify --not-program --not-library --not-linux-kernel-module --stdin0 --print0 | xargs -0 -r -P$NCPUS -n32 sh -c "$STRIP -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 \"\$@\"" ARG0 +diff --git a/lto_flag b/lto_flag +new file mode 100755 +index 0000000..53e3adb +--- /dev/null ++++ b/lto_flag +@@ -0,0 +1,5 @@ ++#!/bin/sh ++current_spec=`cat /.build.command` ++if grep -Fxq "$current_spec" "/lib/rpm/openEuler/lto_white_list"; then ++    echo "-flto -ffat-lto-objects" ++fi +diff --git a/lto_white_list b/lto_white_list +new file mode 100644 +index 0000000..780be19 +--- /dev/null ++++ b/lto_white_list +@@ -0,0 +1,536 @@ ++adcli.spec ++aide.spec ++amanda.spec ++annobin.spec ++apr.spec ++argon2.spec ++at.spec ++atf.spec ++attr.spec ++audit.spec ++augeas.spec ++authselect.spec ++autogen.spec ++avahi.spec ++babeltrace.spec ++bind.spec ++bison.spec ++bolt.spec ++booth.spec ++brotli.spec ++byacc.spec ++bzip2.spec ++cairomm.spec ++certmonger.spec ++cfitsio.spec ++CharLS.spec ++check.spec ++chkconfig.spec ++chrony.spec ++chrpath.spec ++ck.spec ++clamav.spec ++clevis.spec ++clucene.spec ++cmake.spec ++cockpit.spec ++courier-unicode.spec ++cppcheck.spec ++cpp-httplib.spec ++cracklib.spec ++createrepo_c.spec ++cronie.spec ++cryptsetup.spec ++cups.spec ++cups-filters.spec ++curl.spec ++dav1d.spec ++dbus-broker.spec ++dbus-glib.spec ++dbxtool.spec ++dhcp.spec ++dialog.spec ++ding-libs.spec ++discount.spec ++dos2unix.spec ++dosfstools.spec ++double-conversion.spec ++dovecot.spec ++doxygen.spec ++dropwatch.spec ++drpm.spec ++d-spy.spec ++dwz.spec ++e2fsprogs.spec ++enca.spec ++entr.spec ++environment-modules.spec ++erlang-sd_notify.spec ++espeak-ng.spec ++ethtool.spec ++exempi.spec ++exiv2.spec ++expat.spec ++findutils.spec ++flac.spec ++flatbuffers.spec ++flex.spec ++fmt.spec ++fping.spec ++freetype.spec ++freexl.spec ++fribidi.spec ++gawk.spec ++gc.spec ++gdb.spec ++gdbm.spec ++gdisk.spec ++GeoIP.spec ++geos.spec ++gettext.spec ++ghostscript.spec ++git.spec ++gjs.spec ++glade.spec ++glib-networking.spec ++glm.spec ++glslang.spec ++glusterfs.spec ++gmp.spec ++gnome-autoar.spec ++gnupg2.spec ++gobject-introspection.spec ++gperftools.spec ++GraphicsMagick.spec ++graphite2.spec ++graphviz.spec ++greatsql.spec ++grep.spec ++groff.spec ++grubby.spec ++gsl.spec ++gsm.spec ++gtest.spec ++gzip.spec ++harfbuzz.spec ++hdf.spec ++hdf5.spec ++httpd.spec ++http-parser.spec ++hwloc.spec ++ibus-libpinyin.spec ++icu.spec ++ilmbase.spec ++Imath.spec ++iniparser.spec ++ipcalc.spec ++iproute.spec ++iptables.spec ++isomd5sum.spec ++jansson.spec ++jbig2dec.spec ++jbigkit.spec ++jemalloc.spec ++jimtcl.spec ++jose.spec ++jq.spec ++json-c.spec ++jsoncpp.spec ++Judy.spec ++kbd.spec ++krb5.spec ++kyua.spec ++lame.spec ++lcms2.spec ++libabigail.spec ++libadwaita.spec ++libaec.spec ++libarchive.spec ++libart_lgpl.spec ++libass.spec ++libatomic_ops.spec ++libb2.spec ++libbsd.spec ++libcap.spec ++libcap-ng.spec ++libcdio.spec ++libcdio-paranoia.spec ++libcomps.spec ++libconfuse.spec ++libcue.spec ++libdatrie.spec ++libdbi.spec ++libdnf.spec ++libdrm.spec ++libdwarf.spec ++libEMF.spec ++libev.spec ++libevent.spec ++libffado.spec ++libfprint.spec ++libgexiv2.spec ++libgit2.spec ++libglvnd.spec ++libgta.spec ++libhandy.spec ++libidn.spec ++libidn2.spec ++libiscsi.spec ++libisoburn.spec ++libjpeg-turbo.spec ++libkcapi.spec ++libkeepalive.spec ++libldb.spec ++liblouis.spec ++libmaxminddb.spec ++libmbim.spec ++libmd.spec ++libmemcached.spec ++libmetalink.spec ++libmodplug.spec ++libmodulemd.spec ++libnftnl.spec ++libnma.spec ++libnvme.spec ++libogg.spec ++libopenraw.spec ++libpinyin.spec ++libpipeline.spec ++libplist.spec ++libpwquality.spec ++libqb.spec ++libquvi.spec ++librabbitmq.spec ++libraqm.spec ++librdkafka.spec ++librepo.spec ++libreswan.spec ++librevenge.spec ++libsamplerate.spec ++libseccomp.spec ++libsemanage.spec ++libserf.spec ++libsexy.spec ++libshumate.spec ++libsndfile.spec ++libsodium.spec ++libsolv.spec ++libspectre.spec ++libspiro.spec ++libssh.spec ++libssh2.spec ++libtalloc.spec ++libtasn1.spec ++libtdb.spec ++libtevent.spec ++libtiff.spec ++libunwind.spec ++libusb.spec ++libusbmuxd.spec ++libuser.spec ++libutempter.spec ++libuv.spec ++libvirt.spec ++libvirt-python.spec ++libvorbis.spec ++libwacom.spec ++libwbxml.spec ++libx86emu.spec ++libyaml.spec ++libyubikey.spec ++libzip.spec ++lilv.spec ++lldb.spec ++lmdb.spec ++logrotate.spec ++lshw.spec ++lsof.spec ++lua-expat.spec ++lua-filesystem.spec ++lua-lpeg.spec ++luksmeta.spec ++lzip.spec ++lzo.spec ++m2crypto.spec ++m4.spec ++malcontent.spec ++man-db.spec ++mcpp.spec ++mdadm.spec ++mecab.spec ++metis.spec ++mksh.spec ++mod_auth_openidc.spec ++mod_http2.spec ++mokutil.spec ++mongo-c-driver.spec ++mozjs102.spec ++mpfr.spec ++mpich.spec ++mysql.spec ++nasm.spec ++netcf.spec ++nethogs.spec ++netpbm.spec ++net-snmp.spec ++newt.spec ++nfs-utils.spec ++nftables.spec ++nghttp2.spec ++ninja-build.spec ++nodejs.spec ++npth.spec ++nspr.spec ++nss_wrapper.spec ++nss-mdns.spec ++nss-pam-ldapd.spec ++nss-pem.spec ++ntp.spec ++numpy.spec ++ocl-icd.spec ++oddjob.spec ++oniguruma.spec ++opencc.spec ++OpenEXR.spec ++openhpi.spec ++open-isns.spec ++openmpi.spec ++openscap.spec ++opensp.spec ++openssh.spec ++openvpn.spec ++openvswitch.spec ++p11-kit.spec ++pacemaker.spec ++pam_krb5.spec ++pam_wrapper.spec ++pango.spec ++passwd.spec ++patchelf.spec ++patchutils.spec ++pavucontrol.spec ++pcre2.spec ++perl-autovivification.spec ++perl-B-COW.spec ++perl-BSD-Resource.spec ++perl-Class-XSAccessor.spec ++perl-Clone.spec ++perl-Compress-Bzip2.spec ++perl-Compress-Raw-Bzip2.spec ++perl-Compress-Raw-Zlib.spec ++perl-Crypt-DES.spec ++perl-Crypt-IDEA.spec ++perl-Curses.spec ++perl-Data-Dumper.spec ++perl-Data-UUID.spec ++perl-DateTime.spec ++perl-DB_File.spec ++perl-DBD-MariaDB.spec ++perl-DBD-MySQL.spec ++perl-DBD-Pg.spec ++perl-DBD-SQLite.spec ++perl-Devel-CallChecker.spec ++perl-Devel-Caller.spec ++perl-Devel-LexAlias.spec ++perl-Digest-MD5.spec ++perl-Digest-SHA.spec ++perl-Digest-SHA1.spec ++perl-Digest-SHA3.spec ++perl-Encode-EUCJPASCII.spec ++perl-Encode-JIS2K.spec ++perl-FCGI.spec ++perl-Filter.spec ++perl-GD.spec ++perl-Glib.spec ++perl-GSSAPI.spec ++perl-HTML-Parser.spec ++perl-IO-Tty.spec ++perl-IPC-SysV.spec ++perl-libintl-perl.spec ++perl-List-MoreUtils-XS.spec ++perl-Math-BigInt-FastCalc.spec ++perl-MIME-Base64.spec ++perl-NetAddr-IP.spec ++perl-Package-Stash-XS.spec ++perl-PerlIO-utf8_strict.spec ++perl-PkgConfig-LibPkgConf.spec ++perl-Scalar-List-Utils.spec ++perl-Socket.spec ++perl-Socket6.spec ++perl-Storable.spec ++perl-Sub-Identify.spec ++perl-Sub-Name.spec ++perl-Syntax-Keyword-Try.spec ++perl-Sys-CPU.spec ++perl-Sys-MemInfo.spec ++perl-Sys-Syslog.spec ++perl-TermReadKey.spec ++perl-Test-LeakTrace.spec ++perl-Text-Soundex.spec ++perl-threads-shared.spec ++perl-Time-HiRes.spec ++perl-Unicode-Collate.spec ++perl-Unicode-LineBreak.spec ++perl-Unicode-Normalize.spec ++perl-XML-LibXSLT.spec ++perl-YAML-LibYAML.spec ++phonon.spec ++pigz.spec ++pipewire.spec ++pkgconf.spec ++pngquant.spec ++poco.spec ++polkit-pkla-compat.spec ++poppler.spec ++popt.spec ++postgresql.spec ++postgresql-odbc.spec ++procenv.spec ++proj.spec ++protobuf2.spec ++protobuf-c.spec ++pulseaudio.spec ++pycairo.spec ++pyparted.spec ++PyQt4.spec ++python3.spec ++python-argon2-cffi-bindings.spec ++python-bcrypt.spec ++python-cffi.spec ++python-cheetah.spec ++python-ethtool.spec ++python-greenlet.spec ++python-kiwisolver.spec ++python-lazy-object-proxy.spec ++python-markupsafe.spec ++python-netifaces.spec ++python-pillow.spec ++python-psycopg2.spec ++python-pycryptodomex.spec ++python-pycurl.spec ++python-pymongo.spec ++python-pynacl.spec ++python-pyrsistent.spec ++python-simplejson.spec ++python-systemd.spec ++python-urwid.spec ++python-zope-interface.spec ++python-zstandard.spec ++pyxattr.spec ++qpid-proton.spec ++qrencode.spec ++qscintilla.spec ++qt6-qttools.spec ++quota.spec ++raptor2.spec ++rcs.spec ++realmd.spec ++recode.spec ++rhash.spec ++rpm.spec ++rrdtool.spec ++rsync.spec ++rsyslog.spec ++ruby.spec ++ruby-augeas.spec ++rubygem-bcrypt.spec ++rubygem-bindex.spec ++rubygem-bootsnap.spec ++rubygem-ffi.spec ++rubygem-hiredis.spec ++rubygem-idn.spec ++rubygem-msgpack.spec ++rubygem-nio4r.spec ++rubygem-nokogiri.spec ++rubygem-pg.spec ++rubygem-racc.spec ++rubygem-rdiscount.spec ++rubygem-redcarpet.spec ++rubygem-RedCloth.spec ++rubygem-regexp_property_values.spec ++rubygem-ruby-shadow.spec ++rubygem-sqlite3.spec ++rubygem-thin.spec ++rubygem-unf_ext.spec ++rubygem-websocket-driver.spec ++rust.spec ++satyr.spec ++sbc.spec ++sendmail.spec ++setools.spec ++sg3_utils.spec ++slang.spec ++snappy.spec ++socat.spec ++socket_wrapper.spec ++softhsm.spec ++sox.spec ++soxr.spec ++squid.spec ++sratom.spec ++srt.spec ++sscg.spec ++strace.spec ++subunit.spec ++swtpm.spec ++symlinks.spec ++sysbench.spec ++sysfsutils.spec ++sysprof.spec ++sysstat.spec ++systemd.spec ++taglib.spec ++tang.spec ++tar.spec ++tcl.spec ++tclx.spec ++tcp_wrappers.spec ++tcsh.spec ++teckit.spec ++telepathy-glib.spec ++tigervnc.spec ++time.spec ++timedatex.spec ++tipcutils.spec ++tokyocabinet.spec ++tpm2-tools.spec ++ttembed.spec ++ub-dhcp.spec ++uchardet.spec ++uid_wrapper.spec ++unbound.spec ++units.spec ++unrtf.spec ++unzip.spec ++uriparser.spec ++usbguard.spec ++userspace-rcu.spec ++ustr.spec ++utf8proc.spec ++util-linux.spec ++uuid.spec ++varnish.spec ++vid.stab.spec ++vino.spec ++virt-what.spec ++volume_key.spec ++wget.spec ++wxGTK3.spec ++xcb-util.spec ++xcb-util-image.spec ++xcb-util-keysyms.spec ++xcb-util-wm.spec ++xcb-util-xrm.spec ++xdelta.spec ++xmlstarlet.spec ++xmlto.spec ++xorg-x11-server.spec ++xorg-x11-xauth.spec ++xxhash.spec ++yajl.spec ++yelp.spec ++ykpers.spec ++zenity.spec ++zeromq.spec ++zstd.spec ++ +diff --git a/macros b/macros +index 3cd2655..b3fcdb5 100644 +--- a/macros ++++ b/macros +@@ -173,6 +173,7 @@ + %__brp_ldconfig /usr/lib/rpm/brp-ldconfig + %__brp_compress /usr/lib/rpm/brp-compress + %__brp_strip /usr/lib/rpm/brp-strip %{__strip} ++%__brp_strip_lto /usr/lib/rpm/brp-strip-lto %{__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}" +@@ -185,6 +186,7 @@ +     %{?__brp_strip} \ +     %{?__brp_strip_comment_note} \ +     } \ ++    [ "%{_lto_cflags}"x != x ] && %{?__brp_strip_lto} \ +     %{?__brp_strip_static_archive} \ +     %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ +     %{?__brp_python_hardlink} \ +@@ -261,7 +263,9 @@ + %_ld_as_needed		1 + %_ld_as_needed_flags	%{?_ld_as_needed:-Wl,--as-needed} +  +-%_general_options         -O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ] ++%_get_lto_cflags          %(/lib/rpm/openEuler/lto_flag) ++%_lto_cflags              %{_get_lto_cflags} ++%_general_options         -O2 %{_lto_cflags} -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ] + %_warning_options         -Wall -Werror=format-security + %_preprocessor_defines    -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS +  +--  +2.43.0 + diff --git a/0001-add-loongarch64-for-golang_arches.patch b/0001-add-loongarch64-for-golang_arches.patch new file mode 100644 index 0000000..4623504 --- /dev/null +++ b/0001-add-loongarch64-for-golang_arches.patch @@ -0,0 +1,25 @@ +From 28921237101c986eeee13808a1167db13dc788ce Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang <zhangwenlong@loongson.cn> +Date: Tue, 13 Dec 2022 12:07:10 +0000 +Subject: [PATCH] add loongarch64 for golang_arches + +--- + macros.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/macros.go b/macros.go +index cd493e7..f20f6a1 100644 +--- a/macros.go ++++ b/macros.go +@@ -12,7 +12,7 @@ + # redhat-rpm-macros. +  + # Define arches for PA and SA +-%golang_arches   %{ix86} x86_64 %{arm} aarch64 ppc64le s390x riscv64 ++%golang_arches   %{ix86} x86_64 %{arm} aarch64 ppc64le s390x riscv64 loongarch64 + %gccgo_arches    %{mips} + %go_arches       %{golang_arches} %{gccgo_arches} +  +--  +2.33.0 + diff --git a/Add-support-for-selecting-clang-as-a-toolchain.patch b/Add-support-for-selecting-clang-as-a-toolchain.patch new file mode 100644 index 0000000..c38c7cb --- /dev/null +++ b/Add-support-for-selecting-clang-as-a-toolchain.patch @@ -0,0 +1,113 @@ +From f2a6af2ce79e26bf47604b610056d8c524b647f2 Mon Sep 17 00:00:00 2001 +From: liyunfei <liyunfei33@huawei.com> +Date: Tue, 9 Jan 2024 20:39:10 +0800 +Subject: [PATCH 1/2] Add support for selecting clang as a toolchain + +--- + generic-hardened-clang.cfg |  1 + + macros                     | 56 ++++++++++++++++++++++++++++++++++++-- + 2 files changed, 57 insertions(+), 3 deletions(-) + create mode 100644 generic-hardened-clang.cfg + +diff --git a/generic-hardened-clang.cfg b/generic-hardened-clang.cfg +new file mode 100644 +index 0000000..ac596df +--- /dev/null ++++ b/generic-hardened-clang.cfg +@@ -0,0 +1 @@ ++-fPIE +\ No newline at end of file +diff --git a/macros b/macros +index 5fdaf0a..0062126 100755 +--- a/macros ++++ b/macros +@@ -23,6 +23,46 @@ +  + %_build_id_links none +  ++# GCC toolchain ++%__cc_gcc gcc ++%__cxx_gcc g++ ++%__cpp_gcc gcc -E ++  ++# Clang toolchain ++%__cc_clang clang ++%__cxx_clang clang++ ++%__cpp_clang clang-cpp ++  ++# Default to the GCC toolchain ++# ++# It is enough to override `toolchain` macro and all relevant macro for C/C++ ++# compilers will be switched. Either in the spec or in the command-line. ++# ++#     %global toolchain clang ++# ++# or: ++# ++#     rpmbuild -D "toolchain clang" … ++# ++# Inside a spec file it is also possible to determine which toolchain is in use ++# by testing the same macro. For example: ++# ++#     %if "%{toolchain}" == "gcc" ++#     BuildRequires: gcc ++#     %endif ++# ++# or: ++# ++#     %if "%{toolchain}" == "clang" ++#     BuildRequires: clang compiler-rt ++#     %endif ++# ++%toolchain gcc ++  ++%__cc %{expand:%%{__cc_%{toolchain}}} ++%__cxx %{expand:%%{__cxx_%{toolchain}}} ++%__cpp %{expand:%%{__cpp_%{toolchain}}} ++ + #============================================================================== + # ---- compiler flags. +  +@@ -31,7 +71,13 @@ + %build_fflags %{optflags} -fexceptions -I%{_fmoddir} + %build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} +  ++%set_build_cc \ ++  CC=%{__cc}; export CC ; \ ++  CXX=%{__cxx}; export CXX ; \ ++  CCC="${CCC:-%{__cxx}}" ; export CCC ++ + %set_build_flags \ ++  %[ "%{toolchain}" == "gcc" ? "" : "%{set_build_cc};" ] \ +   CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \ +   CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \ +   FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \ +@@ -162,8 +208,10 @@ + # secure options for rpmbuild + # + # #hardened options +-%_hardening_cflags	-specs=/usr/lib/rpm/generic-hardened-cc1 +-%_hardening_ldflags	-Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld ++%_hardening_gcc_cflags	-specs=/usr/lib/rpm/generic-hardened-cc1 ++%_hardening_clang_cflags --config /usr/lib/rpm/generic-hardened-clang.cfg ++%_hardening_cflags	 %{expand:%%{_hardening_%{toolchain}_cflags}} ++%_hardening_ldflags	-Wl,-z,now %[ "%{toolchain}" == "gcc" ? "-specs=/usr/lib/rpm/generic-hardened-ld" : "" ] + # Use "%undefine _hardened_build" to disable. + %_hardened_build	1 + %_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}} +@@ -195,7 +243,11 @@ + #%_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 -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags}  ++%_general_options         -O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ] ++%_warning_options         -Wall -Werror=format-security ++%_preprocessor_defines    -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS ++ ++%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_hardened_cflags} +  + # Automatically trim changelog entries after 2 years + %_changelog_trimtime	%{lua:print(os.time() - 2 * 365 * 86400)} +--  +2.27.0 + diff --git a/Call-set_build_flags-cc-before-build-check-and-insta.patch b/Call-set_build_flags-cc-before-build-check-and-insta.patch new file mode 100644 index 0000000..8f69298 --- /dev/null +++ b/Call-set_build_flags-cc-before-build-check-and-insta.patch @@ -0,0 +1,49 @@ +From c6b15b8c17f957d736dd975d106b10d419070ebd Mon Sep 17 00:00:00 2001 +From: liyunfei <liyunfei33@huawei.com> +Date: Tue, 9 Jan 2024 20:50:34 +0800 +Subject: [PATCH 2/2] Call %set_build_flags&cc before %build, %check, and + %install stages + +--- + macros | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/macros b/macros +index 0062126..8c16706 100755 +--- a/macros ++++ b/macros +@@ -83,6 +83,22 @@ +   FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \ +   LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS +  ++# Automatically use set_build_flags macro for build, check, and ++# install phases. ++# Use "%undefine _auto_set_build_flags" to disable" ++# Automatically use set_build_cc macro for build, check, and ++# install phases. ++# Use "%undefine _auto_set_build_cc" to disable" ++%_auto_set_build_cc %["%{toolchain}" == "gcc" ? 0 : 1] ++%_auto_set_build_flags 0 ++ ++%__spec_build_pre %{___build_pre} \ ++  %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""] \ ++  %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""] ++%__spec_check_pre %{___build_pre} \ ++  %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""] \ ++  %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""] ++ + #For backwards compatibility only. + %__global_cflags %{build_cflags} + %__global_cxxflags %{build_cxxflags} +@@ -144,6 +158,8 @@ +     [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\ +     mkdir -p `dirname "$RPM_BUILD_ROOT"`\ +     mkdir "$RPM_BUILD_ROOT"\ ++    %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""]\ ++    %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""]\ + %{nil} +  + # ---- Expanded at end of %install scriptlet. +--  +2.27.0 + diff --git a/Delete-the-commented-code.patch b/Delete-the-commented-code.patch new file mode 100644 index 0000000..b9f0469 --- /dev/null +++ b/Delete-the-commented-code.patch @@ -0,0 +1,24 @@ +From c7605385b9d838be78a87de02a48eaaa6e69b4b2 Mon Sep 17 00:00:00 2001 +From: hongjinghao <hongjinghao@huawei.com>  +Date: Tue, 5 Mar 2024 20:22:59 +0800 +Subject: [PATCH] Delete the commented code + +--- + brp-digest-list | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/brp-digest-list b/brp-digest-list +index 77248c9..7de42b7 100644 +--- a/brp-digest-list ++++ b/brp-digest-list +@@ -9,7 +9,6 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then + fi +  + # Create temporary file listing files in the manifest +-#[ -n "$TMPDIR" ] || TMPDIR="/tmp" + TMPDIR="/tmp" + BIN_PKG_FILES=${TMPDIR}/${3%%.rpm} + cat - > $BIN_PKG_FILES +--  +2.33.0 + diff --git a/Feature-support-EBS-sign-for-IMA-digest-list.patch b/Feature-support-EBS-sign-for-IMA-digest-list.patch new file mode 100644 index 0000000..bd0fed0 --- /dev/null +++ b/Feature-support-EBS-sign-for-IMA-digest-list.patch @@ -0,0 +1,326 @@ +From 0449160c84daff8c557dee47a970e4f4837ff81d Mon Sep 17 00:00:00 2001 +From: Huaxin Lu <luhuaxin1@huawei.com> +Date: Mon, 12 Dec 2022 00:16:01 +0800 +Subject: [PATCH] support EBS sign for IMA digest list + +Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com> +Signed-off-by: zhangguangzhi <zhangguangzhi3@huawei.com> + +--- + brp-digest-list |  46 +++++----- + brp-ebs-sign    | 238 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 262 insertions(+), 22 deletions(-) + create mode 100644 brp-ebs-sign + +diff --git a/brp-digest-list b/brp-digest-list +index e698b7a..d1e2600 100644 +--- a/brp-digest-list ++++ b/brp-digest-list +@@ -26,7 +26,6 @@ fi + DIGEST_LIST_DIR=$RPM_BUILD_ROOT/$2/etc/ima/digest_lists + mkdir -p $DIGEST_LIST_DIR + mkdir -p $DIGEST_LIST_DIR.tlv +-mkdir -p $DIGEST_LIST_DIR.sig +  + # Generate digest list for the kernel + gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR -i l:policy \ +@@ -70,28 +69,31 @@ DIGEST_LIST_TLV_PATH="$DIGEST_LIST_DIR.tlv/0-metadata_list-compact_tlv-$(basenam + chmod 644 $DIGEST_LIST_TLV_PATH + echo $DIGEST_LIST_TLV_PATH +  +-if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \ +-      ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then +-	# Generate digest list for the user space parsers +-	LD_LIBRARY_PATH=$RPM_BUILD_ROOT/usr/lib64 \ +-		$RPM_BUILD_ROOT/usr/bin/gen_digest_lists \ +-		-d $DIGEST_LIST_DIR -t parser -f compact -m immutable \ +-		-i I:$RPM_BUILD_ROOT/usr/libexec -o add -p -1 -i i: +- +-	f="$DIGEST_LIST_DIR/0-parser_list-compact-libexec" +-	[ -f $f ] || exit 0 +- +-	chmod 644 $f +-	echo $f ++#if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \ ++#      ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then ++# Generate digest list for the user space parsers ++ ++# do EBS sign ++export PUBLISHER_HOST=$(grep PUBLISHER_HOST /lkp/scheduled/job.yaml | awk '{print $2}') ++export PUBLISHER_PORT=$(grep PUBLISHER_PORT /lkp/scheduled/job.yaml | awk '{print $2}') ++if [[ -n "$PUBLISHER_HOST" && -n "$PUBLISHER_PORT" ]]; then ++	[ -f /usr/lib/rpm/brp-ebs-sign ] || exit 0 ++	sh /usr/lib/rpm/brp-ebs-sign --ima-digestlist $DIGEST_LIST_PATH 1>&2 ++	[ -f $DIGEST_LIST_PATH.sig ] || exit 0 ++	chmod 644 $DIGEST_LIST_PATH.sig ++	mv $DIGEST_LIST_PATH.sig $DIGEST_LIST_PATH ++	exit 0 ++fi +  +-	[ -f /usr/lib/rpm/brp-suse.d/brp-99-pesign ] || exit 0 ++# do OBS sign ++[ -f /usr/lib/rpm/brp-suse.d/brp-99-pesign ] || exit 0 +  +-	export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*" +-	export RPM_BUILD_ROOT +-	export RPM_PACKAGE_NAME="digest-list-tools" +-	export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES" ++export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*" ++export RPM_BUILD_ROOT ++export RPM_PACKAGE_NAME="digest-list-tools" ++export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES" +  +-	if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then +-		/usr/lib/rpm/brp-suse.d/brp-99-pesign &> /dev/null +-	fi ++if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then ++	/usr/lib/rpm/brp-suse.d/brp-99-pesign &> /dev/null + fi ++#fi +diff --git a/brp-ebs-sign b/brp-ebs-sign +new file mode 100644 +index 0000000..a7a83e5 +--- /dev/null ++++ b/brp-ebs-sign +@@ -0,0 +1,238 @@ ++#!/bin/bash ++ ++INPUT_TYPE=$1 ++INPUT_FILE=$2 ++SIGN_FILE=$INPUT_FILE ++PROJECT_CONF="/lkp/scheduled/job.yaml" ++POST_ADDR="" ++POST_FILE_SHA256="" ++POST_KEY_NAME="" ++POST_KEY_TYPE="" ++POST_FILE_TYPE="" ++POST_SIGN_TYPE="" ++POST_JOB_ID="" ++POST_OS_ORIJECT="" ++CONFIG_RETEST_COUNT=5 ++SIGN_RESULT=0 ++FAILED_SIGN_PERMISSION_DENIED=2 ++ ++# Tool functions for JSON ++get_json_value(){ ++	echo "$1" | \ ++	awk -F "[{,:}]" '{for(i=1;i<NF;i++){if($i~"'$2'"){print $(i+1)}}}' | \ ++	sed 's/\"//g' ++} ++ ++get_post_json() { ++	printf '{' ++	printf '"file_sha256":"%s",' $POST_FILE_SHA256 ++	printf '"key_name":"%s",' $POST_KEY_NAME ++	printf '"key_type":"%s",' $POST_KEY_TYPE ++	printf '"file_type":"%s",' $POST_FILE_TYPE ++	printf '"sign_type":"%s",' $POST_SIGN_TYPE ++	printf '"job_id":"%s",' $POST_JOB_ID ++	printf '"os_project":"%s"' $POST_OS_ORIJECT ++	printf '}' ++} ++ ++# Prepare sign functions for each sign type ++module_sign_pre() { ++	if [[ "$INPUT_FILE" != *.ko ]]; then ++		echo "The module file must has the .ko extension" ++		return 1 ++	fi ++ ++	SIGN_FILE="$INPUT_FILE" ++	POST_KEY_NAME="openeuler-kernel-module-ee" ++	POST_KEY_TYPE="x509ee" ++	POST_FILE_TYPE="kernel-module" ++	POST_SIGN_TYPE="cms" ++} ++ ++ima_digestlist_sign_pre() { ++	cp -f $INPUT_FILE $INPUT_FILE.ko ++	SIGN_FILE="$INPUT_FILE.ko" ++	POST_KEY_NAME="openeuler-ima-ee" ++	POST_KEY_TYPE="x509ee" ++	POST_FILE_TYPE="kernel-module" ++	POST_SIGN_TYPE="cms" ++} ++ ++efi_sign_pre() { ++	SIGN_FILE="$INPUT_FILE" ++	POST_KEY_NAME="default-x509ee" ++	POST_KEY_TYPE="x509ee" ++	POST_FILE_TYPE="efi-image" ++	POST_SIGN_TYPE="authenticode" ++} ++ ++kernel_sign_pre() { ++	SIGN_FILE="$INPUT_FILE" ++	POST_KEY_NAME="default-x509ee" ++	POST_KEY_TYPE="x509ee" ++	POST_FILE_TYPE="efi-image" ++	POST_SIGN_TYPE="authenticode" ++} ++ ++# Post sign functions for each sign type ++module_sign_post() { ++	: ++} ++ ++ima_digestlist_sign_post() { ++	rm -f $INPUT_FILE.ko ++} ++ ++efi_sign_post() { ++	: ++} ++ ++kernel_sign_post() { ++	: ++} ++ ++# Global configuration ++sign_config() { ++	if [ -z "$INPUT_TYPE" ] || [ -z "$INPUT_FILE" ]; then ++		echo "Please input the sign type and file" ++		exit 1 ++	fi ++ ++	if [ ! -f "$INPUT_FILE" ]; then ++		echo "The input file is invalid" ++		exit 1 ++	fi ++ ++	POST_FILE_SHA256=$(sha256sum "$INPUT_FILE" | awk '{ print $1 }') ++	if [ $? -ne 0 ]; then ++		echo "Failed to calculate file hash" ++	fi ++ ++	PUBLISHER_HOST=$(grep PUBLISHER_HOST $PROJECT_CONF | awk '{print $2}') ++	PUBLISHER_PORT=$(grep PUBLISHER_PORT $PROJECT_CONF | awk '{print $2}') ++	if [ -z "$PUBLISHER_HOST" ] || [ -z "$PUBLISHER_PORT" ]; then ++		echo "Please set PUBLISHER_HOST and PUBLISHER_PORT" ++		exit 1 ++	fi ++ ++	POST_ADDR="http://${PUBLISHER_HOST}:${PUBLISHER_PORT}/code-sign" ++ ++	POST_JOB_ID="$(grep -rwn 'id\:' $PROJECT_CONF | awk '{print $2}')" ++	POST_OS_ORIJECT="$(grep -rwn 'os_project\:' $PROJECT_CONF | awk '{print $2}')" ++	if [ -z "$POST_JOB_ID" ] || [ -z "$POST_OS_ORIJECT" ]; then ++		echo "Failed to get POST_JOB_ID and POST_OS_ORIJECT" ++		exit 1 ++	fi ++} ++ ++sign_pre() { ++	sign_config ++ ++	case $INPUT_TYPE in ++	--efi) ++		efi_sign_pre ++		;; ++	--module) ++		module_sign_pre ++		;; ++	--ima-digestlist) ++		ima_digestlist_sign_pre ++		;; ++	--kernel) ++		kernel_sign_pre ++		;; ++	*) ++		echo "Unsupported sign type: $INPUT_TYPE" ++		exit 1 ++		;; ++	esac ++} ++ ++sign() { ++	# 1. send the request to the sign service ++	# echo "curl "$POST_ADDR" \ ++	# 	   -F "file=@$SIGN_FILE" \ ++	# 	   -F "data=$(get_post_json);type=application/json"" ++	req="$(curl "$POST_ADDR" \ ++		    -F "file=@$SIGN_FILE" \ ++		    -F "data=$(get_post_json);type=application/json")" ++	if [ $? -ne 0 ]; then ++		echo "Failed to post the sign service" ++		return 1 ++	fi ++ ++	req_err_msg=$(get_json_value "$req" "err_msg") ++	if [ -n "$req_err_msg" ]; then ++		echo "Failed, err_msg: [$req_err_msg]" ++		if [ "$req_err_msg" == "SIGN_PERMISSION_DENIED" ]; then ++			return $FAILED_SIGN_PERMISSION_DENIED ++		fi ++		return 1 ++	fi ++ ++	# 2. write the file content ++	encoded_file_content=$(get_json_value "$req" "encoded_file_content") ++	if [ $? -ne 0 ]; then ++		echo "Failed to get encoded file content" ++		return 1 ++	fi ++ ++	echo -ne "$encoded_file_content" | base64 -d > $INPUT_FILE.sig ++	if [ $? -ne 0 ]; then ++		echo "Failed to write the signed file" ++		return 1 ++	fi ++ ++	# for test ++	# cp -f $INPUT_FILE $INPUT_FILE.sig ++	# req="{file_sha256:41c68fca7b3870cc9ef13a828a74af933bd8e4ff345fcfa316}" ++ ++	# 3. check the hash ++	sha256_cal=$(sha256sum $INPUT_FILE.sig | awk '{print $1}') ++	sha256_get=$(get_json_value "$req" "file_sha256" | tr '[:upper:]' '[:lower:]') ++	if [ "$sha256_cal" != "$sha256_get" ]; then ++		echo "Failed to verify the hash value" ++		return 1 ++	fi ++} ++ ++sign_post() { ++	case $INPUT_TYPE in ++	--efi) ++		efi_sign_post ++		;; ++	--module) ++		module_sign_post ++		;; ++	--ima-digestlist) ++		ima_digestlist_sign_post ++		;; ++	--kernel) ++		kernel_sign_post ++		;; ++	esac ++} ++ ++# Main function ++sign_pre ++ ++for ((i=1; i<=$CONFIG_RETEST_COUNT; i++)); do ++	sign ++	ret_sign=$? ++	if [ $ret_sign -eq 0 ]; then ++		echo "Succeed to sign file" ++		break; ++	elif [ $ret_sign -eq $FAILED_SIGN_PERMISSION_DENIED ]; then ++		echo "Failed to sign file, permission denied" ++		SIGN_RESULT=$FAILED_SIGN_PERMISSION_DENIED ++		break; ++	elif [ $i -ne $CONFIG_RETEST_COUNT ]; then ++		echo "Failed to sign file, try again" ++	elif [ $i -eq $CONFIG_RETEST_COUNT ]; then ++		echo "Failed to sign file" ++		SIGN_RESULT=1 ++	fi ++done ++ ++sign_post ++exit $SIGN_RESULT +--  +2.33.0 + diff --git a/Fix-a-typo-in-brp-digest-list.patch b/Fix-a-typo-in-brp-digest-list.patch new file mode 100644 index 0000000..305237d --- /dev/null +++ b/Fix-a-typo-in-brp-digest-list.patch @@ -0,0 +1,26 @@ +From a82057c590f958d10898c2e5f7211241be3dfd7a Mon Sep 17 00:00:00 2001 +From: Roberto Sassu <roberto.sassu@huawei.com> +Date: Fri, 26 Feb 2021 09:00:06 +0100 +Subject: [PATCH] Fix a typo in brp-digest-list + +Rename RPM_PACKAGE_NAM to RPM_PACKAGE_NAME. +--- + brp-digest-list | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/brp-digest-list b/brp-digest-list +index 435b962..c3b2156 100644 +--- a/brp-digest-list ++++ b/brp-digest-list +@@ -86,7 +86,7 @@ if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \ +  + 	export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*" + 	export RPM_BUILD_ROOT +-	export RPM_PACKAGE_NAM="digest-list-tools" ++	export RPM_PACKAGE_NAME="digest-list-tools" + 	export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES" +  + 	if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then +--  +2.26.2 + diff --git a/Fix-python3_version-macros-for-Python-3.10.patch b/Fix-python3_version-macros-for-Python-3.10.patch new file mode 100644 index 0000000..fc76959 --- /dev/null +++ b/Fix-python3_version-macros-for-Python-3.10.patch @@ -0,0 +1,30 @@ +From 84ed1ab69d4b1e0aea452350d9f2865e8f7c28e7 Mon Sep 17 00:00:00 2001 +From: Miro Hrončok <miro@hroncok.cz> +Date: Aug 26 2019 13:24:23 +0000 +Subject: Fix %python3_version macros for Python 3.10 + + +No need to bump the release, 3.10 is far from now. + +Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1745601 + +--- + +diff --git a/macros.python b/macros.python +index 1952aed..a170c4b 100644 +--- a/macros.python ++++ b/macros.python +@@ -139,8 +139,8 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth + %__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_version %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") ++%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") + %python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())") + %py3dir %{_builddir}/python3-%{name}-%{version}-%{release} +  +--  +2.27.0 + diff --git a/Give-a-warning-when-using-kabi-outside-our-stablelis.patch b/Give-a-warning-when-using-kabi-outside-our-stablelis.patch new file mode 100644 index 0000000..d2cba8e --- /dev/null +++ b/Give-a-warning-when-using-kabi-outside-our-stablelis.patch @@ -0,0 +1,240 @@ +From 895c930b1418798509a1f19706b6a1be188ad303 Mon Sep 17 00:00:00 2001 +From: Liu Yuntao <liuyuntao10@huawei.com> +Date: Sat, 2 Jul 2022 13:59:25 +0800 +Subject: [PATCH] Give a warning when using kabi outside our stablelists. + +Add a script that will find requirements for your package. It can make an +additional kabi whitelist check for you, compared with rpmbuild's builtin +requirement scanner. You may add "%define _use_internal_dependency_generator 0" +in your .spec file to enable this feature. +synced from CentOS's implementation. +--- + find-requires       |  38 +++++++++++ + find-requires.ksyms | 155 ++++++++++++++++++++++++++++++++++++++++++++ + macros.kmp          |   3 +- + 3 files changed, 195 insertions(+), 1 deletion(-) + create mode 100644 find-requires + create mode 100644 find-requires.ksyms + +diff --git a/find-requires b/find-requires +new file mode 100644 +index 0000000..b7cd825 +--- /dev/null ++++ b/find-requires +@@ -0,0 +1,38 @@ ++#!/bin/bash ++ ++# ++# Auto-generate requirements for executables (both ELF and a.out) and library ++# sonames, script interpreters, and perl modules. ++# ++ ++ulimit -c 0 ++ ++filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` ++ ++[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && \ ++    echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --requires ++ ++# ++# --- Kernel module imported symbols ++# ++# Since we don't (yet) get passed the name of the package being built, we ++# cheat a little here by looking first for a kernel, then for a kmod. ++# ++ ++unset is_kmod ++ ++for f in $filelist; do ++    if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ] ++    then ++        is_kmod=1; ++    elif [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ] ++    then ++	unset is_kmod; ++	break; ++    fi ++done ++ ++[ -x /usr/lib/rpm/__vendor/find-requires.ksyms ] && [ "$is_kmod" ] && ++    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/__vendor/find-requires.ksyms ++ ++exit 0 +diff --git a/find-requires.ksyms b/find-requires.ksyms +new file mode 100644 +index 0000000..15cc729 +--- /dev/null ++++ b/find-requires.ksyms +@@ -0,0 +1,155 @@ ++#! /bin/bash ++# ++# This script is called during external module building to create dependencies ++# both upon the linux kernel, and on additional external modules. Symbols that ++# cannot be reconciled against those provided by the kernel are assumed to be ++# provided by an external module and "ksym" replaces th regular "kernel" dep. ++ ++IFS=$'\n' ++ ++# Extract all of the symbols provided by this module. ++all_provides() { ++    for module in "$@"; do ++        tmpfile="" ++        if [ "x${module%.ko}" = "x${module}" ]; then ++            tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) ++            proc_bin= ++            case "${module##*.}" in ++            xz) ++                    proc_bin=xz ++                    ;; ++            bz2) ++                    proc_bin=bzip2 ++                    ;; ++            gz) ++                    proc_bin=gzip ++                    ;; ++            esac ++ ++            [ -n "$proc_bin" ] || continue ++ ++            "$proc_bin" -d -c - < "$module" > "$tmpfile" || continue ++            module="$tmpfile" ++        fi ++ ++        if [[ -n $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then ++            nm "$module" \ ++            | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \ ++            | awk --non-decimal-data '{printf("%s:0x%08x\n", $2, $1)}' ++        else ++            ELFRODATA=$(readelf -R .rodata "$module" | awk '/0x/{printf $2$3$4$5}') ++            if [[ -n $(readelf -h "$module" | grep "little endian") ]]; then ++                RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g') ++            else ++                RODATA=$ELFRODATA ++            fi ++            for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do ++                echo $sym $RODATA ++            done \ ++            | awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}' ++        fi ++ ++        [ -z "$tmpfile" ] || rm -f -- "$tmpfile" ++    done \ ++    | LC_ALL=C sort -k1,1 -u ++} ++ ++# Extract all of the requirements of this module. ++all_requires() { ++    for module in "$@"; do ++        set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q) ++        /sbin/modprobe --dump-modversions "$module" \ ++        | awk --non-decimal-data ' ++            BEGIN { FS = "\t" ; OFS = "\t" } ++            {printf("%s:0x%08x\n", $2, $1)}' \ ++        | sed -r -e 's:$:\t'"$1"':' ++    done \ ++    | LC_ALL=C sort -k1,1 -u ++} ++ ++# Filter out requirements fulfilled by the module itself. ++mod_requires() { ++    LC_ALL=C join -t $'\t' -j 1 -v 1 \ ++        <(all_requires "$@") \ ++        <(all_provides "$@") \ ++    | LC_ALL=C sort -k1,1 -u ++} ++ ++if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then ++    cat > /dev/null ++    exit 0 ++fi ++ ++check_kabi() { ++    arch=$(uname -m) ++    kabi_file="/lib/modules/kabi-current/kabi_stablelist_$arch" ++ ++    # If not installed, output a warning and return (continue) ++    if [ ! -f "$kabi_file" ]; then ++        echo "" >&2 ++        echo "********************************************************************************" >&2 ++        echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2 ++        echo "********************************************************************************" >&2 ++        echo "The kernel ABI reference files (provided by "kernel-abi-stablelists") were not found." >&2 ++        echo "No compatibility check was performed. Please install the kABI reference files" >&2 ++        echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2 ++        echo "" >&2 ++        return ++    fi ++ ++    unset non_kabi ++    for symbol in "$@"; do ++        if ! egrep "^$symbol\$" $kabi_file >/dev/null; then ++            non_kabi=("${non_kabi[@]}" "$symbol") ++        fi ++    done ++ ++    if [ ${#non_kabi[@]} -gt 0 ]; then ++        echo "" >&2 ++        echo "********************************************************************************" >&2 ++        echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2 ++        echo "********************************************************************************" >&2 ++        echo "The following kernel symbols are not guaranteed to remain compatible with" >&2 ++        echo "future kernel updates to this RHEL release:" >&2 ++        echo "" >&2 ++        for symbol in "${non_kabi[@]}"; do ++            printf "\t$symbol\n" >&2 ++        done ++        echo "" >&2 ++        echo "__vendor recommends that you consider using only official kernel ABI symbols" >&2 ++        echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2 ++        echo "your partner or customer representative (component: driver-update-program)." >&2 ++        echo "" >&2 ++    fi ++} ++ ++modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$')) ++if [ ${#modules[@]} -gt 0 ]; then ++    kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q) ++ ++    # get all that kernel provides ++    symvers=$(mktemp -t ${0##*/}.XXXXX) ++ ++    cat /usr/src/kernels/$kernel/Module.symvers | awk ' ++        BEGIN { FS = "\t" ; OFS = "\t" } ++        { print $2 ":" $1 } ++    ' \ ++    | sed -r -e 's:$:\t'"$kernel"':' \ ++    | LC_ALL=C sort -k1,1 -u > $symvers ++ ++    # Symbols matching with the kernel get a "kernel" dependency ++    mod_req=$(mktemp -t mod_req.XXXXX) ++    mod_requires "${modules[@]}" > "$mod_req" ++    LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \ ++    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }' ++ ++    # Symbols from elsewhere get a "ksym" dependency ++    LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | LC_ALL=C sort -u \ ++    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }' ++ ++    # Check kABI if the kernel-abi-stablelists package is installed ++    # Do this last so we can try to output this error at the end ++    kabi_check_symbols=($(LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \ ++    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }')) ++    check_kabi "${kabi_check_symbols[@]}" ++fi +diff --git a/macros.kmp b/macros.kmp +index 5207045..df7e41e 100644 +--- a/macros.kmp ++++ b/macros.kmp +@@ -1,7 +1,8 @@ +-# Use these macros to differentiate between RH and other KMP implementation(s).
 ++# Use these macros to differentiate between __vendor and other KMP implementation(s).
 + 
 + kernel_module_package_release	1
 + 
 ++__find_requires        /usr/lib/rpm/__vendor/find-requires
 + 
 + 
 + #kernel_module_package [ -n name ] [ -v version ] [ -r release ] 
 +--  +2.27.0 + diff --git a/add-brp-scripts-to-delete-rpath.patch b/add-brp-scripts-to-delete-rpath.patch new file mode 100644 index 0000000..8677bd5 --- /dev/null +++ b/add-brp-scripts-to-delete-rpath.patch @@ -0,0 +1,145 @@ +From 9648228a3f64de46dd7fbb26e2df429352de17e1 Mon Sep 17 00:00:00 2001 +From: yangmingtaip <yangmingtai@huawei.com> +Date: Sat, 4 Sep 2021 14:14:54 +0800 +Subject: [PATCH] add brp scripts to delete rpath + +Signed-off-by: xujing <xujing125@huawei.com> +--- + brp-chrpath | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + macros      |   2 + + 2 files changed, 106 insertions(+) + create mode 100755 brp-chrpath + +diff --git a/brp-chrpath b/brp-chrpath +new file mode 100755 +index 0000000..dc48351 +--- /dev/null ++++ b/brp-chrpath +@@ -0,0 +1,104 @@ ++#!/usr/bin/sh ++# remove rpath specified ++ ++rpathSuffix=( ++	"/home/abuild/rpmbuild/BUILD", ++	"/home/lkp/rpmbuild/BUILD" ++) ++ ++rpath=( ++	"/usr/lib64", ++	"/lib64", ++	"/usr/lib", ++	"/lib", ++	"/usr/lib/../lib64" ++) ++ ++buildroot=$1 ++ ++function rpathChange() ++{ ++	localSrcPath=$1 ++	localDstPath="" ++ ++	rpathArr=(`echo $localSrcPath | tr ':' ' '`) ++ ++	for path in ${rpathArr[*]} ++	do ++		localflag=0 ++		for suffix in ${rpathSuffix[*]} ++		do ++			if echo "$path" | grep $suffix &> /dev/null; then ++				localflag=1 ++				break ++			fi ++		done ++ ++		# Is the suffix path, delete ++		if [ $localflag -eq 1 ]; then ++			continue; ++		fi ++ ++		#Is the standard path, delete ++		if echo "${rpath[@]}" | grep -w $path &> /dev/null; then ++			continue ++		fi ++ ++		if [ x"$localDstPath" == x"" ]; then ++			localDstPath=$path ++		else ++			localDstPath=$localDstPath:$path ++		fi ++	done ++ ++	echo $localDstPath ++} ++ ++function removeRpathOrRunpath() ++{ ++	localfile=$1 ++ ++	rpathInfo=$(chrpath -l $localfile | grep "RPATH=") ++	runpathInfo=$(chrpath -l $localfile | grep "RUNPATH=") ++ ++	currPath="" ++	realPath="" ++	needCh=0 ++	if [ x"$rpathInfo" != x"" ]; then ++		needCh=1 ++		currPath=$(echo $rpathInfo | awk -F "RPATH=" '{print $2}') ++		realPath=$(rpathChange $currPath) ++	fi ++ ++	if [ x"$runpathInfo" != x"" ]; then ++		needCh=1 ++                currPath=$(echo $runpathInfo | awk -F "RUNPATH=" '{print $2}') ++                realPath=$(rpathChange $currPath) ++	fi ++ ++	if [ $needCh -eq 0 ]; then ++		return 0 ++	fi ++ ++	if [ x"$realPath" == x"" ]; then ++		chrpath -d $localfile ++	else ++		chrpath -r $realPath $localfile ++	fi ++ ++	return 0 ++} ++ ++for file in $(find $buildroot/ -executable -type f -exec file {} ';' | grep "\<ELF\>" | awk -F ':' '{print $1}') ++do ++	test -u $file ++	if [ $? -eq 0 ]; then ++		continue ++	fi ++ ++	if [ -w "$file" ]; then ++		removeRpathOrRunpath $file ++	fi ++done ++ ++exit 0 +diff --git a/macros b/macros +index 36621df..a316be9 100644 +--- a/macros ++++ b/macros +@@ -89,6 +89,7 @@ +  + # Build root policy macros. Standard naming: + # convert all '-' in basename to '_', add two leading underscores. ++%__brp_chrpath /usr/lib/rpm/brp-chrpath %{buildroot} + %__brp_ldconfig /usr/lib/rpm/brp-ldconfig + %__brp_compress /usr/lib/rpm/brp-compress + %__brp_strip /usr/lib/rpm/brp-strip %{__strip} +@@ -111,6 +112,7 @@ +  + %__spec_install_post\ +     %{?__debug_package:%{__debug_install_post}}\ ++    %{?__vendor_delete_rpath:%{?__brp_chrpath}} \ +     %{__arch_install_post}\ +     %{__os_install_post}\ + %{nil} +--  +2.33.0 + diff --git a/add-common-script.patch b/add-common-script.patch new file mode 100644 index 0000000..bb7892e --- /dev/null +++ b/add-common-script.patch @@ -0,0 +1,313 @@ +From 4db504b19f6dd04a44e46b43b3aff4e6cab9214d Mon Sep 17 00:00:00 2001 +From: wangkerong <wangkerong@huawei.com> +Date: Wed, 13 Oct 2021 10:04:33 +0800 +Subject: [PATCH] add_commom_script + +--- + common.lua | 294 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 294 insertions(+) + create mode 100644 common.lua + +diff --git a/common.lua b/common.lua +new file mode 100644 +index 0000000..884ee4d +--- /dev/null ++++ b/common.lua +@@ -0,0 +1,294 @@ ++-- Convenience Lua functions that can be used within rpm macros ++  ++-- Reads an rpm variable. Unlike a basic rpm.expand("{?foo}"), returns nil if ++-- the variable is unset, which is convenient in lua tests and enables ++-- differentiating unset variables from variables set to "" ++local function read(rpmvar) ++  if not rpmvar or ++    (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then ++    return nil ++  else ++    return rpm.expand("%{?" .. rpmvar .. "}") ++  end ++end ++  ++-- Returns true if the macro that called this function had flag set ++--   – for example, hasflag("z") would give the following results: ++--     %foo -z bar → true ++--     %foo -z     → true ++--     %foo        → false ++local function hasflag(flag) ++  return (rpm.expand("%{-" .. flag .. "}") ~= "") ++end ++  ++-- Returns the argument passed to flag in the macro that called this function ++--  – for example, readflag("z") would give the following results: ++--      %foo -z bar → bar ++--      %foo        → nil ++--      %foo -z ""  → empty string ++--      %foo -z ''  → empty string ++local function readflag(flag) ++  if not hasflag(flag) then ++    return nil ++  else ++    local a = rpm.expand("%{-" .. flag .. "*}") ++    -- Handle "" and '' as empty strings ++    if (a == '""') or (a == "''") then ++      a = '' ++    end ++    return a ++  end ++end ++  ++-- Sets a spec variable; echoes the result if verbose ++local function explicitset(rpmvar, value, verbose) ++  local value = value ++  if (value == nil) or (value == "") then ++    value = "%{nil}" ++  end ++  rpm.define(rpmvar .. " " .. value) ++  if verbose then ++    rpm.expand("%{warn:Setting %%{" .. rpmvar .. "} = " .. value .. "}") ++  end ++end ++  ++-- Unsets a spec variable if it is defined; echoes the result if verbose ++local function explicitunset(rpmvar, verbose) ++  if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then ++    rpm.define(rpmvar .. " %{nil}") ++    if verbose then ++      rpm.expand("%{warn:Unsetting %%{" .. rpmvar .. "}}") ++    end ++  end ++end ++  ++-- Sets a spec variable, if not already set; echoes the result if verbose ++local function safeset(rpmvar, value, verbose) ++  if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then ++    explicitset(rpmvar,value,verbose) ++  end ++end ++  ++-- Aliases a list of rpm variables to the same variables suffixed with 0 (and ++-- vice versa); echoes the result if verbose ++local function zalias(rpmvars, verbose) ++  for _, sfx in ipairs({{"","0"},{"0",""}}) do ++    for _, rpmvar in ipairs(rpmvars) do ++      local toalias = "%{?" .. rpmvar .. sfx[1] .. "}" ++      if (rpm.expand(toalias) ~= "") then ++        safeset(rpmvar .. sfx[2], toalias, verbose) ++      end ++    end ++  end ++end ++  ++-- Takes a list of rpm variable roots and a suffix and alias current<root> to ++-- <root><suffix> if it resolves to something not empty ++local function setcurrent(rpmvars, suffix, verbose) ++  for _, rpmvar in ipairs(rpmvars) do ++    if (rpm.expand("%{?" .. rpmvar .. suffix .. "}") ~= "") then ++      explicitset(  "current" .. rpmvar, "%{" .. rpmvar .. suffix .. "}", verbose) ++    else ++      explicitunset("current" .. rpmvar,                                  verbose) ++    end ++  end ++end ++  ++-- Echo the list of rpm variables, with suffix, if set ++local function echovars(rpmvars, suffix) ++  for _, rpmvar in ipairs(rpmvars) do ++    rpmvar = rpmvar .. suffix ++    local header = string.sub("  " .. rpmvar .. ":                                               ",1,21) ++    rpm.expand("%{?" .. rpmvar .. ":%{echo:" .. header .. "%{?" .. rpmvar .. "}}}") ++  end ++end ++  ++-- Returns an array, indexed by suffix, containing the non-empy values of ++-- <rpmvar><suffix>, with suffix an integer string or the empty string ++local function getsuffixed(rpmvar) ++  local suffixes = {} ++  zalias({rpmvar}) ++  for suffix=0,9999 do ++    local value = rpm.expand("%{?" .. rpmvar .. suffix .. "}") ++    if (value ~= "") then ++      suffixes[tostring(suffix)] = value ++    end ++  end ++  -- rpm convention is to alias no suffix to zero suffix ++  -- only add no suffix if zero suffix is different ++  local value = rpm.expand("%{?" .. rpmvar .. "}") ++  if (value ~= "") and (value ~= suffixes["0"]) then ++     suffixes[""] = value ++  end ++  return suffixes ++end ++  ++-- Returns the list of suffixes, including the empty string, for which ++-- <rpmvar><suffix> is set to a non empty value ++local function getsuffixes(rpmvar) ++  suffixes = {} ++  for suffix in pairs(getsuffixed(rpmvar)) do ++    table.insert(suffixes,suffix) ++  end ++  table.sort(suffixes, ++             function(a,b) return (tonumber(a) or 0) < (tonumber(b) or 0) end) ++  return suffixes ++end ++  ++-- Returns the suffix for which <rpmvar><suffix> has a non-empty value that ++-- matches best the beginning of the value string ++local function getbestsuffix(rpmvar, value) ++  local best         = nil ++  local currentmatch = "" ++  for suffix, setvalue in pairs(getsuffixed(rpmvar)) do ++  if (string.len(setvalue) > string.len(currentmatch)) and ++     (string.find(value, "^" .. setvalue)) then ++      currentmatch = setvalue ++      best         = suffix ++    end ++  end ++  return best ++end ++  ++-- %writevars core ++local function writevars(macrofile, rpmvars) ++  for _, rpmvar in ipairs(rpmvars) do ++    print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") .. ++                   "\029" .. rpm.expand(  "%{" .. rpmvar .. "}" ) .. ++                   "\029g' " .. macrofile .. "\n") ++  end ++end ++  ++-- https://github.com/rpm-software-management/rpm/issues/566 ++-- Reformat a text intended to be used used in a package description, removing ++-- rpm macro generation artefacts. ++-- – remove leading and ending empty lines ++-- – trim intermediary empty lines to a single line ++-- – fold on spaces ++-- Should really be a %%{wordwrap:…} verb ++local function wordwrap(text) ++  text = rpm.expand(text .. "\n") ++  text = string.gsub(text, "\t",              "  ") ++  text = string.gsub(text, "\r",              "\n") ++  text = string.gsub(text, " +\n",            "\n") ++  text = string.gsub(text, "\n+\n",           "\n\n") ++  text = string.gsub(text, "^\n",             "") ++  text = string.gsub(text, "\n( *)[-*—][  ]+", "\n%1– ") ++  output = "" ++  for line in string.gmatch(text, "[^\n]*\n") do ++    local pos = 0 ++    local advance = "" ++    for word in string.gmatch(line, "%s*[^%s]*\n?") do ++      local wl, bad = utf8.len(word) ++      if not wl then ++        print("%{warn:Invalid UTF-8 sequence detected in:}" .. ++              "%{warn:" .. word .. "}" .. ++              "%{warn:It may produce unexpected results.}") ++        wl = bad ++      end ++      if (pos == 0) then ++        advance, n = string.gsub(word, "^(%s*– ).*", "%1") ++        if (n == 0) then ++          advance = string.gsub(word, "^(%s*).*", "%1") ++        end ++        advance = string.gsub(advance, "– ", "  ") ++        pos = pos + wl ++      elseif  (pos + wl  < 81) or ++             ((pos + wl == 81) and string.match(word, "\n$")) then ++        pos = pos + wl ++      else ++        word = advance .. string.gsub(word, "^%s*", "") ++        output = output .. "\n" ++        pos = utf8.len(word) ++      end ++      output = output .. word ++      if pos > 80 then ++        pos = 0 ++        if not string.match(word, "\n$") then ++          output = output .. "\n" ++        end ++      end ++    end ++  end ++  output = string.gsub(output, "\n*$", "\n") ++  return output ++end ++  ++-- Because rpmbuild will fail if a subpackage is declared before the source ++-- package itself, provide a source package declaration shell as fallback. ++local function srcpkg(verbose) ++  if verbose then ++    rpm.expand([[ ++%{echo:Creating a header for the SRPM from %%{source_name}, %%{source_summary} and} ++%{echo:%%{source_description}. If that is not the intended result, please declare the} ++%{echo:SRPM header and set %%{source_name} in your spec file before calling a macro} ++%{echo:that creates other package headers.} ++]]) ++  end ++  print(rpm.expand([[ ++Name:           %{source_name} ++Summary:        %{source_summary} ++%description ++%wordwrap -v source_description ++]])) ++  explicitset("currentname", "%{source_name}", verbose) ++end ++  ++-- %new_package core ++local function new_package(source_name, pkg_name, name_suffix, first, verbose) ++  -- Safety net when the wrapper is used in conjunction with traditional syntax ++  if (not first) and (not source_name) then ++    rpm.expand([[ ++%{warn:Something already set a package name. However, %%{source_name} is not set.} ++%{warn:Please set %%{source_name} to the SRPM name to ensure reliable processing.} ++]]) ++    if name_suffix then ++      print(rpm.expand("%package        " .. name_suffix)) ++    else ++      print(rpm.expand("%package     -n " .. pkg_name)) ++    end ++    return ++  end ++  -- New processing ++  if not (pkg_name or name_suffix or source_name) then ++    rpm.expand([[ ++%{error:You need to set %%{source_name} or provide explicit package naming!} ++]]) ++  end ++  if name_suffix then ++    print(rpm.expand("%package        "  .. name_suffix)) ++    explicitset("currentname", "%{source_name}-" .. name_suffix, verbose) ++  else ++    if not source_name then ++      source_name = pkg_name ++    end ++    if (pkg_name == source_name) then ++      safeset("source_name", source_name, verbose) ++      print(rpm.expand("Name:           %{source_name}")) ++    else ++      if source_name and first then ++        srcpkg(verbose) ++      end ++      print(rpm.expand("%package     -n " .. pkg_name)) ++    end ++    explicitset("currentname", pkg_name, verbose) ++  end ++end ++  ++return { ++  read          = read, ++  hasflag       = hasflag, ++  readflag      = readflag, ++  explicitset   = explicitset, ++  explicitunset = explicitunset, ++  safeset       = safeset, ++  zalias        = zalias, ++  setcurrent    = setcurrent, ++  echovars      = echovars, ++  getsuffixed   = getsuffixed, ++  getsuffixes   = getsuffixes, ++  getbestsuffix = getbestsuffix, ++  writevars     = writevars, ++  wordwrap      = wordwrap, ++  new_package   = new_package, ++} +--  +2.27.0 + diff --git a/add-loongarch64-support-for-config.guess-and-config.sub.patch b/add-loongarch64-support-for-config.guess-and-config.sub.patch new file mode 100644 index 0000000..acc2f83 --- /dev/null +++ b/add-loongarch64-support-for-config.guess-and-config.sub.patch @@ -0,0 +1,26 @@ +diff --git a/config.guess b/config.guess +index 463631a..2985f85 100644 +--- a/config.guess ++++ b/config.guess +@@ -975,6 +975,9 @@ EOF +     k1om:Linux:*:*) + 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 	exit ;; ++    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) ++	echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++	exit ;; +     m32r*:Linux:*:*) + 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 	exit ;; +diff --git a/config.sub b/config.sub +index 39dbf60..39870d3 100644 +--- a/config.sub ++++ b/config.sub +@@ -268,6 +268,7 @@ case $basic_machine in + 	| k1om \ + 	| le32 | le64 \ + 	| lm32 \ ++	| loongarch32 | loongarch64 | loongarchx32 \ + 	| m32c | m32r | m32rle | m68000 | m68k | m88k \ + 	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + 	| mips | mipsbe | mipseb | mipsel | mipsle \ diff --git a/add-loongarch64-to-generic_arches.patch b/add-loongarch64-to-generic_arches.patch new file mode 100644 index 0000000..cf3dc63 --- /dev/null +++ b/add-loongarch64-to-generic_arches.patch @@ -0,0 +1,13 @@ +diff --git a/macros b/macros +index d6b2c80..a66eb2e 100644 +--- a/macros ++++ b/macros +@@ -241,7 +241,7 @@ + %pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0) +  + #arches macros +-%generic_arches %{ix86} x86_64 %{arm} aarch64 ++%generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 + %ldc_arches %{generic_arches} + %valgrind_arches %{generic_arches} + %nodejs_arches %{generic_arches} diff --git a/add-powerpc64le-and-ppc64le-support.patch b/add-powerpc64le-and-ppc64le-support.patch new file mode 100644 index 0000000..8840182 --- /dev/null +++ b/add-powerpc64le-and-ppc64le-support.patch @@ -0,0 +1,39 @@ +From c6d355a6997ac10403181015b5ca9d17dcf8d1a7 Mon Sep 17 00:00:00 2001 +From: JianChunfu <chunfu.jian@shingroup.cn> +Date: Tue, 24 Oct 2023 18:38:38 +0800 +Subject: [PATCH] add powerpc64le and ppc64le support + +--- + macros | 2 +- + rpmrc  | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/macros b/macros +index 5c7447b..38dc694 100644 +--- a/macros ++++ b/macros +@@ -225,7 +225,7 @@ + %pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0) +  + #arches macros +-%generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 ++%generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 powerpc64le ppc64le + %ldc_arches %{generic_arches} + %valgrind_arches %{generic_arches} + %nodejs_arches %{generic_arches} +diff --git a/rpmrc b/rpmrc +in +dex 8ba756d..10d7c86 100644 +--- a/rpmrc ++++ b/rpmrc +@@ -8,6 +8,8 @@ optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-u + optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection + optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection +  ++optflags: ppc64le %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection ++ + buildarchtranslate: athlon: i686 + buildarchtranslate: geode: i686 + buildarchtranslate: pentium4: i686 +--  +2.33.0 diff --git a/add-pyproject-macros.patch b/add-pyproject-macros.patch new file mode 100644 index 0000000..c6664c9 --- /dev/null +++ b/add-pyproject-macros.patch @@ -0,0 +1,42 @@ +From b16ce81ae43c1e702beb1351ee9891e3e3f697e6 Mon Sep 17 00:00:00 2001 +From: caodongxia <315816521@qq.com> +Date: Thu, 13 Apr 2023 17:11:53 +0800 +Subject: [PATCH] add pyproject macros + +--- + macros.python | 12 +++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/macros.python b/macros.python +index d504d3f..d5a7a86 100644 +--- a/macros.python ++++ b/macros.python +@@ -28,6 +28,12 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth +   sleep 1 + } +  ++%pyproject_build() %{expand:\\\ ++  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ ++  %{__python3} -mpip wheel --verbose --progress-bar off --disable-pip-version-check --use-pep517 --no-build-isolation --no-deps --wheel-dir ./build .  %{?*} ++  sleep 1 ++} ++ + %py_build_egg() %{expand:\\\ +   CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ +   %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*} +@@ -45,6 +51,12 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth +   %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} + } +  ++%pyproject_install() %{expand:\\\ ++  specifier=$(ls ./build/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/') ++  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ ++  %{__python3} -mpip install --verbose --progress-bar off --disable-pip-version-check   --root %{buildroot} --no-compile --ignore-installed --no-deps --no-index --find-links ./build $specifier %{?*} ++} ++ + %py_install_egg() %{expand:\\\ +   mkdir -p %{buildroot}%{python_sitelib} +   easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*} +--  +2.23.0 + diff --git a/add-pytest-and-tox-macros.patch b/add-pytest-and-tox-macros.patch new file mode 100644 index 0000000..b76444e --- /dev/null +++ b/add-pytest-and-tox-macros.patch @@ -0,0 +1,42 @@ +From 2f7b74e83fc52d326d5db7de2bcfab2c8d921f29 Mon Sep 17 00:00:00 2001 +From: desert-sailor <dxwangk@isoftstone.com> +Date: Mon, 24 Jul 2023 11:36:52 +0800 +Subject: [PATCH] add pytest and tox macros + +--- + macros.python | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/macros.python b/macros.python +index 1cc6e70..334c0ab 100644 +--- a/macros.python ++++ b/macros.python +@@ -304,3 +304,25 @@ find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $pyth + %python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())") + %python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))") + %python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])") ++ ++# New python test macros ++%pytest() %{expand:\\\ ++CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\ ++PATH="%{buildroot}%{_bindir}:$PATH" \\ ++PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\ ++PYTHONDONTWRITEBYTECODE=1 \\ ++%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \\ ++PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ ++%{_bindir}/pytest %{?*} ++} ++ ++%tox() %{expand:\\\ ++TOX_TESTENV_PASSENV="${TOX_TESTENV_PASSENV:-*}" \\ ++CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\ ++PATH="%{buildroot}%{_bindir}:$PATH" \\ ++PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\ ++PYTHONDONTWRITEBYTECODE=1 \\ ++%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \\ ++PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ ++%{__python3} -m tox -e py%{python3_version_nodots} --current-env %{?*} ++} +--  +2.33.0 + diff --git a/add-riscv64-to-some-arches-macro.patch b/add-riscv64-to-some-arches-macro.patch new file mode 100644 index 0000000..987acea --- /dev/null +++ b/add-riscv64-to-some-arches-macro.patch @@ -0,0 +1,41 @@ +From 09e746df9d0c333fef9aabcec3047f68c9d1fc60 Mon Sep 17 00:00:00 2001 +From: laokz <zhangkai@iscas.ac.cn> +Date: Sat, 27 Apr 2024 15:09:30 +0800 +Subject: [PATCH] add riscv64 to some arches macro + +--- + macros | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/macros b/macros +index 218cd23..c609e85 100644 +--- a/macros ++++ b/macros +@@ -310,7 +310,7 @@ + %generic_arches %{ix86} x86_64 %{arm} aarch64 loongarch64 powerpc64le ppc64le + %ldc_arches %{generic_arches} + %valgrind_arches %{generic_arches} +-%nodejs_arches %{generic_arches} ++%nodejs_arches %{generic_arches} riscv64 + %ldc_arches %{generic_arches} + %mono_arches %{generic_arches} + %fpc_arches %{generic_arches} +@@ -319,11 +319,10 @@ + %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} ++%ocaml_native_compiler   %{generic_arches} riscv64 ++%ocaml_natdynlink        %{generic_arches} riscv64 ++%ocaml_native_profiling  %{generic_arches} riscv64 ++%openblas_arches 	 %{generic_arches} riscv64 +  + #%ldconfig /sbin/ldconfig + %ldconfig_post(n:) %{?ldconfig:%post -p %ldconfig %{?*} %{-n:-n %{-n*}}\ +--  +2.39.2 + diff --git a/backport-Enable-as-needed-by-default.patch b/backport-Enable-as-needed-by-default.patch new file mode 100644 index 0000000..182e388 --- /dev/null +++ b/backport-Enable-as-needed-by-default.patch @@ -0,0 +1,31 @@ +From 210649d3a50eb862eb95caec54c52cd1513a1dda Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko <ignatenkobrain@fedoraproject.org> +Date: Wed, 15 Aug 2018 07:00:14 +0200 +Subject: [PATCH] Enable --as-needed by default + +Conflict:adapt context +Reference:https://src.fedoraproject.org/rpms/redhat-rpm-config/c/357550f7ba4495b01399c904d389369eb0666837 + +Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org> +--- + macros | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/macros b/macros +index cb96614..0d54994 100644 +--- a/macros ++++ b/macros +@@ -257,8 +257,8 @@ + #%_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 ++# use "%undefine _ld_as_needed" to disable. ++%_ld_as_needed		1 + %_ld_as_needed_flags	%{?_ld_as_needed:-Wl,--as-needed} +  + %_general_options         -O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ] +--  +2.33.0 + diff --git a/backport-kmp-feature.patch b/backport-kmp-feature.patch new file mode 100644 index 0000000..6525efb --- /dev/null +++ b/backport-kmp-feature.patch @@ -0,0 +1,485 @@ +From 3e65c85831be0b8f8e1cd43869b4991a76e14d9b Mon Sep 17 00:00:00 2001 +From: Yang Yanchao <yangyanchao6@huawei.com> +Date: Fri, 17 Mar 2023 01:09:09 +0000 +Subject: [PATCH] backport kmp feature + +Signed-off-by: Yang Yanchao <yangyanchao6@huawei.com> +Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org> +--- + kmodtool    | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + kmodtool.py |  83 --------------- + macros.kmp  |  85 ++++++++++++---- + 3 files changed, 350 insertions(+), 105 deletions(-) + create mode 100644 kmodtool + delete mode 100644 kmodtool.py + +diff --git a/kmodtool b/kmodtool +new file mode 100644 +index 0000000..427d1df +--- /dev/null ++++ b/kmodtool +@@ -0,0 +1,281 @@ ++#!/usr/bin/bash ++ ++# kmodtool - Helper script for building kernel module RPMs ++# Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>, ++#                         Thorsten Leemhuis <fedora@leemhuis.info> ++#                         Jon Masters <jcm@redhat.com> ++# ++# Permission is hereby granted, free of charge, to any person obtaining ++# a copy of this software and associated documentation files (the ++# "Software"), to deal in the Software without restriction, including ++# without limitation the rights to use, copy, modify, merge, publish, ++# distribute, sublicense, and/or sell copies of the Software, and to ++# permit persons to whom the Software is furnished to do so, subject to ++# the following conditions: ++# ++# The above copyright notice and this permission notice shall be ++# included in all copies or substantial portions of the Software. ++# ++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ++# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE ++# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION ++# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION ++# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ ++shopt -s extglob ++ ++myprog="kmodtool" ++myver="0.10.10_kmp2" ++knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen) ++kmod_name= ++kver= ++verrel= ++variant= ++kmp= ++ ++get_verrel () ++{ ++  verrel=${1:-$(uname -r)} ++  verrel=${verrel%%$knownvariants} ++} ++ ++print_verrel () ++{ ++  get_verrel $@ ++  echo "${verrel}" ++} ++ ++get_variant () ++{ ++  get_verrel $@ ++  variant=${1:-$(uname -r)} ++  variant=${variant##$verrel} ++  variant=${variant:-'""'} ++} ++ ++print_variant () ++{ ++  get_variant $@ ++  echo "${variant}" ++} ++ ++get_filelist() { ++    local IFS=$'\n' ++    filelist=($(cat)) ++ ++    if [ ${#filelist[@]} -gt 0 ]; ++    then ++        for ((n = 0; n < ${#filelist[@]}; n++)); ++        do ++            line="${filelist[n]}" ++            line=$(echo "$line" \ ++                | sed -e "s/%verrel/$verrel/g" \ ++                | sed -e "s/%variant/$variant/g" \ ++                | sed -e "s/%dashvariant/$dashvariant/g" \ ++                | sed -e "s/%dotvariant/$dotvariant/g" \ ++                | sed -e "s/\.%1/$dotvariant/g" \ ++                | sed -e "s/\-%1/$dotvariant/g" \ ++                | sed -e "s/%2/$verrel/g") ++            echo "$line" ++        done ++    else ++        echo "%defattr(644,root,root,755)" ++        echo "/lib/modules/${verrel}${dotvariant}" ++    fi ++} ++ ++get_rpmtemplate () ++{ ++    local variant="${1}" ++    local dashvariant="${variant:+-${variant}}" ++    case "$verrel" in ++        *.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; ++        *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; ++        *)     kdep="kernel-%{_target_cpu} = ${verrel}${variant}"     ;; ++    esac ++ ++    echo "%package       -n kmod-${kmod_name}${dashvariant}" ++ ++    if [ -z "$kmp_provides_summary" ]; then ++        echo "Summary:          ${kmod_name} kernel module(s)" ++    fi ++ ++    if [ -z "$kmp_provides_group" ]; then ++        echo "Group:            System Environment/Kernel" ++    fi ++ ++    if [ ! -z "$kmp_version" ]; then ++        echo "Version: %{kmp_version}" ++    fi ++ ++    if [ ! -z "$kmp_release" ]; then ++        echo "Release: %{kmp_release}" ++    fi ++ ++    cat <<EOF ++Provides:         kernel-modules = ${verrel}${variant} ++Provides:         ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} ++EOF ++ ++    if [ -z "$kmp" ]; then ++        echo "Requires:         ${kdep}" ++    fi ++ ++# ++# RHEL5 - Remove common package requirement on general kmod packages. ++# Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version} ++# ++ ++    cat <<EOF ++Requires(post):   /usr/sbin/depmod ++Requires(postun): /usr/sbin/depmod ++EOF ++ ++if [ "" != "$kmp_override_preamble" ] ++then ++    cat "$kmp_override_preamble" ++fi ++ ++cat <<EOF ++%description   -n kmod-${kmod_name}${dashvariant} ++This package provides the ${kmod_name} kernel modules built for the Linux ++kernel ${verrel}${variant} for the %{_target_cpu} family of processors. ++%post          -n kmod-${kmod_name}${dashvariant} ++if [ -e "/boot/System.map-${verrel}${variant}" ]; then ++    /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || : ++fi ++EOF ++ ++    if [ ! -z "$kmp" ]; then ++        cat <<EOF ++ ++modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name} | grep '\.ko$') ) ++if [ -x "/sbin/weak-modules" ]; then ++    printf '%s\n' "\${modules[@]}" \ ++    | /sbin/weak-modules --add-modules ++fi ++%preun         -n kmod-${kmod_name}${dashvariant} ++rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$' \ ++    > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules ++EOF ++ ++    fi ++ ++    cat <<EOF ++%postun        -n kmod-${kmod_name}${dashvariant} ++/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || : ++EOF ++ ++    if [ ! -z "$kmp" ]; then ++        cat <<EOF ++modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) ) ++if [ -x "/sbin/weak-modules" ]; then ++    printf '%s\n' "\${modules[@]}" \ ++    | /sbin/weak-modules --remove-modules ++fi ++EOF ++    fi ++ ++echo "%files         -n kmod-${kmod_name}${dashvariant}" ++if [ "" == "$kmp_override_filelist" ]; ++then ++    echo "%defattr(644,root,root,755)" ++    echo "/lib/modules/${verrel}${variant}/" ++else ++    cat "$kmp_override_filelist" | get_filelist ++fi ++} ++ ++print_rpmtemplate () ++{ ++  kmod_name="${1}" ++  shift ++  kver="${1}" ++  get_verrel "${1}" ++  shift ++  if [ -z "${kmod_name}" ] ; then ++    echo "Please provide the kmodule-name as first parameter." >&2 ++    exit 2 ++  elif [ -z "${kver}" ] ; then ++    echo "Please provide the kver as second parameter." >&2 ++    exit 2 ++  elif [ -z "${verrel}" ] ; then ++    echo "Couldn't find out the verrel." >&2 ++    exit 2 ++  fi ++ ++  for variant in "$@" ; do ++      if [ "default" == "$variant" ]; ++      then ++            get_rpmtemplate "" ++      else ++            get_rpmtemplate "${variant}" ++      fi ++  done ++} ++ ++usage () ++{ ++  cat <<EOF ++You called: ${invocation} ++ ++Usage: ${myprog} <command> <option>+ ++ Commands: ++  verrel <uname> ++    - Get "base" version-release. ++  variant <uname> ++    - Get variant from uname. ++  rpmtemplate <mainpgkname> <uname> <variants> ++    - Return a template for use in a source RPM ++  rpmtemplate_kmp <mainpgkname> <uname> <variants> ++    - Return a template for use in a source RPM with KMP dependencies ++  version ++    - Output version number and exit. ++EOF ++} ++ ++invocation="$(basename ${0}) $@" ++while [ "${1}" ] ; do ++  case "${1}" in ++    verrel) ++      shift ++      print_verrel $@ ++      exit $? ++      ;; ++    variant) ++      shift ++      print_variant $@ ++      exit $? ++      ;; ++    rpmtemplate) ++      shift ++      print_rpmtemplate "$@" ++      exit $? ++      ;; ++    rpmtemplate_kmp) ++      shift ++      kmp=1 ++      print_rpmtemplate "$@" ++      exit $? ++      ;; ++    version) ++      echo "${myprog} ${myver}" ++      exit 0 ++      ;; ++    *) ++      echo "Error: Unknown option '${1}'." >&2 ++      usage >&2 ++      exit 2 ++      ;; ++  esac ++done ++ ++# Local variables: ++# mode: sh ++# sh-indentation: 2 ++# indent-tabs-mode: nil ++# End: ++# ex: ts=2 sw=2 et ++ +diff --git a/kmodtool.py b/kmodtool.py +deleted file mode 100644 +index 75492b9..0000000 +--- a/kmodtool.py ++++ /dev/null +@@ -1,83 +0,0 @@ +-# -*- coding: UTF-8 -*- 
 +-#!/usr/bin/python3
 +-
 +-# kmodtool - Helper script for building kernel module RPMs
 +-
 +-import os,subprocess,sys
 +-
 +-def print_verrel ():
 +-    #verrel=subprocess.getoutput("(rpm -q --qf '%{VERSION}-%{RELEASE}' `rpm -q kernel-devel` | head -n 1)")
 +-   # if (len(verrel)== 0):
 +-    verrel=subprocess.getoutput("uname -r")
 +-    return verrel
 +-  
 +-def print_rpmtemplate():
 +-    kmod_name = sys.argv[2]
 +- #   verrel=subprocess.getoutput("(rpm -q --qf '%{VERSION}-%{RELEASE}' `rpm -q kernel-devel` | head -n 1)")
 +-  #  if (len(verrel)== 0):
 +-    verrel=subprocess.getoutput("uname -r")
 +-
 +-    if not kmod_name:
 +-        print("Please provide the kmodule-name as first parameter.") 
 +-        exit()
 +-    get_rpmtemplate(kmod_name,verrel)
 +-
 +-
 +-def get_rpmtemplate(kmod_name,verrel):
 +-    print("%package       -n kmod-" + kmod_name)
 +-    print("Summary:        " + kmod_name + " " + "kernel module(s)")
 +-    print("Group:           System Environment/Kernel")
 +-    if  "%{version}":
 +-        print("Version: %{version}")
 +-    if  "%{release}":
 +-        print("Release: %{release}")
 +-    print("Provides:         kernel-modules =" + " " + verrel)
 +-    print("Provides:         "+ kmod_name + "-kmod = %{?epoch:%{epoch}:}%{version}-%{release}")
 +-    print("Requires(post):   /usr/sbin/depmod") 
 +-    print("Requires(postun): /usr/sbin/depmod")
 +-    print("%description   -n kmod-" + kmod_name)
 +-    print("This package provides the " + kmod_name + " kernel modules built for the Linux")
 +-    print("kernel "+ verrel + " for the %{_target_cpu} family of processors.")
 +-    print("%post          -n kmod-" + kmod_name)
 +-    print("if [ -e /boot/System.map-" + verrel + " ]; then")
 +-    print("   /sbin/depmod -aeF /boot/System.map-" + verrel +" " + verrel +"> /dev/null || :")
 +-    print("fi")
 +-    if (kmp !=""):
 +-        print("modules=( $(find /lib/modules/" + verrel + "/extra/" + kmod_name + ") )")
 +-        print("""if [ -x "/sbin/weak-modules" ]; then
 +-    printf '%s\\n' "${modules[@]}" | /sbin/weak-modules --add-modules
 +-fi""") 
 +-        print("%preun         -n kmod-" + kmod_name)
 +-        print("rpm -ql kmod-" + kmod_name + "| grep '\.ko$'   > /var/run/rpm-kmod-" + kmod_name +"-modules")
 +-
 +-    print("%postun        -n kmod-" + kmod_name)
 +-    print("/sbin/depmod -aF /boot/System.map-" + verrel+" " + verrel + " &> /dev/null || :")
 +-
 +-    if (kmp !=""):
 +-        print("modules=( $(cat /var/run/rpm-kmod-" + kmod_name + "-modules) )")
 +-        print("#rm /var/run/rpm-kmod-" + kmod_name + "-modules")
 +-        print("""if [ -x "/sbin/weak-modules" ]; then
 +-    printf '%s\\n' "${modules[@]}" | /sbin/weak-modules --remove-modules
 +-fi""")
 +-
 +-    print("%files         -n kmod-" + kmod_name)
 +-    kmp_override_filelist= sys.argv[3]
 +-    if  kmp_override_filelist == '%filelist':
 +-        print("%defattr(644,root,root,755)")
 +-        print("/lib/modules/" + verrel)
 +-        print("/lib/firmware/")
 +-    else:
 +-        with open(kmp_override_filelist) as f:
 +-            for line in f:
 +-                print(line, end = '')
 +-     
 +-#for i in range(len(sys.argv)): 
 +-if (sys.argv[1] == "verrel"):
 +-    print_verrel()
 +-if (sys.argv[1] == "rpmtemplate_kmp"):
 +-    kmp=1
 +-    print_rpmtemplate()
 +-else:
 +-    print("Error: Unknown option 'sys.argv[i]'.")
 +-    exit()
 +-
 +diff --git a/macros.kmp b/macros.kmp +index d46aa04..8440e26 100644 +--- a/macros.kmp ++++ b/macros.kmp +@@ -1,22 +1,64 @@ +-# Use these macros to differentiate between __vendor and other KMP implementation(s).
 +-
 +-kernel_module_package_release	1
 +-
 +-__find_requires        /usr/lib/rpm/__vendor/find-requires
 +-
 +-
 +-#kernel_module_package [ -n name ] [ -v version ] [ -r release ] 
 +-#                      [ -f filelist][-p preamble]   
 +-#
 +-
 +-%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \
 +-					kernel-devel
 +-
 +-%kernel_module_package(n:v:r:f:p) %{expand:%( \
 +-	%define kmodtool /usr/lib/rpm/__vendor/kmodtool.py\
 +-	%define latest_kernel $(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel` | head -n 1) \
 +-	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
 +-	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
 +-        python3 %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} %{-f*}%{!-f:%filelist} %{-p*}%{!-p:%preamble} \
 +-)}
 +-
 ++# Use these macros to differentiate between __vendor and other KMP implementation(s). ++ ++kernel_module_package_release  1 ++ ++%__find_provides        /usr/lib/rpm/find-provides ++%__find_requires        /usr/lib/rpm/__vendor/find-requires ++ ++#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ] ++#                      [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ... ++ ++%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \ ++					kernel-devel ++ ++%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ ++	%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/__vendor/kmodtool} \ ++	%define kmp_version %{-v*}%{!-v:%{version}} \ ++	%define kmp_release %{-r*}%{!-r:%{release}} \ ++	%define latest_kernel %(rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\\\n' `rpm -q kernel-devel | 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" \ ++	if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \ ++	then \ ++		xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\ ++		kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\ ++		if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \ ++		then \ ++			flavors="$flavors xen" \ ++		fi \ ++		if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \ ++		then \ ++			flavors="$flavors kdump" \ ++		fi \ ++	fi \ ++	if [ -z "%*" ]; then \ ++		flavors_to_build=$flavors \ ++	elif [ -z "%{-x}" ]; then \ ++		flavors_to_build="%*" \ ++	else \ ++		flavors_to_build=" $flavors "\ ++		rm -rf /tmp/tmp.$$ \ ++		echo "[$flavors_to_build]" >/tmp/tmp.$$ \ ++		for i in %* \ ++		do \ ++			flavors_to_build=${flavors_to_build//$i /} ++		done \ ++	fi \ ++	echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \ ++	echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")" \ ++	if [ ! -z "%{-f*}" ] \ ++	then \ ++		filelist="%{-f*}" \ ++	fi \ ++	if [ ! -z "%{-p*}" ] \ ++	then \ ++		preamble="%{-p*}" \ ++	fi \ ++	nobuildreqs="yes" \ ++	if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \ ++	then \ ++		nobuildreqs="no" \ ++	fi \ ++	kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$nobuildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \ ++)} +--  +2.33.0 + diff --git a/brp-check-elf-files b/brp-check-elf-files deleted file mode 100644 index d9db6b0..0000000 --- a/brp-check-elf-files +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Check elf files - -if [ -z "$RPM_BUILD_ROOT" ]; then -	echo "No build root defined" >&2 -	exit 1 -fi - -if [ ! -d "$RPM_BUILD_ROOT" ]; then -	echo "Invalid build root" >&2 -	exit 1 -fi - -LIB="$(rpm --eval %{_lib})" -export LD_LIBRARY_PATH="$RPM_BUILD_ROOT/$LIB:$RPM_BUILD_ROOT/usr/$LIB" - -find "$RPM_BUILD_ROOT" -type f \( -executable -o -name \*.so\* \) -a \ -	\( ! -path $RPM_BUILD_ROOT/usr/lib/debug/\* -a \ -	   ! -path $RPM_BUILD_ROOT/usr/src/debug/\* \) \ -	-print0 | -xargs  --no-run-if-empty -0 file -N -L | -grep -e '\.so.*: ELF.*shared' -e ': ELF.*executable' | -while read match; do -	path="$(echo $match | cut -d':' -f1)" -	syspath="$(echo $path | sed -e "s#^$RPM_BUILD_ROOT##")" -	unused_libs="$(ldd -u -r $path 2> /dev/null | grep /)" -	if [ -n "$unused_libs" ]; then -		printf '%s\n' "Warning: unused libraries in $syspath: " >&2 -		printf '%s\n' "$unused_libs" >&2 -	fi -	if echo $match |grep -q shared; then -		undefined_symbols="$(ldd -r $path 2>&1 | grep '^undefined symbol: '| sed -e 's#^undefined symbol:##g' -e "s#($path).*##g" | tr -d '\n' | tr -d '\t')" -		if [ -n "$undefined_symbols" ]; then -			printf '%s\n' "Warning: undefined symbols in $syspath:$undefined_symbols" >&2 -		fi -	fi -done diff --git a/brp-chrpath b/brp-chrpath deleted file mode 100755 index dc48351..0000000 --- a/brp-chrpath +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/sh -# remove rpath specified - -rpathSuffix=( -	"/home/abuild/rpmbuild/BUILD", -	"/home/lkp/rpmbuild/BUILD" -) - -rpath=( -	"/usr/lib64", -	"/lib64", -	"/usr/lib", -	"/lib", -	"/usr/lib/../lib64" -) - -buildroot=$1 - -function rpathChange() -{ -	localSrcPath=$1 -	localDstPath="" - -	rpathArr=(`echo $localSrcPath | tr ':' ' '`) - -	for path in ${rpathArr[*]} -	do -		localflag=0 -		for suffix in ${rpathSuffix[*]} -		do -			if echo "$path" | grep $suffix &> /dev/null; then -				localflag=1 -				break -			fi -		done - -		# Is the suffix path, delete -		if [ $localflag -eq 1 ]; then -			continue; -		fi - -		#Is the standard path, delete -		if echo "${rpath[@]}" | grep -w $path &> /dev/null; then -			continue -		fi - -		if [ x"$localDstPath" == x"" ]; then -			localDstPath=$path -		else -			localDstPath=$localDstPath:$path -		fi -	done - -	echo $localDstPath -} - -function removeRpathOrRunpath() -{ -	localfile=$1 - -	rpathInfo=$(chrpath -l $localfile | grep "RPATH=") -	runpathInfo=$(chrpath -l $localfile | grep "RUNPATH=") - -	currPath="" -	realPath="" -	needCh=0 -	if [ x"$rpathInfo" != x"" ]; then -		needCh=1 -		currPath=$(echo $rpathInfo | awk -F "RPATH=" '{print $2}') -		realPath=$(rpathChange $currPath) -	fi - -	if [ x"$runpathInfo" != x"" ]; then -		needCh=1 -                currPath=$(echo $runpathInfo | awk -F "RUNPATH=" '{print $2}') -                realPath=$(rpathChange $currPath) -	fi - -	if [ $needCh -eq 0 ]; then -		return 0 -	fi - -	if [ x"$realPath" == x"" ]; then -		chrpath -d $localfile -	else -		chrpath -r $realPath $localfile -	fi - -	return 0 -} - -for file in $(find $buildroot/ -executable -type f -exec file {} ';' | grep "\<ELF\>" | awk -F ':' '{print $1}') -do -	test -u $file -	if [ $? -eq 0 ]; then -		continue -	fi - -	if [ -w "$file" ]; then -		removeRpathOrRunpath $file -	fi -done - -exit 0 diff --git a/brp-digest-list b/brp-digest-list deleted file mode 100755 index 2f0681d..0000000 --- a/brp-digest-list +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/sh - -# Get build root -RPM_BUILD_ROOT="${1}" - -# If using normal root, avoid changing anything. -if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then -	exit 0 -fi - -# Create temporary file listing files in the manifest -TMPDIR="/tmp" -BIN_PKG_FILES=${TMPDIR}/${3%%.rpm} -cat - > $BIN_PKG_FILES - -# Ensure temporary file is cleaned up when we exit -trap "rm -f \"${BIN_PKG_FILES}\"" 0 2 3 5 10 13 15 - -# File empty, exit -if [ -L $BIN_PKG_FILES ] || [ -z $(head -c 1 $BIN_PKG_FILES) ]; then -	exit 0 -fi - -# Create directory for digest lists -DIGEST_LIST_DIR=$RPM_BUILD_ROOT/$2/etc/ima/digest_lists -mkdir -p $DIGEST_LIST_DIR -mkdir -p $DIGEST_LIST_DIR.tlv - -# Generate digest list for the kernel -gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR -i l:policy \ -	-i i: -o add -p -1 -m immutable -i L:$BIN_PKG_FILES -i u: \ -	-A $RPM_BUILD_ROOT -i e: \ -	-i E:/usr/src \ -	-i E:/boot/efi \ -	-i F:/lib \ -	-i F:/usr/lib \ -	-i F:/lib64 \ -	-i F:/usr/lib64 \ -	-i F:/lib/modules \ -	-i F:/usr/lib/modules \ -	-i F:/lib/firmware \ -	-i F:/usr/lib/firmware - -DIGEST_LIST_PATH="$DIGEST_LIST_DIR/0-metadata_list-compact-$(basename $BIN_PKG_FILES)" -[ -f $DIGEST_LIST_PATH ] || exit 0 - -chmod 644 $DIGEST_LIST_PATH -echo $DIGEST_LIST_PATH - -# Generate TLV digest list to check metadata -gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR.tlv \ -	-i l:policy -i i: -o add -p -1 -m immutable -i L:$BIN_PKG_FILES -i u: \ -	-T -A $RPM_BUILD_ROOT -i e: \ -	-i E:/usr/src \ -	-i E:/boot/efi \ -	-i F:/lib \ -	-i F:/usr/lib \ -	-i F:/lib64 \ -	-i F:/usr/lib64 \ -	-i F:/lib/modules \ -	-i F:/usr/lib/modules \ -	-i F:/lib/firmware \ -	-i F:/usr/lib/firmware - -DIGEST_LIST_TLV_PATH="$DIGEST_LIST_DIR.tlv/0-metadata_list-compact_tlv-$(basename $BIN_PKG_FILES)" -[ -f $DIGEST_LIST_TLV_PATH ] || exit 0 - -chmod 644 $DIGEST_LIST_TLV_PATH -echo $DIGEST_LIST_TLV_PATH - -#if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \ -#      ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then -# Generate digest list for the user space parsers - -# do EBS sign -export PUBLISHER_HOST=$(grep PUBLISHER_HOST /lkp/scheduled/job.yaml | awk '{print $2}') -export PUBLISHER_PORT=$(grep PUBLISHER_PORT /lkp/scheduled/job.yaml | awk '{print $2}') -if [[ -n "$PUBLISHER_HOST" && -n "$PUBLISHER_PORT" ]]; then -	[ -f /usr/lib/rpm/brp-ebs-sign ] || exit 0 -	sh /usr/lib/rpm/brp-ebs-sign --ima-digestlist $DIGEST_LIST_PATH 1>&2 -	[ -f $DIGEST_LIST_PATH.sig ] || exit 0 -	chmod 644 $DIGEST_LIST_PATH.sig -	mv $DIGEST_LIST_PATH.sig $DIGEST_LIST_PATH -	exit 0 -fi - -# do OBS sign -[ -f /usr/lib/rpm/brp-suse.d/brp-99-pesign ] || exit 0 - -export BRP_PESIGN_FILES="$2/etc/ima/digest_lists/*" -export RPM_BUILD_ROOT -export RPM_PACKAGE_NAME="digest-list-tools" -export RPM_SOURCE_DIR="$(rpm --eval %_topdir)/SOURCES" - -if [ -f "/usr/lib/rpm/brp-suse.d/brp-99-pesign" ]; then -	/usr/lib/rpm/brp-suse.d/brp-99-pesign &> /dev/null -fi -#fi diff --git a/brp-ebs-sign b/brp-ebs-sign deleted file mode 100755 index 885d7aa..0000000 --- a/brp-ebs-sign +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/bash - -INPUT_TYPE=$1 -INPUT_FILE=$2 -SIGN_FILE=$INPUT_FILE -PROJECT_CONF="/lkp/scheduled/job.yaml" -POST_ADDR="" -POST_FILE_SHA256="" -POST_KEY_NAME="" -POST_KEY_TYPE="" -POST_FILE_TYPE="" -POST_SIGN_TYPE="" -POST_JOB_ID="" -POST_OS_ORIJECT="" -CONFIG_RETEST_COUNT=5 -SIGN_RESULT=0 -FAILED_SIGN_PERMISSION_DENIED=2 - -# Tool functions for JSON -get_json_value(){ -	echo "$1" | \ -	awk -F "[{,:}]" '{for(i=1;i<NF;i++){if($i~"'$2'"){print $(i+1)}}}' | \ -	sed 's/\"//g' -} - -get_post_json() { -	printf '{' -	printf '"file_sha256":"%s",' $POST_FILE_SHA256 -	printf '"key_name":"%s",' $POST_KEY_NAME -	printf '"key_type":"%s",' $POST_KEY_TYPE -	printf '"file_type":"%s",' $POST_FILE_TYPE -	printf '"sign_type":"%s",' $POST_SIGN_TYPE -	printf '"job_id":"%s",' $POST_JOB_ID -	printf '"os_project":"%s"' $POST_OS_ORIJECT -	printf '}' -} - -# Prepare sign functions for each sign type -module_sign_pre() { -	if [[ "$INPUT_FILE" != *.ko ]]; then -		echo "The module file must has the .ko extension" -		return 1 -	fi - -	SIGN_FILE="$INPUT_FILE" -	POST_KEY_NAME="openeuler-kernel-module-ee" -	POST_KEY_TYPE="x509ee" -	POST_FILE_TYPE="kernel-module" -	POST_SIGN_TYPE="cms" -} - -ima_digestlist_sign_pre() { -	cp -f $INPUT_FILE $INPUT_FILE.ko -	SIGN_FILE="$INPUT_FILE.ko" -	POST_KEY_NAME="openeuler-ima-ee" -	POST_KEY_TYPE="x509ee" -	POST_FILE_TYPE="kernel-module" -	POST_SIGN_TYPE="cms" -} - -efi_sign_pre() { -	SIGN_FILE="$INPUT_FILE" -	POST_KEY_NAME="default-x509ee" -	POST_KEY_TYPE="x509ee" -	POST_FILE_TYPE="efi-image" -	POST_SIGN_TYPE="authenticode" -} - -kernel_sign_pre() { -	SIGN_FILE="$INPUT_FILE" -	POST_KEY_NAME="default-x509ee" -	POST_KEY_TYPE="x509ee" -	POST_FILE_TYPE="efi-image" -	POST_SIGN_TYPE="authenticode" -} - -# Post sign functions for each sign type -module_sign_post() { -	: -} - -ima_digestlist_sign_post() { -	rm -f $INPUT_FILE.ko -} - -efi_sign_post() { -	: -} - -kernel_sign_post() { -	: -} - -# Global configuration -sign_config() { -	if [ -z "$INPUT_TYPE" ] || [ -z "$INPUT_FILE" ]; then -		echo "Please input the sign type and file" -		exit 1 -	fi - -	if [ ! -f "$INPUT_FILE" ]; then -		echo "The input file is invalid" -		exit 1 -	fi - -	POST_FILE_SHA256=$(sha256sum "$INPUT_FILE" | awk '{ print $1 }') -	if [ $? -ne 0 ]; then -		echo "Failed to calculate file hash" -	fi - -	PUBLISHER_HOST=$(grep PUBLISHER_HOST $PROJECT_CONF | awk '{print $2}') -	PUBLISHER_PORT=$(grep PUBLISHER_PORT $PROJECT_CONF | awk '{print $2}') -	if [ -z "$PUBLISHER_HOST" ] || [ -z "$PUBLISHER_PORT" ]; then -		echo "Please set PUBLISHER_HOST and PUBLISHER_PORT" -		exit 1 -	fi - -	POST_ADDR="http://${PUBLISHER_HOST}:${PUBLISHER_PORT}/code-sign" - -	POST_JOB_ID="$(grep -rwn 'id\:' $PROJECT_CONF | awk '{print $2}')" -	POST_OS_ORIJECT="$(grep -rwn 'os_project\:' $PROJECT_CONF | awk '{print $2}')" -	if [ -z "$POST_JOB_ID" ] || [ -z "$POST_OS_ORIJECT" ]; then -		echo "Failed to get POST_JOB_ID and POST_OS_ORIJECT" -		exit 1 -	fi -} - -sign_pre() { -	sign_config - -	case $INPUT_TYPE in -	--efi) -		efi_sign_pre -		;; -	--module) -		module_sign_pre -		;; -	--ima-digestlist) -		ima_digestlist_sign_pre -		;; -	--kernel) -		kernel_sign_pre -		;; -	*) -		echo "Unsupported sign type: $INPUT_TYPE" -		exit 1 -		;; -	esac -} - -sign() { -	# 1. send the request to the sign service -	# echo "curl "$POST_ADDR" \ -	# 	   -F "file=@$SIGN_FILE" \ -	# 	   -F "data=$(get_post_json);type=application/json"" -	req="$(curl "$POST_ADDR" \ -		    -F "file=@$SIGN_FILE" \ -		    -F "data=$(get_post_json);type=application/json")" -	if [ $? -ne 0 ]; then -		echo "Failed to post the sign service" -		return 1 -	fi - -	req_err_msg=$(get_json_value "$req" "err_msg") -	if [ -n "$req_err_msg" ]; then -		echo "Failed, err_msg: [$req_err_msg]" -		if [ "$req_err_msg" == "SIGN_PERMISSION_DENIED" ]; then -			return $FAILED_SIGN_PERMISSION_DENIED -		fi -		return 1 -	fi - -	# 2. write the file content -	encoded_file_content=$(get_json_value "$req" "encoded_file_content") -	if [ $? -ne 0 ]; then -		echo "Failed to get encoded file content" -		return 1 -	fi - -	echo -ne "$encoded_file_content" | base64 -d > $INPUT_FILE.sig -	if [ $? -ne 0 ]; then -		echo "Failed to write the signed file" -		return 1 -	fi - -	# for test -	# cp -f $INPUT_FILE $INPUT_FILE.sig -	# req="{file_sha256:41c68fca7b3870cc9ef13a828a74af933bd8e4ff345fcfa316}" - -	# 3. check the hash -	sha256_cal=$(sha256sum $INPUT_FILE.sig | awk '{print $1}') -	sha256_get=$(get_json_value "$req" "file_sha256" | tr '[:upper:]' '[:lower:]') -	if [ "$sha256_cal" != "$sha256_get" ]; then -		echo "Failed to verify the hash value" -		return 1 -	fi -} - -sign_post() { -	case $INPUT_TYPE in -	--efi) -		efi_sign_post -		;; -	--module) -		module_sign_post -		;; -	--ima-digestlist) -		ima_digestlist_sign_post -		;; -	--kernel) -		kernel_sign_post -		;; -	esac -} - -# Main function -sign_pre - -for ((i=1; i<=$CONFIG_RETEST_COUNT; i++)); do -	sign -	ret_sign=$? -	if [ $ret_sign -eq 0 ]; then -		echo "Succeed to sign file" -		break; -	elif [ $ret_sign -eq $FAILED_SIGN_PERMISSION_DENIED ]; then -		echo "Failed to sign file, permission denied" -		SIGN_RESULT=$FAILED_SIGN_PERMISSION_DENIED -		break; -	elif [ $i -ne $CONFIG_RETEST_COUNT ]; then -		echo "Failed to sign file, try again" -	elif [ $i -eq $CONFIG_RETEST_COUNT ]; then -		echo "Failed to sign file" -		SIGN_RESULT=1 -	fi -done - -sign_post -exit $SIGN_RESULT diff --git a/brp-ldconfig b/brp-ldconfig deleted file mode 100755 index 7b2fb15..0000000 --- a/brp-ldconfig +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -efu - -# If using normal root, avoid changing anything. -if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then -  exit 0 -fi - -riscv64_lp64d=0 -if [ "$HOSTTYPE" = "riscv64" -a -e $RPM_BUILD_ROOT/usr/lib64 -a ! -e $RPM_BUILD_ROOT/usr/lib64/lp64d ]; then -    ln -s . $RPM_BUILD_ROOT/usr/lib64/lp64d -    riscv64_lp64d=1 -fi -/sbin/ldconfig -N -r "$RPM_BUILD_ROOT" -if [ $riscv64_lp64d = 1 ]; then -    rm -f $RPM_BUILD_ROOT/usr/lib64/lp64d -fi diff --git a/brp-remove-info-dir b/brp-remove-info-dir deleted file mode 100644 index 5961830..0000000 --- a/brp-remove-info-dir +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -if [ -z "$RPM_BUILD_ROOT" ]; then -    echo "No build root defined" >&2 -    exit 1 -fi - -if [ ! -d "$RPM_BUILD_ROOT" ]; then -    echo "Invalid build root" >&2 -    exit 1 -fi - -INFODIR=`rpm --eval %{_infodir}/dir` - -dir="$RPM_BUILD_ROOT/$INFODIR" - -if [ -f $dir -a ! -L $dir ]; then -    rm -f $dir -fi diff --git a/change-the-vendor-to-generic-for-common-use.patch b/change-the-vendor-to-generic-for-common-use.patch new file mode 100644 index 0000000..6da802d --- /dev/null +++ b/change-the-vendor-to-generic-for-common-use.patch @@ -0,0 +1,109 @@ +From e9f486a8d9af5b01dcadf8432a449e434cd6886b Mon Sep 17 00:00:00 2001 +From: Yangyang Shen <shenyangyang4@huawei.com> +Date: Sat, 27 Mar 2021 14:18:56 +0800 +Subject: [PATCH] change the vendor to generic for common use + +--- + openEuler-hardened-cc1 => generic-hardened-cc1 |  0 + openEuler-hardened-ld => generic-hardened-ld   |  0 + openEuler-pie-cc1 => generic-pie-cc1           |  0 + openEuler-pie-ld => generic-pie-ld             |  0 + macros                                         | 16 ++++++++-------- + macros.kmp                                     |  2 +- + 6 files changed, 9 insertions(+), 9 deletions(-) + rename openEuler-hardened-cc1 => generic-hardened-cc1 (100%) + rename openEuler-hardened-ld => generic-hardened-ld (100%) + rename openEuler-pie-cc1 => generic-pie-cc1 (100%) + rename openEuler-pie-ld => generic-pie-ld (100%) + +diff --git a/openEuler-hardened-cc1 b/generic-hardened-cc1 +similarity index 100% +rename from openEuler-hardened-cc1 +rename to generic-hardened-cc1 +diff --git a/openEuler-hardened-ld b/generic-hardened-ld +similarity index 100% +rename from openEuler-hardened-ld +rename to generic-hardened-ld +diff --git a/openEuler-pie-cc1 b/generic-pie-cc1 +similarity index 100% +rename from openEuler-pie-cc1 +rename to generic-pie-cc1 +diff --git a/openEuler-pie-ld b/generic-pie-ld +similarity index 100% +rename from openEuler-pie-ld +rename to generic-pie-ld +diff --git a/macros b/macros +index b06faea..def87a7 100644 +--- a/macros ++++ b/macros +@@ -1,6 +1,6 @@ + # Per-platform rpm configuration file. +  +-%_vendor 		openEuler ++%_vendor 		__vendor + %_os			linux + %_target_platform	%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu} +  +@@ -52,7 +52,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/openEuler/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/openEuler/$(basename $i) $i ; \ ++      [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ +   done ; \ +   [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \ +       for i in $(find . -name ltmain.sh) ; do \ +@@ -89,7 +89,7 @@ +  + # Build root policy macros. Standard naming: + # convert all '-' in basename to '_', add two leading underscores. +-%__brp_ldconfig /usr/lib/rpm/openEuler/brp-ldconfig ++%__brp_ldconfig /usr/lib/rpm/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} +@@ -144,8 +144,8 @@ + # 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 ++%_hardening_cflags	-specs=/usr/lib/rpm/generic-hardened-cc1 ++%_hardening_ldflags	-Wl,-z,now -specs=/usr/lib/rpm/generic-hardened-ld + # Use "%undefine _hardened_build" to disable. + %_hardened_build	1 + %_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}} +@@ -156,14 +156,14 @@ + #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_pre_cflags   -specs=/usr/lib/rpm/generic-pie-cc1 ++%_pie_pre_ldflags  -Wl,-z,now -specs=/usr/lib/rpm/generic-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_pre_cflags    -specs=/usr/lib/rpm/generic-fs-cc1 + %_fs_cflags        %{?_fs_build:%{_fs_pre_cflags}} +  +  +diff --git a/macros.kmp b/macros.kmp +index be66e64..b9ebbe8 100644 +--- a/macros.kmp ++++ b/macros.kmp +@@ -12,7 +12,7 @@ kernel_module_package_release	1 + 					kernel-devel
 + 
 + %kernel_module_package(n:v:r:f:) %{expand:%( \
 +-	%define kmodtool /usr/lib/rpm/openEuler/kmodtool.py\
 ++	%define kmodtool /usr/lib/rpm/__vendor/kmodtool.py\
 + 	%define latest_kernel $(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel` | head -n 1) \
 + 	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
 + 	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
 +--  +2.33.0 + diff --git a/check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch b/check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch new file mode 100644 index 0000000..853ec38 --- /dev/null +++ b/check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch @@ -0,0 +1,25 @@ +From 0eea7318489474d20e391cc55eb81f2a642e36f8 Mon Sep 17 00:00:00 2001 +From: gaoyusong <gaoyusong2@huawei.com> +Date: Fri, 3 Nov 2023 10:55:26 +0800 +Subject: [PATCH] check if the file is a symbolic link in brp-digest-list + +--- + brp-digest-list | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/brp-digest-list b/brp-digest-list +index 9ec50a2..77248c9 100644 +--- a/brp-digest-list ++++ b/brp-digest-list +@@ -18,7 +18,7 @@ cat - > $BIN_PKG_FILES + trap "rm -f \"${BIN_PKG_FILES}\"" 0 2 3 5 10 13 15 +  + # File empty, exit +-if [ -z $(head -c 1 $BIN_PKG_FILES) ]; then ++if [ -L $BIN_PKG_FILES ] || [ -z $(head -c 1 $BIN_PKG_FILES) ]; then + 	exit 0 + fi +  +--  +2.27.0 + diff --git a/common.lua b/common.lua deleted file mode 100644 index 884ee4d..0000000 --- a/common.lua +++ /dev/null @@ -1,294 +0,0 @@ --- Convenience Lua functions that can be used within rpm macros -  --- Reads an rpm variable. Unlike a basic rpm.expand("{?foo}"), returns nil if --- the variable is unset, which is convenient in lua tests and enables --- differentiating unset variables from variables set to "" -local function read(rpmvar) -  if not rpmvar or -    (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then -    return nil -  else -    return rpm.expand("%{?" .. rpmvar .. "}") -  end -end -  --- Returns true if the macro that called this function had flag set ---   – for example, hasflag("z") would give the following results: ---     %foo -z bar → true ---     %foo -z     → true ---     %foo        → false -local function hasflag(flag) -  return (rpm.expand("%{-" .. flag .. "}") ~= "") -end -  --- Returns the argument passed to flag in the macro that called this function ---  – for example, readflag("z") would give the following results: ---      %foo -z bar → bar ---      %foo        → nil ---      %foo -z ""  → empty string ---      %foo -z ''  → empty string -local function readflag(flag) -  if not hasflag(flag) then -    return nil -  else -    local a = rpm.expand("%{-" .. flag .. "*}") -    -- Handle "" and '' as empty strings -    if (a == '""') or (a == "''") then -      a = '' -    end -    return a -  end -end -  --- Sets a spec variable; echoes the result if verbose -local function explicitset(rpmvar, value, verbose) -  local value = value -  if (value == nil) or (value == "") then -    value = "%{nil}" -  end -  rpm.define(rpmvar .. " " .. value) -  if verbose then -    rpm.expand("%{warn:Setting %%{" .. rpmvar .. "} = " .. value .. "}") -  end -end -  --- Unsets a spec variable if it is defined; echoes the result if verbose -local function explicitunset(rpmvar, verbose) -  if (rpm.expand("%{" .. rpmvar .. "}") ~= "%{" .. rpmvar .. "}") then -    rpm.define(rpmvar .. " %{nil}") -    if verbose then -      rpm.expand("%{warn:Unsetting %%{" .. rpmvar .. "}}") -    end -  end -end -  --- Sets a spec variable, if not already set; echoes the result if verbose -local function safeset(rpmvar, value, verbose) -  if (rpm.expand("%{" .. rpmvar .. "}") == "%{" .. rpmvar .. "}") then -    explicitset(rpmvar,value,verbose) -  end -end -  --- Aliases a list of rpm variables to the same variables suffixed with 0 (and --- vice versa); echoes the result if verbose -local function zalias(rpmvars, verbose) -  for _, sfx in ipairs({{"","0"},{"0",""}}) do -    for _, rpmvar in ipairs(rpmvars) do -      local toalias = "%{?" .. rpmvar .. sfx[1] .. "}" -      if (rpm.expand(toalias) ~= "") then -        safeset(rpmvar .. sfx[2], toalias, verbose) -      end -    end -  end -end -  --- Takes a list of rpm variable roots and a suffix and alias current<root> to --- <root><suffix> if it resolves to something not empty -local function setcurrent(rpmvars, suffix, verbose) -  for _, rpmvar in ipairs(rpmvars) do -    if (rpm.expand("%{?" .. rpmvar .. suffix .. "}") ~= "") then -      explicitset(  "current" .. rpmvar, "%{" .. rpmvar .. suffix .. "}", verbose) -    else -      explicitunset("current" .. rpmvar,                                  verbose) -    end -  end -end -  --- Echo the list of rpm variables, with suffix, if set -local function echovars(rpmvars, suffix) -  for _, rpmvar in ipairs(rpmvars) do -    rpmvar = rpmvar .. suffix -    local header = string.sub("  " .. rpmvar .. ":                                               ",1,21) -    rpm.expand("%{?" .. rpmvar .. ":%{echo:" .. header .. "%{?" .. rpmvar .. "}}}") -  end -end -  --- Returns an array, indexed by suffix, containing the non-empy values of --- <rpmvar><suffix>, with suffix an integer string or the empty string -local function getsuffixed(rpmvar) -  local suffixes = {} -  zalias({rpmvar}) -  for suffix=0,9999 do -    local value = rpm.expand("%{?" .. rpmvar .. suffix .. "}") -    if (value ~= "") then -      suffixes[tostring(suffix)] = value -    end -  end -  -- rpm convention is to alias no suffix to zero suffix -  -- only add no suffix if zero suffix is different -  local value = rpm.expand("%{?" .. rpmvar .. "}") -  if (value ~= "") and (value ~= suffixes["0"]) then -     suffixes[""] = value -  end -  return suffixes -end -  --- Returns the list of suffixes, including the empty string, for which --- <rpmvar><suffix> is set to a non empty value -local function getsuffixes(rpmvar) -  suffixes = {} -  for suffix in pairs(getsuffixed(rpmvar)) do -    table.insert(suffixes,suffix) -  end -  table.sort(suffixes, -             function(a,b) return (tonumber(a) or 0) < (tonumber(b) or 0) end) -  return suffixes -end -  --- Returns the suffix for which <rpmvar><suffix> has a non-empty value that --- matches best the beginning of the value string -local function getbestsuffix(rpmvar, value) -  local best         = nil -  local currentmatch = "" -  for suffix, setvalue in pairs(getsuffixed(rpmvar)) do -  if (string.len(setvalue) > string.len(currentmatch)) and -     (string.find(value, "^" .. setvalue)) then -      currentmatch = setvalue -      best         = suffix -    end -  end -  return best -end -  --- %writevars core -local function writevars(macrofile, rpmvars) -  for _, rpmvar in ipairs(rpmvars) do -    print("sed -i 's\029" .. string.upper("@@" .. rpmvar .. "@@") .. -                   "\029" .. rpm.expand(  "%{" .. rpmvar .. "}" ) .. -                   "\029g' " .. macrofile .. "\n") -  end -end -  --- https://github.com/rpm-software-management/rpm/issues/566 --- Reformat a text intended to be used used in a package description, removing --- rpm macro generation artefacts. --- – remove leading and ending empty lines --- – trim intermediary empty lines to a single line --- – fold on spaces --- Should really be a %%{wordwrap:…} verb -local function wordwrap(text) -  text = rpm.expand(text .. "\n") -  text = string.gsub(text, "\t",              "  ") -  text = string.gsub(text, "\r",              "\n") -  text = string.gsub(text, " +\n",            "\n") -  text = string.gsub(text, "\n+\n",           "\n\n") -  text = string.gsub(text, "^\n",             "") -  text = string.gsub(text, "\n( *)[-*—][  ]+", "\n%1– ") -  output = "" -  for line in string.gmatch(text, "[^\n]*\n") do -    local pos = 0 -    local advance = "" -    for word in string.gmatch(line, "%s*[^%s]*\n?") do -      local wl, bad = utf8.len(word) -      if not wl then -        print("%{warn:Invalid UTF-8 sequence detected in:}" .. -              "%{warn:" .. word .. "}" .. -              "%{warn:It may produce unexpected results.}") -        wl = bad -      end -      if (pos == 0) then -        advance, n = string.gsub(word, "^(%s*– ).*", "%1") -        if (n == 0) then -          advance = string.gsub(word, "^(%s*).*", "%1") -        end -        advance = string.gsub(advance, "– ", "  ") -        pos = pos + wl -      elseif  (pos + wl  < 81) or -             ((pos + wl == 81) and string.match(word, "\n$")) then -        pos = pos + wl -      else -        word = advance .. string.gsub(word, "^%s*", "") -        output = output .. "\n" -        pos = utf8.len(word) -      end -      output = output .. word -      if pos > 80 then -        pos = 0 -        if not string.match(word, "\n$") then -          output = output .. "\n" -        end -      end -    end -  end -  output = string.gsub(output, "\n*$", "\n") -  return output -end -  --- Because rpmbuild will fail if a subpackage is declared before the source --- package itself, provide a source package declaration shell as fallback. -local function srcpkg(verbose) -  if verbose then -    rpm.expand([[ -%{echo:Creating a header for the SRPM from %%{source_name}, %%{source_summary} and} -%{echo:%%{source_description}. If that is not the intended result, please declare the} -%{echo:SRPM header and set %%{source_name} in your spec file before calling a macro} -%{echo:that creates other package headers.} -]]) -  end -  print(rpm.expand([[ -Name:           %{source_name} -Summary:        %{source_summary} -%description -%wordwrap -v source_description -]])) -  explicitset("currentname", "%{source_name}", verbose) -end -  --- %new_package core -local function new_package(source_name, pkg_name, name_suffix, first, verbose) -  -- Safety net when the wrapper is used in conjunction with traditional syntax -  if (not first) and (not source_name) then -    rpm.expand([[ -%{warn:Something already set a package name. However, %%{source_name} is not set.} -%{warn:Please set %%{source_name} to the SRPM name to ensure reliable processing.} -]]) -    if name_suffix then -      print(rpm.expand("%package        " .. name_suffix)) -    else -      print(rpm.expand("%package     -n " .. pkg_name)) -    end -    return -  end -  -- New processing -  if not (pkg_name or name_suffix or source_name) then -    rpm.expand([[ -%{error:You need to set %%{source_name} or provide explicit package naming!} -]]) -  end -  if name_suffix then -    print(rpm.expand("%package        "  .. name_suffix)) -    explicitset("currentname", "%{source_name}-" .. name_suffix, verbose) -  else -    if not source_name then -      source_name = pkg_name -    end -    if (pkg_name == source_name) then -      safeset("source_name", source_name, verbose) -      print(rpm.expand("Name:           %{source_name}")) -    else -      if source_name and first then -        srcpkg(verbose) -      end -      print(rpm.expand("%package     -n " .. pkg_name)) -    end -    explicitset("currentname", pkg_name, verbose) -  end -end -  -return { -  read          = read, -  hasflag       = hasflag, -  readflag      = readflag, -  explicitset   = explicitset, -  explicitunset = explicitunset, -  safeset       = safeset, -  zalias        = zalias, -  setcurrent    = setcurrent, -  echovars      = echovars, -  getsuffixed   = getsuffixed, -  getsuffixes   = getsuffixes, -  getbestsuffix = getbestsuffix, -  writevars     = writevars, -  wordwrap      = wordwrap, -  new_package   = new_package, -} diff --git a/config.guess b/config.guess deleted file mode 100755 index 48a6846..0000000 --- a/config.guess +++ /dev/null @@ -1,1815 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -#   Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2024-07-27' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <https://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program.  This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess -# -# Please send patches to <config-patches@gnu.org>. - - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX.  However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system '$me' is run on. - -Options: -  -h, --help         print this help, then exit -  -t, --time-stamp   print date of last modification, then exit -  -v, --version      print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions.  There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do -  case $1 in -    --time-stamp | --time* | -t ) -       echo "$timestamp" ; exit ;; -    --version | -v ) -       echo "$version" ; exit ;; -    --help | --h* | -h ) -       echo "$usage"; exit ;; -    -- )     # Stop option processing -       shift; break ;; -    - )	# Use stdin as input. -       break ;; -    -* ) -       echo "$me: invalid option $1$help" >&2 -       exit 1 ;; -    * ) -       break ;; -  esac -done - -if test $# != 0; then -  echo "$me: too many arguments$help" >&2 -  exit 1 -fi - -# Just in case it came from the environment. -GUESS= - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still -# use 'HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 - -set_cc_for_build() { -    # prevent multiple calls if $tmp is already set -    test "$tmp" && return 0 -    : "${TMPDIR=/tmp}" -    # shellcheck disable=SC2039,SC3028 -    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || -	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || -	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || -	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } -    dummy=$tmp/dummy -    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in -	,,)    echo "int x;" > "$dummy.c" -	       for driver in cc gcc c17 c99 c89 ; do -		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then -		       CC_FOR_BUILD=$driver -		       break -		   fi -	       done -	       if test x"$CC_FOR_BUILD" = x ; then -		   CC_FOR_BUILD=no_compiler_found -	       fi -	       ;; -	,,*)   CC_FOR_BUILD=$CC ;; -	,*,*)  CC_FOR_BUILD=$HOST_CC ;; -    esac -} - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then -	PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case $UNAME_SYSTEM in -Linux|GNU|GNU/*) -	LIBC=unknown - -	set_cc_for_build -	cat <<-EOF > "$dummy.c" -	#if defined(__ANDROID__) -	LIBC=android -	#else -	#include <features.h> -	#if defined(__UCLIBC__) -	LIBC=uclibc -	#elif defined(__dietlibc__) -	LIBC=dietlibc -	#elif defined(__GLIBC__) -	LIBC=gnu -	#elif defined(__LLVM_LIBC__) -	LIBC=llvm -	#else -	#include <stdarg.h> -	/* First heuristic to detect musl libc.  */ -	#ifdef __DEFINED_va_list -	LIBC=musl -	#endif -	#endif -	#endif -	EOF -	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` -	eval "$cc_set_libc" - -	# Second heuristic to detect musl libc. -	if [ "$LIBC" = unknown ] && -	   command -v ldd >/dev/null && -	   ldd --version 2>&1 | grep -q ^musl; then -		LIBC=musl -	fi - -	# If the system lacks a compiler, then just pick glibc. -	# We could probably try harder. -	if [ "$LIBC" = unknown ]; then -		LIBC=gnu -	fi -	;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in -    *:NetBSD:*:*) -	# NetBSD (nbsd) targets should (where applicable) match one or -	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, -	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently -	# switched to ELF, *-*-netbsd* would select the old -	# object file format.  This provides both forward -	# compatibility and a consistent mechanism for selecting the -	# object file format. -	# -	# Note: NetBSD doesn't particularly care about the vendor -	# portion of the name.  We always set it to "unknown". -	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ -	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ -	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ -	    echo unknown)` -	case $UNAME_MACHINE_ARCH in -	    aarch64eb) machine=aarch64_be-unknown ;; -	    armeb) machine=armeb-unknown ;; -	    arm*) machine=arm-unknown ;; -	    sh3el) machine=shl-unknown ;; -	    sh3eb) machine=sh-unknown ;; -	    sh5el) machine=sh5le-unknown ;; -	    earmv*) -		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` -		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` -		machine=${arch}${endian}-unknown -		;; -	    *) machine=$UNAME_MACHINE_ARCH-unknown ;; -	esac -	# The Operating System including object format, if it has switched -	# to ELF recently (or will in the future) and ABI. -	case $UNAME_MACHINE_ARCH in -	    earm*) -		os=netbsdelf -		;; -	    arm*|i386|m68k|ns32k|sh3*|sparc|vax) -		set_cc_for_build -		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ -			| grep -q __ELF__ -		then -		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). -		    # Return netbsd for either.  FIX? -		    os=netbsd -		else -		    os=netbsdelf -		fi -		;; -	    *) -		os=netbsd -		;; -	esac -	# Determine ABI tags. -	case $UNAME_MACHINE_ARCH in -	    earm*) -		expr='s/^earmv[0-9]/-eabi/;s/eb$//' -		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` -		;; -	esac -	# The OS release -	# Debian GNU/NetBSD machines have a different userland, and -	# thus, need a distinct triplet. However, they do not need -	# kernel version information, so it can be replaced with a -	# suitable tag, in the style of linux-gnu. -	case $UNAME_VERSION in -	    Debian*) -		release='-gnu' -		;; -	    *) -		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` -		;; -	esac -	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: -	# contains redundant information, the shorter form: -	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. -	GUESS=$machine-${os}${release}${abi-} -	;; -    *:Bitrig:*:*) -	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` -	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE -	;; -    *:OpenBSD:*:*) -	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` -	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE -	;; -    *:SecBSD:*:*) -	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` -	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE -	;; -    *:LibertyBSD:*:*) -	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` -	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE -	;; -    *:MidnightBSD:*:*) -	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE -	;; -    *:ekkoBSD:*:*) -	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE -	;; -    *:SolidBSD:*:*) -	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE -	;; -    *:OS108:*:*) -	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE -	;; -    macppc:MirBSD:*:*) -	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE -	;; -    *:MirBSD:*:*) -	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE -	;; -    *:Sortix:*:*) -	GUESS=$UNAME_MACHINE-unknown-sortix -	;; -    *:Twizzler:*:*) -	GUESS=$UNAME_MACHINE-unknown-twizzler -	;; -    *:Redox:*:*) -	GUESS=$UNAME_MACHINE-unknown-redox -	;; -    mips:OSF1:*.*) -	GUESS=mips-dec-osf1 -	;; -    alpha:OSF1:*:*) -	# Reset EXIT trap before exiting to avoid spurious non-zero exit code. -	trap '' 0 -	case $UNAME_RELEASE in -	*4.0) -		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` -		;; -	*5.*) -		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` -		;; -	esac -	# According to Compaq, /usr/sbin/psrinfo has been available on -	# OSF/1 and Tru64 systems produced since 1995.  I hope that -	# covers most systems running today.  This code pipes the CPU -	# types through head -n 1, so we only detect the type of CPU 0. -	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1` -	case $ALPHA_CPU_TYPE in -	    "EV4 (21064)") -		UNAME_MACHINE=alpha ;; -	    "EV4.5 (21064)") -		UNAME_MACHINE=alpha ;; -	    "LCA4 (21066/21068)") -		UNAME_MACHINE=alpha ;; -	    "EV5 (21164)") -		UNAME_MACHINE=alphaev5 ;; -	    "EV5.6 (21164A)") -		UNAME_MACHINE=alphaev56 ;; -	    "EV5.6 (21164PC)") -		UNAME_MACHINE=alphapca56 ;; -	    "EV5.7 (21164PC)") -		UNAME_MACHINE=alphapca57 ;; -	    "EV6 (21264)") -		UNAME_MACHINE=alphaev6 ;; -	    "EV6.7 (21264A)") -		UNAME_MACHINE=alphaev67 ;; -	    "EV6.8CB (21264C)") -		UNAME_MACHINE=alphaev68 ;; -	    "EV6.8AL (21264B)") -		UNAME_MACHINE=alphaev68 ;; -	    "EV6.8CX (21264D)") -		UNAME_MACHINE=alphaev68 ;; -	    "EV6.9A (21264/EV69A)") -		UNAME_MACHINE=alphaev69 ;; -	    "EV7 (21364)") -		UNAME_MACHINE=alphaev7 ;; -	    "EV7.9 (21364A)") -		UNAME_MACHINE=alphaev79 ;; -	esac -	# A Pn.n version is a patched version. -	# A Vn.n version is a released version. -	# A Tn.n version is a released field test version. -	# A Xn.n version is an unreleased experimental baselevel. -	# 1.2 uses "1.2" for uname -r. -	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` -	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL -	;; -    Amiga*:UNIX_System_V:4.0:*) -	GUESS=m68k-unknown-sysv4 -	;; -    *:[Aa]miga[Oo][Ss]:*:*) -	GUESS=$UNAME_MACHINE-unknown-amigaos -	;; -    *:[Mm]orph[Oo][Ss]:*:*) -	GUESS=$UNAME_MACHINE-unknown-morphos -	;; -    *:OS/390:*:*) -	GUESS=i370-ibm-openedition -	;; -    *:z/VM:*:*) -	GUESS=s390-ibm-zvmoe -	;; -    *:OS400:*:*) -	GUESS=powerpc-ibm-os400 -	;; -    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) -	GUESS=arm-acorn-riscix$UNAME_RELEASE -	;; -    arm*:riscos:*:*|arm*:RISCOS:*:*) -	GUESS=arm-unknown-riscos -	;; -    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) -	GUESS=hppa1.1-hitachi-hiuxmpp -	;; -    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) -	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. -	case `(/bin/universe) 2>/dev/null` in -	    att) GUESS=pyramid-pyramid-sysv3 ;; -	    *)   GUESS=pyramid-pyramid-bsd   ;; -	esac -	;; -    NILE*:*:*:dcosx) -	GUESS=pyramid-pyramid-svr4 -	;; -    DRS?6000:unix:4.0:6*) -	GUESS=sparc-icl-nx6 -	;; -    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) -	case `/usr/bin/uname -p` in -	    sparc) GUESS=sparc-icl-nx7 ;; -	esac -	;; -    s390x:SunOS:*:*) -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL -	;; -    sun4H:SunOS:5.*:*) -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=sparc-hal-solaris2$SUN_REL -	;; -    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=sparc-sun-solaris2$SUN_REL -	;; -    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) -	GUESS=i386-pc-auroraux$UNAME_RELEASE -	;; -    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) -	set_cc_for_build -	SUN_ARCH=i386 -	# If there is a compiler, see if it is configured for 64-bit objects. -	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does. -	# This test works for both compilers. -	if test "$CC_FOR_BUILD" != no_compiler_found; then -	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ -		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ -		grep IS_64BIT_ARCH >/dev/null -	    then -		SUN_ARCH=x86_64 -	    fi -	fi -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL -	;; -    sun4*:SunOS:6*:*) -	# According to config.sub, this is the proper way to canonicalize -	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but -	# it's likely to be more like Solaris than SunOS4. -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=sparc-sun-solaris3$SUN_REL -	;; -    sun4*:SunOS:*:*) -	case `/usr/bin/arch -k` in -	    Series*|S4*) -		UNAME_RELEASE=`uname -v` -		;; -	esac -	# Japanese Language versions have a version number like '4.1.3-JL'. -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` -	GUESS=sparc-sun-sunos$SUN_REL -	;; -    sun3*:SunOS:*:*) -	GUESS=m68k-sun-sunos$UNAME_RELEASE -	;; -    sun*:*:4.2BSD:*) -	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` -	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 -	case `/bin/arch` in -	    sun3) -		GUESS=m68k-sun-sunos$UNAME_RELEASE -		;; -	    sun4) -		GUESS=sparc-sun-sunos$UNAME_RELEASE -		;; -	esac -	;; -    aushp:SunOS:*:*) -	GUESS=sparc-auspex-sunos$UNAME_RELEASE -	;; -    # The situation for MiNT is a little confusing.  The machine name -    # can be virtually everything (everything which is not -    # "atarist" or "atariste" at least should have a processor -    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT" -    # to the lowercase version "mint" (or "freemint").  Finally -    # the system name "TOS" denotes a system which is actually not -    # MiNT.  But MiNT is downward compatible to TOS, so this should -    # be no problem. -    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) -	GUESS=m68k-atari-mint$UNAME_RELEASE -	;; -    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) -	GUESS=m68k-atari-mint$UNAME_RELEASE -	;; -    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) -	GUESS=m68k-atari-mint$UNAME_RELEASE -	;; -    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) -	GUESS=m68k-milan-mint$UNAME_RELEASE -	;; -    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) -	GUESS=m68k-hades-mint$UNAME_RELEASE -	;; -    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) -	GUESS=m68k-unknown-mint$UNAME_RELEASE -	;; -    m68k:machten:*:*) -	GUESS=m68k-apple-machten$UNAME_RELEASE -	;; -    powerpc:machten:*:*) -	GUESS=powerpc-apple-machten$UNAME_RELEASE -	;; -    RISC*:Mach:*:*) -	GUESS=mips-dec-mach_bsd4.3 -	;; -    RISC*:ULTRIX:*:*) -	GUESS=mips-dec-ultrix$UNAME_RELEASE -	;; -    VAX*:ULTRIX*:*:*) -	GUESS=vax-dec-ultrix$UNAME_RELEASE -	;; -    2020:CLIX:*:* | 2430:CLIX:*:*) -	GUESS=clipper-intergraph-clix$UNAME_RELEASE -	;; -    mips:*:*:UMIPS | mips:*:*:RISCos) -	set_cc_for_build -	sed 's/^	//' << EOF > "$dummy.c" -#ifdef __cplusplus -#include <stdio.h>  /* for printf() prototype */ -	int main (int argc, char *argv[]) { -#else -	int main (argc, argv) int argc; char *argv[]; { -#endif -	#if defined (host_mips) && defined (MIPSEB) -	#if defined (SYSTYPE_SYSV) -	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); -	#endif -	#if defined (SYSTYPE_SVR4) -	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); -	#endif -	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) -	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); -	#endif -	#endif -	  exit (-1); -	} -EOF -	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && -	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && -	  SYSTEM_NAME=`"$dummy" "$dummyarg"` && -	    { echo "$SYSTEM_NAME"; exit; } -	GUESS=mips-mips-riscos$UNAME_RELEASE -	;; -    Motorola:PowerMAX_OS:*:*) -	GUESS=powerpc-motorola-powermax -	;; -    Motorola:*:4.3:PL8-*) -	GUESS=powerpc-harris-powermax -	;; -    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) -	GUESS=powerpc-harris-powermax -	;; -    Night_Hawk:Power_UNIX:*:*) -	GUESS=powerpc-harris-powerunix -	;; -    m88k:CX/UX:7*:*) -	GUESS=m88k-harris-cxux7 -	;; -    m88k:*:4*:R4*) -	GUESS=m88k-motorola-sysv4 -	;; -    m88k:*:3*:R3*) -	GUESS=m88k-motorola-sysv3 -	;; -    AViiON:dgux:*:*) -	# DG/UX returns AViiON for all architectures -	UNAME_PROCESSOR=`/usr/bin/uname -p` -	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 -	then -	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ -	       test "$TARGET_BINARY_INTERFACE"x = x -	    then -		GUESS=m88k-dg-dgux$UNAME_RELEASE -	    else -		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE -	    fi -	else -	    GUESS=i586-dg-dgux$UNAME_RELEASE -	fi -	;; -    M88*:DolphinOS:*:*)	# DolphinOS (SVR3) -	GUESS=m88k-dolphin-sysv3 -	;; -    M88*:*:R3*:*) -	# Delta 88k system running SVR3 -	GUESS=m88k-motorola-sysv3 -	;; -    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) -	GUESS=m88k-tektronix-sysv3 -	;; -    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) -	GUESS=m68k-tektronix-bsd -	;; -    *:IRIX*:*:*) -	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` -	GUESS=mips-sgi-irix$IRIX_REL -	;; -    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. -	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id -	;;                    # Note that: echo "'`uname -s`'" gives 'AIX ' -    i*86:AIX:*:*) -	GUESS=i386-ibm-aix -	;; -    ia64:AIX:*:*) -	if test -x /usr/bin/oslevel ; then -		IBM_REV=`/usr/bin/oslevel` -	else -		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE -	fi -	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV -	;; -    *:AIX:2:3) -	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then -		set_cc_for_build -		sed 's/^		//' << EOF > "$dummy.c" -		#include <sys/systemcfg.h> - -		int -		main () -			{ -			if (!__power_pc()) -				exit(1); -			puts("powerpc-ibm-aix3.2.5"); -			exit(0); -			} -EOF -		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` -		then -			GUESS=$SYSTEM_NAME -		else -			GUESS=rs6000-ibm-aix3.2.5 -		fi -	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then -		GUESS=rs6000-ibm-aix3.2.4 -	else -		GUESS=rs6000-ibm-aix3.2 -	fi -	;; -    *:AIX:*:[4567]) -	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` -	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then -		IBM_ARCH=rs6000 -	else -		IBM_ARCH=powerpc -	fi -	if test -x /usr/bin/lslpp ; then -		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ -			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` -	else -		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE -	fi -	GUESS=$IBM_ARCH-ibm-aix$IBM_REV -	;; -    *:AIX:*:*) -	GUESS=rs6000-ibm-aix -	;; -    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) -	GUESS=romp-ibm-bsd4.4 -	;; -    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and -	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to -	;;                                  # report: romp-ibm BSD 4.3 -    *:BOSX:*:*) -	GUESS=rs6000-bull-bosx -	;; -    DPX/2?00:B.O.S.:*:*) -	GUESS=m68k-bull-sysv3 -	;; -    9000/[34]??:4.3bsd:1.*:*) -	GUESS=m68k-hp-bsd -	;; -    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) -	GUESS=m68k-hp-bsd4.4 -	;; -    9000/[34678]??:HP-UX:*:*) -	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` -	case $UNAME_MACHINE in -	    9000/31?)            HP_ARCH=m68000 ;; -	    9000/[34]??)         HP_ARCH=m68k ;; -	    9000/[678][0-9][0-9]) -		if test -x /usr/bin/getconf; then -		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` -		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` -		    case $sc_cpu_version in -		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 -		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 -		      532)                      # CPU_PA_RISC2_0 -			case $sc_kernel_bits in -			  32) HP_ARCH=hppa2.0n ;; -			  64) HP_ARCH=hppa2.0w ;; -			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20 -			esac ;; -		    esac -		fi -		if test "$HP_ARCH" = ""; then -		    set_cc_for_build -		    sed 's/^		//' << EOF > "$dummy.c" - -		#define _HPUX_SOURCE -		#include <stdlib.h> -		#include <unistd.h> - -		int -		main () -		{ -		#if defined(_SC_KERNEL_BITS) -		    long bits = sysconf(_SC_KERNEL_BITS); -		#endif -		    long cpu  = sysconf (_SC_CPU_VERSION); - -		    switch (cpu) -			{ -			case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -			case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -			case CPU_PA_RISC2_0: -		#if defined(_SC_KERNEL_BITS) -			    switch (bits) -				{ -				case 64: puts ("hppa2.0w"); break; -				case 32: puts ("hppa2.0n"); break; -				default: puts ("hppa2.0"); break; -				} break; -		#else  /* !defined(_SC_KERNEL_BITS) */ -			    puts ("hppa2.0"); break; -		#endif -			default: puts ("hppa1.0"); break; -			} -		    exit (0); -		} -EOF -		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` -		    test -z "$HP_ARCH" && HP_ARCH=hppa -		fi ;; -	esac -	if test "$HP_ARCH" = hppa2.0w -	then -	    set_cc_for_build - -	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating -	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler -	    # generating 64-bit code.  GNU and HP use different nomenclature: -	    # -	    # $ CC_FOR_BUILD=cc ./config.guess -	    # => hppa2.0w-hp-hpux11.23 -	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess -	    # => hppa64-hp-hpux11.23 - -	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | -		grep -q __LP64__ -	    then -		HP_ARCH=hppa2.0w -	    else -		HP_ARCH=hppa64 -	    fi -	fi -	GUESS=$HP_ARCH-hp-hpux$HPUX_REV -	;; -    ia64:HP-UX:*:*) -	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` -	GUESS=ia64-hp-hpux$HPUX_REV -	;; -    3050*:HI-UX:*:*) -	set_cc_for_build -	sed 's/^	//' << EOF > "$dummy.c" -	#include <unistd.h> -	int -	main () -	{ -	  long cpu = sysconf (_SC_CPU_VERSION); -	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns -	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct -	     results, however.  */ -	  if (CPU_IS_PA_RISC (cpu)) -	    { -	      switch (cpu) -		{ -		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; -		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; -		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; -		  default: puts ("hppa-hitachi-hiuxwe2"); break; -		} -	    } -	  else if (CPU_IS_HP_MC68K (cpu)) -	    puts ("m68k-hitachi-hiuxwe2"); -	  else puts ("unknown-hitachi-hiuxwe2"); -	  exit (0); -	} -EOF -	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && -		{ echo "$SYSTEM_NAME"; exit; } -	GUESS=unknown-hitachi-hiuxwe2 -	;; -    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) -	GUESS=hppa1.1-hp-bsd -	;; -    9000/8??:4.3bsd:*:*) -	GUESS=hppa1.0-hp-bsd -	;; -    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) -	GUESS=hppa1.0-hp-mpeix -	;; -    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) -	GUESS=hppa1.1-hp-osf -	;; -    hp8??:OSF1:*:*) -	GUESS=hppa1.0-hp-osf -	;; -    i*86:OSF1:*:*) -	if test -x /usr/sbin/sysversion ; then -	    GUESS=$UNAME_MACHINE-unknown-osf1mk -	else -	    GUESS=$UNAME_MACHINE-unknown-osf1 -	fi -	;; -    parisc*:Lites*:*:*) -	GUESS=hppa1.1-hp-lites -	;; -    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) -	GUESS=c1-convex-bsd -	;; -    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) -	if getsysinfo -f scalar_acc -	then echo c32-convex-bsd -	else echo c2-convex-bsd -	fi -	exit ;; -    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) -	GUESS=c34-convex-bsd -	;; -    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) -	GUESS=c38-convex-bsd -	;; -    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) -	GUESS=c4-convex-bsd -	;; -    CRAY*Y-MP:*:*:*) -	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` -	GUESS=ymp-cray-unicos$CRAY_REL -	;; -    CRAY*[A-Z]90:*:*:*) -	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ -	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -	      -e 's/\.[^.]*$/.X/' -	exit ;; -    CRAY*TS:*:*:*) -	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` -	GUESS=t90-cray-unicos$CRAY_REL -	;; -    CRAY*T3E:*:*:*) -	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` -	GUESS=alphaev5-cray-unicosmk$CRAY_REL -	;; -    CRAY*SV1:*:*:*) -	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` -	GUESS=sv1-cray-unicos$CRAY_REL -	;; -    *:UNICOS/mp:*:*) -	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` -	GUESS=craynv-cray-unicosmp$CRAY_REL -	;; -    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) -	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` -	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` -	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` -	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} -	;; -    5000:UNIX_System_V:4.*:*) -	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` -	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` -	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} -	;; -    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) -	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE -	;; -    sparc*:BSD/OS:*:*) -	GUESS=sparc-unknown-bsdi$UNAME_RELEASE -	;; -    *:BSD/OS:*:*) -	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE -	;; -    arm:FreeBSD:*:*) -	UNAME_PROCESSOR=`uname -p` -	set_cc_for_build -	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ -	    | grep -q __ARM_PCS_VFP -	then -	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` -	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi -	else -	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` -	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf -	fi -	;; -    *:FreeBSD:*:*) -	UNAME_PROCESSOR=`uname -p` -	case $UNAME_PROCESSOR in -	    amd64) -		UNAME_PROCESSOR=x86_64 ;; -	    i386) -		UNAME_PROCESSOR=i586 ;; -	esac -	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` -	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL -	;; -    i*:CYGWIN*:*) -	GUESS=$UNAME_MACHINE-pc-cygwin -	;; -    *:MINGW64*:*) -	GUESS=$UNAME_MACHINE-pc-mingw64 -	;; -    *:MINGW*:*) -	GUESS=$UNAME_MACHINE-pc-mingw32 -	;; -    *:MSYS*:*) -	GUESS=$UNAME_MACHINE-pc-msys -	;; -    i*:PW*:*) -	GUESS=$UNAME_MACHINE-pc-pw32 -	;; -    *:SerenityOS:*:*) -        GUESS=$UNAME_MACHINE-pc-serenity -        ;; -    *:Interix*:*) -	case $UNAME_MACHINE in -	    x86) -		GUESS=i586-pc-interix$UNAME_RELEASE -		;; -	    authenticamd | genuineintel | EM64T) -		GUESS=x86_64-unknown-interix$UNAME_RELEASE -		;; -	    IA64) -		GUESS=ia64-unknown-interix$UNAME_RELEASE -		;; -	esac ;; -    i*:UWIN*:*) -	GUESS=$UNAME_MACHINE-pc-uwin -	;; -    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) -	GUESS=x86_64-pc-cygwin -	;; -    prep*:SunOS:5.*:*) -	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` -	GUESS=powerpcle-unknown-solaris2$SUN_REL -	;; -    *:GNU:*:*) -	# the GNU system -	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` -	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` -	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL -	;; -    *:GNU/*:*:*) -	# other systems with GNU libc and userland -	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` -	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` -	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC -	;; -    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) -	GUESS="$UNAME_MACHINE-pc-managarm-mlibc" -	;; -    *:[Mm]anagarm:*:*) -	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" -	;; -    *:Minix:*:*) -	GUESS=$UNAME_MACHINE-unknown-minix -	;; -    aarch64:Linux:*:*) -	set_cc_for_build -	CPU=$UNAME_MACHINE -	LIBCABI=$LIBC -	if test "$CC_FOR_BUILD" != no_compiler_found; then -	    ABI=64 -	    sed 's/^	    //' << EOF > "$dummy.c" -	    #ifdef __ARM_EABI__ -	    #ifdef __ARM_PCS_VFP -	    ABI=eabihf -	    #else -	    ABI=eabi -	    #endif -	    #endif -EOF -	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` -	    eval "$cc_set_abi" -	    case $ABI in -		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; -	    esac -	fi -	GUESS=$CPU-unknown-linux-$LIBCABI -	;; -    aarch64_be:Linux:*:*) -	UNAME_MACHINE=aarch64_be -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    alpha:Linux:*:*) -	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in -	  EV5)   UNAME_MACHINE=alphaev5 ;; -	  EV56)  UNAME_MACHINE=alphaev56 ;; -	  PCA56) UNAME_MACHINE=alphapca56 ;; -	  PCA57) UNAME_MACHINE=alphapca56 ;; -	  EV6)   UNAME_MACHINE=alphaev6 ;; -	  EV67)  UNAME_MACHINE=alphaev67 ;; -	  EV68*) UNAME_MACHINE=alphaev68 ;; -	esac -	objdump --private-headers /bin/sh | grep -q ld.so.1 -	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    arm*:Linux:*:*) -	set_cc_for_build -	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ -	    | grep -q __ARM_EABI__ -	then -	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	else -	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ -		| grep -q __ARM_PCS_VFP -	    then -		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi -	    else -		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf -	    fi -	fi -	;; -    avr32*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    cris:Linux:*:*) -	GUESS=$UNAME_MACHINE-axis-linux-$LIBC -	;; -    crisv32:Linux:*:*) -	GUESS=$UNAME_MACHINE-axis-linux-$LIBC -	;; -    e2k:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    frv:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    hexagon:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    i*86:Linux:*:*) -	GUESS=$UNAME_MACHINE-pc-linux-$LIBC -	;; -    ia64:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    k1om:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    kvx:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    kvx:cos:*:*) -	GUESS=$UNAME_MACHINE-unknown-cos -	;; -    kvx:mbr:*:*) -	GUESS=$UNAME_MACHINE-unknown-mbr -	;; -    loongarch32:Linux:*:* | loongarch64:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    m32r*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    m68*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    mips:Linux:*:* | mips64:Linux:*:*) -	set_cc_for_build -	IS_GLIBC=0 -	test x"${LIBC}" = xgnu && IS_GLIBC=1 -	sed 's/^	//' << EOF > "$dummy.c" -	#undef CPU -	#undef mips -	#undef mipsel -	#undef mips64 -	#undef mips64el -	#if ${IS_GLIBC} && defined(_ABI64) -	LIBCABI=gnuabi64 -	#else -	#if ${IS_GLIBC} && defined(_ABIN32) -	LIBCABI=gnuabin32 -	#else -	LIBCABI=${LIBC} -	#endif -	#endif - -	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 -	CPU=mipsisa64r6 -	#else -	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 -	CPU=mipsisa32r6 -	#else -	#if defined(__mips64) -	CPU=mips64 -	#else -	CPU=mips -	#endif -	#endif -	#endif - -	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) -	MIPS_ENDIAN=el -	#else -	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) -	MIPS_ENDIAN= -	#else -	MIPS_ENDIAN= -	#endif -	#endif -EOF -	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` -	eval "$cc_set_vars" -	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } -	;; -    mips64el:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    openrisc*:Linux:*:*) -	GUESS=or1k-unknown-linux-$LIBC -	;; -    or32:Linux:*:* | or1k*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    padre:Linux:*:*) -	GUESS=sparc-unknown-linux-$LIBC -	;; -    parisc64:Linux:*:* | hppa64:Linux:*:*) -	GUESS=hppa64-unknown-linux-$LIBC -	;; -    parisc:Linux:*:* | hppa:Linux:*:*) -	# Look for CPU level -	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; -	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; -	  *)    GUESS=hppa-unknown-linux-$LIBC ;; -	esac -	;; -    ppc64:Linux:*:*) -	GUESS=powerpc64-unknown-linux-$LIBC -	;; -    ppc:Linux:*:*) -	GUESS=powerpc-unknown-linux-$LIBC -	;; -    ppc64le:Linux:*:*) -	GUESS=powerpc64le-unknown-linux-$LIBC -	;; -    ppcle:Linux:*:*) -	GUESS=powerpcle-unknown-linux-$LIBC -	;; -    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    s390:Linux:*:* | s390x:Linux:*:*) -	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC -	;; -    sh64*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    sh*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    sparc:Linux:*:* | sparc64:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    tile*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    vax:Linux:*:*) -	GUESS=$UNAME_MACHINE-dec-linux-$LIBC -	;; -    x86_64:Linux:*:*) -	set_cc_for_build -	CPU=$UNAME_MACHINE -	LIBCABI=$LIBC -	if test "$CC_FOR_BUILD" != no_compiler_found; then -	    ABI=64 -	    sed 's/^	    //' << EOF > "$dummy.c" -	    #ifdef __i386__ -	    ABI=x86 -	    #else -	    #ifdef __ILP32__ -	    ABI=x32 -	    #endif -	    #endif -EOF -	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` -	    eval "$cc_set_abi" -	    case $ABI in -		x86) CPU=i686 ;; -		x32) LIBCABI=${LIBC}x32 ;; -	    esac -	fi -	GUESS=$CPU-pc-linux-$LIBCABI -	;; -    xtensa*:Linux:*:*) -	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC -	;; -    i*86:DYNIX/ptx:4*:*) -	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. -	# earlier versions are messed up and put the nodename in both -	# sysname and nodename. -	GUESS=i386-sequent-sysv4 -	;; -    i*86:UNIX_SV:4.2MP:2.*) -	# Unixware is an offshoot of SVR4, but it has its own version -	# number series starting with 2... -	# I am not positive that other SVR4 systems won't match this, -	# I just have to hope.  -- rms. -	# Use sysv4.2uw... so that sysv4* matches it. -	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION -	;; -    i*86:OS/2:*:*) -	# If we were able to find 'uname', then EMX Unix compatibility -	# is probably installed. -	GUESS=$UNAME_MACHINE-pc-os2-emx -	;; -    i*86:XTS-300:*:STOP) -	GUESS=$UNAME_MACHINE-unknown-stop -	;; -    i*86:atheos:*:*) -	GUESS=$UNAME_MACHINE-unknown-atheos -	;; -    i*86:syllable:*:*) -	GUESS=$UNAME_MACHINE-pc-syllable -	;; -    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) -	GUESS=i386-unknown-lynxos$UNAME_RELEASE -	;; -    i*86:*DOS:*:*) -	GUESS=$UNAME_MACHINE-pc-msdosdjgpp -	;; -    i*86:*:4.*:*) -	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` -	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then -		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL -	else -		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL -	fi -	;; -    i*86:*:5:[678]*) -	# UnixWare 7.x, OpenUNIX and OpenServer 6. -	case `/bin/uname -X | grep "^Machine"` in -	    *486*)	     UNAME_MACHINE=i486 ;; -	    *Pentium)	     UNAME_MACHINE=i586 ;; -	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;; -	esac -	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} -	;; -    i*86:*:3.2:*) -	if test -f /usr/options/cb.name; then -		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` -		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL -	elif /bin/uname -X 2>/dev/null >/dev/null ; then -		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` -		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 -		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ -			&& UNAME_MACHINE=i586 -		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ -			&& UNAME_MACHINE=i686 -		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ -			&& UNAME_MACHINE=i686 -		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL -	else -		GUESS=$UNAME_MACHINE-pc-sysv32 -	fi -	;; -    pc:*:*:*) -	# Left here for compatibility: -	# uname -m prints for DJGPP always 'pc', but it prints nothing about -	# the processor, so we play safe by assuming i586. -	# Note: whatever this is, it MUST be the same as what config.sub -	# prints for the "djgpp" host, or else GDB configure will decide that -	# this is a cross-build. -	GUESS=i586-pc-msdosdjgpp -	;; -    Intel:Mach:3*:*) -	GUESS=i386-pc-mach3 -	;; -    paragon:*:*:*) -	GUESS=i860-intel-osf1 -	;; -    i860:*:4.*:*) # i860-SVR4 -	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then -	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4 -	else # Add other i860-SVR4 vendors below as they are discovered. -	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4 -	fi -	;; -    mini*:CTIX:SYS*5:*) -	# "miniframe" -	GUESS=m68010-convergent-sysv -	;; -    mc68k:UNIX:SYSTEM5:3.51m) -	GUESS=m68k-convergent-sysv -	;; -    M680?0:D-NIX:5.3:*) -	GUESS=m68k-diab-dnix -	;; -    M68*:*:R3V[5678]*:*) -	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; -    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) -	OS_REL='' -	test -r /etc/.relid \ -	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` -	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } -	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; -    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) -	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -	  && { echo i486-ncr-sysv4; exit; } ;; -    NCR*:*:4.2:* | MPRAS*:*:4.2:*) -	OS_REL='.3' -	test -r /etc/.relid \ -	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` -	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } -	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } -	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ -	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; -    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) -	GUESS=m68k-unknown-lynxos$UNAME_RELEASE -	;; -    mc68030:UNIX_System_V:4.*:*) -	GUESS=m68k-atari-sysv4 -	;; -    TSUNAMI:LynxOS:2.*:*) -	GUESS=sparc-unknown-lynxos$UNAME_RELEASE -	;; -    rs6000:LynxOS:2.*:*) -	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE -	;; -    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) -	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE -	;; -    SM[BE]S:UNIX_SV:*:*) -	GUESS=mips-dde-sysv$UNAME_RELEASE -	;; -    RM*:ReliantUNIX-*:*:*) -	GUESS=mips-sni-sysv4 -	;; -    RM*:SINIX-*:*:*) -	GUESS=mips-sni-sysv4 -	;; -    *:SINIX-*:*:*) -	if uname -p 2>/dev/null >/dev/null ; then -		UNAME_MACHINE=`(uname -p) 2>/dev/null` -		GUESS=$UNAME_MACHINE-sni-sysv4 -	else -		GUESS=ns32k-sni-sysv -	fi -	;; -    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort -			# says <Richard.M.Bartel@ccMail.Census.GOV> -	GUESS=i586-unisys-sysv4 -	;; -    *:UNIX_System_V:4*:FTX*) -	# From Gerald Hewes <hewes@openmarket.com>. -	# How about differentiating between stratus architectures? -djm -	GUESS=hppa1.1-stratus-sysv4 -	;; -    *:*:*:FTX*) -	# From seanf@swdc.stratus.com. -	GUESS=i860-stratus-sysv4 -	;; -    i*86:VOS:*:*) -	# From Paul.Green@stratus.com. -	GUESS=$UNAME_MACHINE-stratus-vos -	;; -    *:VOS:*:*) -	# From Paul.Green@stratus.com. -	GUESS=hppa1.1-stratus-vos -	;; -    mc68*:A/UX:*:*) -	GUESS=m68k-apple-aux$UNAME_RELEASE -	;; -    news*:NEWS-OS:6*:*) -	GUESS=mips-sony-newsos6 -	;; -    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) -	if test -d /usr/nec; then -		GUESS=mips-nec-sysv$UNAME_RELEASE -	else -		GUESS=mips-unknown-sysv$UNAME_RELEASE -	fi -	;; -    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only. -	GUESS=powerpc-be-beos -	;; -    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only. -	GUESS=powerpc-apple-beos -	;; -    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible. -	GUESS=i586-pc-beos -	;; -    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible. -	GUESS=i586-pc-haiku -	;; -    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC -	GUESS=powerpc-apple-haiku -	;; -    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat) -	GUESS=$UNAME_MACHINE-unknown-haiku -	;; -    SX-4:SUPER-UX:*:*) -	GUESS=sx4-nec-superux$UNAME_RELEASE -	;; -    SX-5:SUPER-UX:*:*) -	GUESS=sx5-nec-superux$UNAME_RELEASE -	;; -    SX-6:SUPER-UX:*:*) -	GUESS=sx6-nec-superux$UNAME_RELEASE -	;; -    SX-7:SUPER-UX:*:*) -	GUESS=sx7-nec-superux$UNAME_RELEASE -	;; -    SX-8:SUPER-UX:*:*) -	GUESS=sx8-nec-superux$UNAME_RELEASE -	;; -    SX-8R:SUPER-UX:*:*) -	GUESS=sx8r-nec-superux$UNAME_RELEASE -	;; -    SX-ACE:SUPER-UX:*:*) -	GUESS=sxace-nec-superux$UNAME_RELEASE -	;; -    Power*:Rhapsody:*:*) -	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE -	;; -    *:Rhapsody:*:*) -	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE -	;; -    arm64:Darwin:*:*) -	GUESS=aarch64-apple-darwin$UNAME_RELEASE -	;; -    *:Darwin:*:*) -	UNAME_PROCESSOR=`uname -p` -	case $UNAME_PROCESSOR in -	    unknown) UNAME_PROCESSOR=powerpc ;; -	esac -	if command -v xcode-select > /dev/null 2> /dev/null && \ -		! xcode-select --print-path > /dev/null 2> /dev/null ; then -	    # Avoid executing cc if there is no toolchain installed as -	    # cc will be a stub that puts up a graphical alert -	    # prompting the user to install developer tools. -	    CC_FOR_BUILD=no_compiler_found -	else -	    set_cc_for_build -	fi -	if test "$CC_FOR_BUILD" != no_compiler_found; then -	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ -		   grep IS_64BIT_ARCH >/dev/null -	    then -		case $UNAME_PROCESSOR in -		    i386) UNAME_PROCESSOR=x86_64 ;; -		    powerpc) UNAME_PROCESSOR=powerpc64 ;; -		esac -	    fi -	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc -	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ -		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ -		   grep IS_PPC >/dev/null -	    then -		UNAME_PROCESSOR=powerpc -	    fi -	elif test "$UNAME_PROCESSOR" = i386 ; then -	    # uname -m returns i386 or x86_64 -	    UNAME_PROCESSOR=$UNAME_MACHINE -	fi -	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE -	;; -    *:procnto*:*:* | *:QNX:[0123456789]*:*) -	UNAME_PROCESSOR=`uname -p` -	if test "$UNAME_PROCESSOR" = x86; then -		UNAME_PROCESSOR=i386 -		UNAME_MACHINE=pc -	fi -	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE -	;; -    *:QNX:*:4*) -	GUESS=i386-pc-qnx -	;; -    NEO-*:NONSTOP_KERNEL:*:*) -	GUESS=neo-tandem-nsk$UNAME_RELEASE -	;; -    NSE-*:NONSTOP_KERNEL:*:*) -	GUESS=nse-tandem-nsk$UNAME_RELEASE -	;; -    NSR-*:NONSTOP_KERNEL:*:*) -	GUESS=nsr-tandem-nsk$UNAME_RELEASE -	;; -    NSV-*:NONSTOP_KERNEL:*:*) -	GUESS=nsv-tandem-nsk$UNAME_RELEASE -	;; -    NSX-*:NONSTOP_KERNEL:*:*) -	GUESS=nsx-tandem-nsk$UNAME_RELEASE -	;; -    *:NonStop-UX:*:*) -	GUESS=mips-compaq-nonstopux -	;; -    BS2000:POSIX*:*:*) -	GUESS=bs2000-siemens-sysv -	;; -    DS/*:UNIX_System_V:*:*) -	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE -	;; -    *:Plan9:*:*) -	# "uname -m" is not consistent, so use $cputype instead. 386 -	# is converted to i386 for consistency with other x86 -	# operating systems. -	if test "${cputype-}" = 386; then -	    UNAME_MACHINE=i386 -	elif test "x${cputype-}" != x; then -	    UNAME_MACHINE=$cputype -	fi -	GUESS=$UNAME_MACHINE-unknown-plan9 -	;; -    *:TOPS-10:*:*) -	GUESS=pdp10-unknown-tops10 -	;; -    *:TENEX:*:*) -	GUESS=pdp10-unknown-tenex -	;; -    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) -	GUESS=pdp10-dec-tops20 -	;; -    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) -	GUESS=pdp10-xkl-tops20 -	;; -    *:TOPS-20:*:*) -	GUESS=pdp10-unknown-tops20 -	;; -    *:ITS:*:*) -	GUESS=pdp10-unknown-its -	;; -    SEI:*:*:SEIUX) -	GUESS=mips-sei-seiux$UNAME_RELEASE -	;; -    *:DragonFly:*:*) -	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` -	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL -	;; -    *:*VMS:*:*) -	UNAME_MACHINE=`(uname -p) 2>/dev/null` -	case $UNAME_MACHINE in -	    A*) GUESS=alpha-dec-vms ;; -	    I*) GUESS=ia64-dec-vms ;; -	    V*) GUESS=vax-dec-vms ;; -	esac ;; -    *:XENIX:*:SysV) -	GUESS=i386-pc-xenix -	;; -    i*86:skyos:*:*) -	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` -	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL -	;; -    i*86:rdos:*:*) -	GUESS=$UNAME_MACHINE-pc-rdos -	;; -    i*86:Fiwix:*:*) -	GUESS=$UNAME_MACHINE-pc-fiwix -	;; -    *:AROS:*:*) -	GUESS=$UNAME_MACHINE-unknown-aros -	;; -    x86_64:VMkernel:*:*) -	GUESS=$UNAME_MACHINE-unknown-esx -	;; -    amd64:Isilon\ OneFS:*:*) -	GUESS=x86_64-unknown-onefs -	;; -    *:Unleashed:*:*) -	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE -	;; -    *:Ironclad:*:*) -	GUESS=$UNAME_MACHINE-unknown-ironclad -	;; -esac - -# Do we have a guess based on uname results? -if test "x$GUESS" != x; then -    echo "$GUESS" -    exit -fi - -# No uname command or uname output not recognized. -set_cc_for_build -cat > "$dummy.c" <<EOF -#ifdef _SEQUENT_ -#include <sys/types.h> -#include <sys/utsname.h> -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#include <signal.h> -#if defined(_SIZE_T_) || defined(SIGLOST) -#include <sys/utsname.h> -#endif -#endif -#endif -int -main () -{ -#if defined (sony) -#if defined (MIPSEB) -  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed, -     I don't know....  */ -  printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> -  printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 -  "4" -#else -  "" -#endif -  ); exit (0); -#endif -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif -  int version; -  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; -  if (version < 4) -    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); -  else -    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); -  exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) -  printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) -  printf ("ns32k-encore-mach\n"); exit (0); -#else -  printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) -  printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) -  printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) -  printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) -  struct utsname un; - -  uname(&un); -  if (strncmp(un.version, "V2", 2) == 0) { -    printf ("i386-sequent-ptx2\n"); exit (0); -  } -  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ -    printf ("i386-sequent-ptx1\n"); exit (0); -  } -  printf ("i386-sequent-ptx\n"); exit (0); -#endif - -#if defined (vax) -#if !defined (ultrix) -#include <sys/param.h> -#if defined (BSD) -#if BSD == 43 -  printf ("vax-dec-bsd4.3\n"); exit (0); -#else -#if BSD == 199006 -  printf ("vax-dec-bsd4.3reno\n"); exit (0); -#else -  printf ("vax-dec-bsd\n"); exit (0); -#endif -#endif -#else -  printf ("vax-dec-bsd\n"); exit (0); -#endif -#else -#if defined(_SIZE_T_) || defined(SIGLOST) -  struct utsname un; -  uname (&un); -  printf ("vax-dec-ultrix%s\n", un.release); exit (0); -#else -  printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#if defined(_SIZE_T_) || defined(SIGLOST) -  struct utsname *un; -  uname (&un); -  printf ("mips-dec-ultrix%s\n", un.release); exit (0); -#else -  printf ("mips-dec-ultrix\n"); exit (0); -#endif -#endif -#endif - -#if defined (alliant) && defined (i860) -  printf ("i860-alliant-bsd\n"); exit (0); -#endif - -  exit (1); -} -EOF - -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && -	{ echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. -test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } - -echo "$0: unable to guess system type" >&2 - -case $UNAME_MACHINE:$UNAME_SYSTEM in -    mips:Linux | mips64:Linux) -	# If we got here on MIPS GNU/Linux, output extra information. -	cat >&2 <<EOF - -NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize -the system type. Please install a C compiler and try again. -EOF -	;; -esac - -cat >&2 <<EOF - -This script (version $timestamp), has failed to recognize the -operating system you are using. If your script is old, overwrite *all* -copies of config.guess and config.sub with the latest versions from: - -  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess -and -  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub -EOF - -our_year=`echo $timestamp | sed 's,-.*,,'` -thisyear=`date +%Y` -# shellcheck disable=SC2003 -script_age=`expr "$thisyear" - "$our_year"` -if test "$script_age" -lt 3 ; then -   cat >&2 <<EOF - -If $0 has already been updated, send the following data and any -information you think might be pertinent to config-patches@gnu.org to -provide the necessary information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X     = `(/bin/uname -X) 2>/dev/null` - -hostinfo               = `(hostinfo) 2>/dev/null` -/bin/universe          = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch              = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM  = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" -EOF -fi - -exit 1 - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.sub b/config.sub deleted file mode 100755 index 4aaae46..0000000 --- a/config.sub +++ /dev/null @@ -1,2354 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -#   Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale - -timestamp='2024-05-27' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <https://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program.  This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to <config-patches@gnu.org>. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support.  The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX.  However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: -  -h, --help         print this help, then exit -  -t, --time-stamp   print date of last modification, then exit -  -v, --version      print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions.  There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do -  case $1 in -    --time-stamp | --time* | -t ) -       echo "$timestamp" ; exit ;; -    --version | -v ) -       echo "$version" ; exit ;; -    --help | --h* | -h ) -       echo "$usage"; exit ;; -    -- )     # Stop option processing -       shift; break ;; -    - )	# Use stdin as input. -       break ;; -    -* ) -       echo "$me: invalid option $1$help" >&2 -       exit 1 ;; - -    *local*) -       # First pass through any local machine types. -       echo "$1" -       exit ;; - -    * ) -       break ;; -  esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 -    exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 -    exit 1;; -esac - -# Split fields of configuration type -saved_IFS=$IFS -IFS="-" read field1 field2 field3 field4 <<EOF -$1 -EOF -IFS=$saved_IFS - -# Separate into logical components for further validation -case $1 in -	*-*-*-*-*) -		echo "Invalid configuration '$1': more than four components" >&2 -		exit 1 -		;; -	*-*-*-*) -		basic_machine=$field1-$field2 -		basic_os=$field3-$field4 -		;; -	*-*-*) -		# Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two -		# parts -		maybe_os=$field2-$field3 -		case $maybe_os in -			  cloudabi*-eabi* \ -			| kfreebsd*-gnu* \ -			| knetbsd*-gnu* \ -			| kopensolaris*-gnu* \ -			| linux-* \ -			| managarm-* \ -			| netbsd*-eabi* \ -			| netbsd*-gnu* \ -			| nto-qnx* \ -			| os2-emx* \ -			| rtmk-nova* \ -			| storm-chaos* \ -			| uclinux-gnu* \ -			| uclinux-uclibc* \ -			| windows-* ) -				basic_machine=$field1 -				basic_os=$maybe_os -				;; -			android-linux) -				basic_machine=$field1-unknown -				basic_os=linux-android -				;; -			*) -				basic_machine=$field1-$field2 -				basic_os=$field3 -				;; -		esac -		;; -	*-*) -		case $field1-$field2 in -			# Shorthands that happen to contain a single dash -			convex-c[12] | convex-c3[248]) -				basic_machine=$field2-convex -				basic_os= -				;; -			decstation-3100) -				basic_machine=mips-dec -				basic_os= -				;; -			*-*) -				# Second component is usually, but not always the OS -				case $field2 in -					# Do not treat sunos as a manufacturer -					sun*os*) -						basic_machine=$field1 -						basic_os=$field2 -						;; -					# Manufacturers -					  3100* \ -					| 32* \ -					| 3300* \ -					| 3600* \ -					| 7300* \ -					| acorn \ -					| altos* \ -					| apollo \ -					| apple \ -					| atari \ -					| att* \ -					| axis \ -					| be \ -					| bull \ -					| cbm \ -					| ccur \ -					| cisco \ -					| commodore \ -					| convergent* \ -					| convex* \ -					| cray \ -					| crds \ -					| dec* \ -					| delta* \ -					| dg \ -					| digital \ -					| dolphin \ -					| encore* \ -					| gould \ -					| harris \ -					| highlevel \ -					| hitachi* \ -					| hp \ -					| ibm* \ -					| intergraph \ -					| isi* \ -					| knuth \ -					| masscomp \ -					| microblaze* \ -					| mips* \ -					| motorola* \ -					| ncr* \ -					| news \ -					| next \ -					| ns \ -					| oki \ -					| omron* \ -					| pc533* \ -					| rebel \ -					| rom68k \ -					| rombug \ -					| semi \ -					| sequent* \ -					| siemens \ -					| sgi* \ -					| siemens \ -					| sim \ -					| sni \ -					| sony* \ -					| stratus \ -					| sun \ -					| sun[234]* \ -					| tektronix \ -					| tti* \ -					| ultra \ -					| unicom* \ -					| wec \ -					| winbond \ -					| wrs) -						basic_machine=$field1-$field2 -						basic_os= -						;; -					zephyr*) -						basic_machine=$field1-unknown -						basic_os=$field2 -						;; -					*) -						basic_machine=$field1 -						basic_os=$field2 -						;; -				esac -			;; -		esac -		;; -	*) -		# Convert single-component short-hands not valid as part of -		# multi-component configurations. -		case $field1 in -			386bsd) -				basic_machine=i386-pc -				basic_os=bsd -				;; -			a29khif) -				basic_machine=a29k-amd -				basic_os=udi -				;; -			adobe68k) -				basic_machine=m68010-adobe -				basic_os=scout -				;; -			alliant) -				basic_machine=fx80-alliant -				basic_os= -				;; -			altos | altos3068) -				basic_machine=m68k-altos -				basic_os= -				;; -			am29k) -				basic_machine=a29k-none -				basic_os=bsd -				;; -			amdahl) -				basic_machine=580-amdahl -				basic_os=sysv -				;; -			amiga) -				basic_machine=m68k-unknown -				basic_os= -				;; -			amigaos | amigados) -				basic_machine=m68k-unknown -				basic_os=amigaos -				;; -			amigaunix | amix) -				basic_machine=m68k-unknown -				basic_os=sysv4 -				;; -			apollo68) -				basic_machine=m68k-apollo -				basic_os=sysv -				;; -			apollo68bsd) -				basic_machine=m68k-apollo -				basic_os=bsd -				;; -			aros) -				basic_machine=i386-pc -				basic_os=aros -				;; -			aux) -				basic_machine=m68k-apple -				basic_os=aux -				;; -			balance) -				basic_machine=ns32k-sequent -				basic_os=dynix -				;; -			blackfin) -				basic_machine=bfin-unknown -				basic_os=linux -				;; -			cegcc) -				basic_machine=arm-unknown -				basic_os=cegcc -				;; -			cray) -				basic_machine=j90-cray -				basic_os=unicos -				;; -			crds | unos) -				basic_machine=m68k-crds -				basic_os= -				;; -			da30) -				basic_machine=m68k-da30 -				basic_os= -				;; -			decstation | pmax | pmin | dec3100 | decstatn) -				basic_machine=mips-dec -				basic_os= -				;; -			delta88) -				basic_machine=m88k-motorola -				basic_os=sysv3 -				;; -			dicos) -				basic_machine=i686-pc -				basic_os=dicos -				;; -			djgpp) -				basic_machine=i586-pc -				basic_os=msdosdjgpp -				;; -			ebmon29k) -				basic_machine=a29k-amd -				basic_os=ebmon -				;; -			es1800 | OSE68k | ose68k | ose | OSE) -				basic_machine=m68k-ericsson -				basic_os=ose -				;; -			gmicro) -				basic_machine=tron-gmicro -				basic_os=sysv -				;; -			go32) -				basic_machine=i386-pc -				basic_os=go32 -				;; -			h8300hms) -				basic_machine=h8300-hitachi -				basic_os=hms -				;; -			h8300xray) -				basic_machine=h8300-hitachi -				basic_os=xray -				;; -			h8500hms) -				basic_machine=h8500-hitachi -				basic_os=hms -				;; -			harris) -				basic_machine=m88k-harris -				basic_os=sysv3 -				;; -			hp300 | hp300hpux) -				basic_machine=m68k-hp -				basic_os=hpux -				;; -			hp300bsd) -				basic_machine=m68k-hp -				basic_os=bsd -				;; -			hppaosf) -				basic_machine=hppa1.1-hp -				basic_os=osf -				;; -			hppro) -				basic_machine=hppa1.1-hp -				basic_os=proelf -				;; -			i386mach) -				basic_machine=i386-mach -				basic_os=mach -				;; -			isi68 | isi) -				basic_machine=m68k-isi -				basic_os=sysv -				;; -			m68knommu) -				basic_machine=m68k-unknown -				basic_os=linux -				;; -			magnum | m3230) -				basic_machine=mips-mips -				basic_os=sysv -				;; -			merlin) -				basic_machine=ns32k-utek -				basic_os=sysv -				;; -			mingw64) -				basic_machine=x86_64-pc -				basic_os=mingw64 -				;; -			mingw32) -				basic_machine=i686-pc -				basic_os=mingw32 -				;; -			mingw32ce) -				basic_machine=arm-unknown -				basic_os=mingw32ce -				;; -			monitor) -				basic_machine=m68k-rom68k -				basic_os=coff -				;; -			morphos) -				basic_machine=powerpc-unknown -				basic_os=morphos -				;; -			moxiebox) -				basic_machine=moxie-unknown -				basic_os=moxiebox -				;; -			msdos) -				basic_machine=i386-pc -				basic_os=msdos -				;; -			msys) -				basic_machine=i686-pc -				basic_os=msys -				;; -			mvs) -				basic_machine=i370-ibm -				basic_os=mvs -				;; -			nacl) -				basic_machine=le32-unknown -				basic_os=nacl -				;; -			ncr3000) -				basic_machine=i486-ncr -				basic_os=sysv4 -				;; -			netbsd386) -				basic_machine=i386-pc -				basic_os=netbsd -				;; -			netwinder) -				basic_machine=armv4l-rebel -				basic_os=linux -				;; -			news | news700 | news800 | news900) -				basic_machine=m68k-sony -				basic_os=newsos -				;; -			news1000) -				basic_machine=m68030-sony -				basic_os=newsos -				;; -			necv70) -				basic_machine=v70-nec -				basic_os=sysv -				;; -			nh3000) -				basic_machine=m68k-harris -				basic_os=cxux -				;; -			nh[45]000) -				basic_machine=m88k-harris -				basic_os=cxux -				;; -			nindy960) -				basic_machine=i960-intel -				basic_os=nindy -				;; -			mon960) -				basic_machine=i960-intel -				basic_os=mon960 -				;; -			nonstopux) -				basic_machine=mips-compaq -				basic_os=nonstopux -				;; -			os400) -				basic_machine=powerpc-ibm -				basic_os=os400 -				;; -			OSE68000 | ose68000) -				basic_machine=m68000-ericsson -				basic_os=ose -				;; -			os68k) -				basic_machine=m68k-none -				basic_os=os68k -				;; -			paragon) -				basic_machine=i860-intel -				basic_os=osf -				;; -			parisc) -				basic_machine=hppa-unknown -				basic_os=linux -				;; -			psp) -				basic_machine=mipsallegrexel-sony -				basic_os=psp -				;; -			pw32) -				basic_machine=i586-unknown -				basic_os=pw32 -				;; -			rdos | rdos64) -				basic_machine=x86_64-pc -				basic_os=rdos -				;; -			rdos32) -				basic_machine=i386-pc -				basic_os=rdos -				;; -			rom68k) -				basic_machine=m68k-rom68k -				basic_os=coff -				;; -			sa29200) -				basic_machine=a29k-amd -				basic_os=udi -				;; -			sei) -				basic_machine=mips-sei -				basic_os=seiux -				;; -			sequent) -				basic_machine=i386-sequent -				basic_os= -				;; -			sps7) -				basic_machine=m68k-bull -				basic_os=sysv2 -				;; -			st2000) -				basic_machine=m68k-tandem -				basic_os= -				;; -			stratus) -				basic_machine=i860-stratus -				basic_os=sysv4 -				;; -			sun2) -				basic_machine=m68000-sun -				basic_os= -				;; -			sun2os3) -				basic_machine=m68000-sun -				basic_os=sunos3 -				;; -			sun2os4) -				basic_machine=m68000-sun -				basic_os=sunos4 -				;; -			sun3) -				basic_machine=m68k-sun -				basic_os= -				;; -			sun3os3) -				basic_machine=m68k-sun -				basic_os=sunos3 -				;; -			sun3os4) -				basic_machine=m68k-sun -				basic_os=sunos4 -				;; -			sun4) -				basic_machine=sparc-sun -				basic_os= -				;; -			sun4os3) -				basic_machine=sparc-sun -				basic_os=sunos3 -				;; -			sun4os4) -				basic_machine=sparc-sun -				basic_os=sunos4 -				;; -			sun4sol2) -				basic_machine=sparc-sun -				basic_os=solaris2 -				;; -			sun386 | sun386i | roadrunner) -				basic_machine=i386-sun -				basic_os= -				;; -			sv1) -				basic_machine=sv1-cray -				basic_os=unicos -				;; -			symmetry) -				basic_machine=i386-sequent -				basic_os=dynix -				;; -			t3e) -				basic_machine=alphaev5-cray -				basic_os=unicos -				;; -			t90) -				basic_machine=t90-cray -				basic_os=unicos -				;; -			toad1) -				basic_machine=pdp10-xkl -				basic_os=tops20 -				;; -			tpf) -				basic_machine=s390x-ibm -				basic_os=tpf -				;; -			udi29k) -				basic_machine=a29k-amd -				basic_os=udi -				;; -			ultra3) -				basic_machine=a29k-nyu -				basic_os=sym1 -				;; -			v810 | necv810) -				basic_machine=v810-nec -				basic_os=none -				;; -			vaxv) -				basic_machine=vax-dec -				basic_os=sysv -				;; -			vms) -				basic_machine=vax-dec -				basic_os=vms -				;; -			vsta) -				basic_machine=i386-pc -				basic_os=vsta -				;; -			vxworks960) -				basic_machine=i960-wrs -				basic_os=vxworks -				;; -			vxworks68) -				basic_machine=m68k-wrs -				basic_os=vxworks -				;; -			vxworks29k) -				basic_machine=a29k-wrs -				basic_os=vxworks -				;; -			xbox) -				basic_machine=i686-pc -				basic_os=mingw32 -				;; -			ymp) -				basic_machine=ymp-cray -				basic_os=unicos -				;; -			*) -				basic_machine=$1 -				basic_os= -				;; -		esac -		;; -esac - -# Decode 1-component or ad-hoc basic machines -case $basic_machine in -	# Here we handle the default manufacturer of certain CPU types.  It is in -	# some cases the only manufacturer, in others, it is the most popular. -	w89k) -		cpu=hppa1.1 -		vendor=winbond -		;; -	op50n) -		cpu=hppa1.1 -		vendor=oki -		;; -	op60c) -		cpu=hppa1.1 -		vendor=oki -		;; -	ibm*) -		cpu=i370 -		vendor=ibm -		;; -	orion105) -		cpu=clipper -		vendor=highlevel -		;; -	mac | mpw | mac-mpw) -		cpu=m68k -		vendor=apple -		;; -	pmac | pmac-mpw) -		cpu=powerpc -		vendor=apple -		;; - -	# Recognize the various machine names and aliases which stand -	# for a CPU type and a company and sometimes even an OS. -	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) -		cpu=m68000 -		vendor=att -		;; -	3b*) -		cpu=we32k -		vendor=att -		;; -	bluegene*) -		cpu=powerpc -		vendor=ibm -		basic_os=cnk -		;; -	decsystem10* | dec10*) -		cpu=pdp10 -		vendor=dec -		basic_os=tops10 -		;; -	decsystem20* | dec20*) -		cpu=pdp10 -		vendor=dec -		basic_os=tops20 -		;; -	delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300) -		cpu=m68k -		vendor=motorola -		;; -	# This used to be dpx2*, but that gets the RS6000-based -	# DPX/20 and the x86-based DPX/2-100 wrong.  See -	# https://oldskool.silicium.org/stations/bull_dpx20.htm -	# https://www.feb-patrimoine.com/english/bull_dpx2.htm -	# https://www.feb-patrimoine.com/english/unix_and_bull.htm -	dpx2 | dpx2[23]00 | dpx2[23]xx) -		cpu=m68k -		vendor=bull -		;; -	dpx2100 | dpx21xx) -		cpu=i386 -		vendor=bull -		;; -	dpx20) -		cpu=rs6000 -		vendor=bull -		;; -	encore | umax | mmax) -		cpu=ns32k -		vendor=encore -		;; -	elxsi) -		cpu=elxsi -		vendor=elxsi -		basic_os=${basic_os:-bsd} -		;; -	fx2800) -		cpu=i860 -		vendor=alliant -		;; -	genix) -		cpu=ns32k -		vendor=ns -		;; -	h3050r* | hiux*) -		cpu=hppa1.1 -		vendor=hitachi -		basic_os=hiuxwe2 -		;; -	hp3k9[0-9][0-9] | hp9[0-9][0-9]) -		cpu=hppa1.0 -		vendor=hp -		;; -	hp9k2[0-9][0-9] | hp9k31[0-9]) -		cpu=m68000 -		vendor=hp -		;; -	hp9k3[2-9][0-9]) -		cpu=m68k -		vendor=hp -		;; -	hp9k6[0-9][0-9] | hp6[0-9][0-9]) -		cpu=hppa1.0 -		vendor=hp -		;; -	hp9k7[0-79][0-9] | hp7[0-79][0-9]) -		cpu=hppa1.1 -		vendor=hp -		;; -	hp9k78[0-9] | hp78[0-9]) -		# FIXME: really hppa2.0-hp -		cpu=hppa1.1 -		vendor=hp -		;; -	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) -		# FIXME: really hppa2.0-hp -		cpu=hppa1.1 -		vendor=hp -		;; -	hp9k8[0-9][13679] | hp8[0-9][13679]) -		cpu=hppa1.1 -		vendor=hp -		;; -	hp9k8[0-9][0-9] | hp8[0-9][0-9]) -		cpu=hppa1.0 -		vendor=hp -		;; -	i*86v32) -		cpu=`echo "$1" | sed -e 's/86.*/86/'` -		vendor=pc -		basic_os=sysv32 -		;; -	i*86v4*) -		cpu=`echo "$1" | sed -e 's/86.*/86/'` -		vendor=pc -		basic_os=sysv4 -		;; -	i*86v) -		cpu=`echo "$1" | sed -e 's/86.*/86/'` -		vendor=pc -		basic_os=sysv -		;; -	i*86sol2) -		cpu=`echo "$1" | sed -e 's/86.*/86/'` -		vendor=pc -		basic_os=solaris2 -		;; -	j90 | j90-cray) -		cpu=j90 -		vendor=cray -		basic_os=${basic_os:-unicos} -		;; -	iris | iris4d) -		cpu=mips -		vendor=sgi -		case $basic_os in -		    irix*) -			;; -		    *) -			basic_os=irix4 -			;; -		esac -		;; -	miniframe) -		cpu=m68000 -		vendor=convergent -		;; -	*mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) -		cpu=m68k -		vendor=atari -		basic_os=mint -		;; -	news-3600 | risc-news) -		cpu=mips -		vendor=sony -		basic_os=newsos -		;; -	next | m*-next) -		cpu=m68k -		vendor=next -		;; -	np1) -		cpu=np1 -		vendor=gould -		;; -	op50n-* | op60c-*) -		cpu=hppa1.1 -		vendor=oki -		basic_os=proelf -		;; -	pa-hitachi) -		cpu=hppa1.1 -		vendor=hitachi -		basic_os=hiuxwe2 -		;; -	pbd) -		cpu=sparc -		vendor=tti -		;; -	pbb) -		cpu=m68k -		vendor=tti -		;; -	pc532) -		cpu=ns32k -		vendor=pc532 -		;; -	pn) -		cpu=pn -		vendor=gould -		;; -	power) -		cpu=power -		vendor=ibm -		;; -	ps2) -		cpu=i386 -		vendor=ibm -		;; -	rm[46]00) -		cpu=mips -		vendor=siemens -		;; -	rtpc | rtpc-*) -		cpu=romp -		vendor=ibm -		;; -	sde) -		cpu=mipsisa32 -		vendor=sde -		basic_os=${basic_os:-elf} -		;; -	simso-wrs) -		cpu=sparclite -		vendor=wrs -		basic_os=vxworks -		;; -	tower | tower-32) -		cpu=m68k -		vendor=ncr -		;; -	vpp*|vx|vx-*) -		cpu=f301 -		vendor=fujitsu -		;; -	w65) -		cpu=w65 -		vendor=wdc -		;; -	w89k-*) -		cpu=hppa1.1 -		vendor=winbond -		basic_os=proelf -		;; -	none) -		cpu=none -		vendor=none -		;; -	leon|leon[3-9]) -		cpu=sparc -		vendor=$basic_machine -		;; -	leon-*|leon[3-9]-*) -		cpu=sparc -		vendor=`echo "$basic_machine" | sed 's/-.*//'` -		;; - -	*-*) -		saved_IFS=$IFS -		IFS="-" read cpu vendor <<EOF -$basic_machine -EOF -		IFS=$saved_IFS -		;; -	# We use 'pc' rather than 'unknown' -	# because (1) that's what they normally are, and -	# (2) the word "unknown" tends to confuse beginning users. -	i*86 | x86_64) -		cpu=$basic_machine -		vendor=pc -		;; -	# These rules are duplicated from below for sake of the special case above; -	# i.e. things that normalized to x86 arches should also default to "pc" -	pc98) -		cpu=i386 -		vendor=pc -		;; -	x64 | amd64) -		cpu=x86_64 -		vendor=pc -		;; -	# Recognize the basic CPU types without company name. -	*) -		cpu=$basic_machine -		vendor=unknown -		;; -esac - -unset -v basic_machine - -# Decode basic machines in the full and proper CPU-Company form. -case $cpu-$vendor in -	# Here we handle the default manufacturer of certain CPU types in canonical form. -	# It is in some cases the only manufacturer, in others, it is the most popular. -	c[12]-convex | c[12]-unknown | c3[248]-convex | c3[248]-unknown) -		vendor=convex -		basic_os=${basic_os:-bsd} -		;; -	craynv-unknown) -		vendor=cray -		basic_os=${basic_os:-unicosmp} -		;; -	c90-unknown | c90-cray) -		vendor=cray -		basic_os=${basic_os:-unicos} -		;; -	fx80-unknown) -		vendor=alliant -		;; -	romp-unknown) -		vendor=ibm -		;; -	mmix-unknown) -		vendor=knuth -		;; -	microblaze-unknown | microblazeel-unknown) -		vendor=xilinx -		;; -	rs6000-unknown) -		vendor=ibm -		;; -	vax-unknown) -		vendor=dec -		;; -	pdp11-unknown) -		vendor=dec -		;; -	we32k-unknown) -		vendor=att -		;; -	cydra-unknown) -		vendor=cydrome -		;; -	i370-ibm*) -		vendor=ibm -		;; -	orion-unknown) -		vendor=highlevel -		;; -	xps-unknown | xps100-unknown) -		cpu=xps100 -		vendor=honeywell -		;; - -	# Here we normalize CPU types with a missing or matching vendor -	armh-unknown | armh-alt) -		cpu=armv7l -		vendor=alt -		basic_os=${basic_os:-linux-gnueabihf} -		;; - -	# Normalized CPU+vendor pairs that imply an OS, if not otherwise specified -	m68k-isi) -		basic_os=${basic_os:-sysv} -		;; -	m68k-sony) -		basic_os=${basic_os:-newsos} -		;; -	m68k-tektronix) -		basic_os=${basic_os:-bsd} -		;; -	m88k-harris) -		basic_os=${basic_os:-sysv3} -		;; -	i386-bull | m68k-bull) -		basic_os=${basic_os:-sysv3} -		;; -	rs6000-bull) -		basic_os=${basic_os:-bosx} -		;; -	mips-sni) -		basic_os=${basic_os:-sysv4} -		;; - -	# Here we normalize CPU types irrespective of the vendor -	amd64-*) -		cpu=x86_64 -		;; -	blackfin-*) -		cpu=bfin -		basic_os=${basic_os:-linux} -		;; -	c54x-*) -		cpu=tic54x -		;; -	c55x-*) -		cpu=tic55x -		;; -	c6x-*) -		cpu=tic6x -		;; -	e500v[12]-*) -		cpu=powerpc -		basic_os=${basic_os}"spe" -		;; -	mips3*-*) -		cpu=mips64 -		;; -	ms1-*) -		cpu=mt -		;; -	m68knommu-*) -		cpu=m68k -		basic_os=${basic_os:-linux} -		;; -	m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) -		cpu=s12z -		;; -	openrisc-*) -		cpu=or32 -		;; -	parisc-*) -		cpu=hppa -		basic_os=${basic_os:-linux} -		;; -	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) -		cpu=i586 -		;; -	pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) -		cpu=i686 -		;; -	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) -		cpu=i686 -		;; -	pentium4-*) -		cpu=i786 -		;; -	ppc-* | ppcbe-*) -		cpu=powerpc -		;; -	ppcle-* | powerpclittle-*) -		cpu=powerpcle -		;; -	ppc64-*) -		cpu=powerpc64 -		;; -	ppc64le-* | powerpc64little-*) -		cpu=powerpc64le -		;; -	sb1-*) -		cpu=mipsisa64sb1 -		;; -	sb1el-*) -		cpu=mipsisa64sb1el -		;; -	sh5e[lb]-*) -		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` -		;; -	spur-*) -		cpu=spur -		;; -	strongarm-* | thumb-*) -		cpu=arm -		;; -	tx39-*) -		cpu=mipstx39 -		;; -	tx39el-*) -		cpu=mipstx39el -		;; -	xscale-* | xscalee[bl]-*) -		cpu=`echo "$cpu" | sed 's/^xscale/arm/'` -		;; -	arm64-* | aarch64le-*) -		cpu=aarch64 -		;; - -	# Recognize the canonical CPU Types that limit and/or modify the -	# company names they are paired with. -	cr16-*) -		basic_os=${basic_os:-elf} -		;; -	crisv32-* | etraxfs*-*) -		cpu=crisv32 -		vendor=axis -		;; -	cris-* | etrax*-*) -		cpu=cris -		vendor=axis -		;; -	crx-*) -		basic_os=${basic_os:-elf} -		;; -	neo-tandem) -		cpu=neo -		vendor=tandem -		;; -	nse-tandem) -		cpu=nse -		vendor=tandem -		;; -	nsr-tandem) -		cpu=nsr -		vendor=tandem -		;; -	nsv-tandem) -		cpu=nsv -		vendor=tandem -		;; -	nsx-tandem) -		cpu=nsx -		vendor=tandem -		;; -	mipsallegrexel-sony) -		cpu=mipsallegrexel -		vendor=sony -		;; -	tile*-*) -		basic_os=${basic_os:-linux-gnu} -		;; - -	*) -		# Recognize the canonical CPU types that are allowed with any -		# company name. -		case $cpu in -			  1750a \ -			| 580 \ -			| [cjt]90 \ -			| a29k \ -			| aarch64 \ -			| aarch64_be \ -			| aarch64c \ -			| abacus \ -			| alpha \ -			| alpha64 \ -			| alpha64ev56 \ -			| alpha64ev6[78] \ -			| alpha64ev[4-8] \ -			| alpha64pca5[67] \ -			| alphaev56 \ -			| alphaev6[78] \ -			| alphaev[4-8] \ -			| alphapca5[67] \ -			| am33_2.0 \ -			| amdgcn \ -			| arc \ -			| arc32 \ -			| arc64 \ -			| arceb \ -			| arm \ -			| arm64e \ -			| arm64ec \ -			| arm[lb]e \ -			| arme[lb] \ -			| armv* \ -			| asmjs \ -			| avr \ -			| avr32 \ -			| ba \ -			| be32 \ -			| be64 \ -			| bfin \ -			| bpf \ -			| bs2000 \ -			| c30 \ -			| c4x \ -			| c8051 \ -			| c[123]* \ -			| clipper \ -			| craynv \ -			| csky \ -			| cydra \ -			| d10v \ -			| d30v \ -			| dlx \ -			| dsp16xx \ -			| e2k \ -			| elxsi \ -			| epiphany \ -			| f30[01] \ -			| f700 \ -			| fido \ -			| fr30 \ -			| frv \ -			| ft32 \ -			| fx80 \ -			| h8300 \ -			| h8500 \ -			| hexagon \ -			| hppa \ -			| hppa1.[01] \ -			| hppa2.0 \ -			| hppa2.0[nw] \ -			| hppa64 \ -			| i*86 \ -			| i370 \ -			| i860 \ -			| i960 \ -			| ia16 \ -			| ia64 \ -			| ip2k \ -			| iq2000 \ -			| javascript \ -			| k1om \ -			| kvx \ -			| le32 \ -			| le64 \ -			| lm32 \ -			| loongarch32 \ -			| loongarch64 \ -			| m32c \ -			| m32r \ -			| m32rle \ -			| m5200 \ -			| m68000 \ -			| m680[012346]0 \ -			| m6811 \ -			| m6812 \ -			| m68360 \ -			| m683?2 \ -			| m68hc11 \ -			| m68hc12 \ -			| m68hcs12x \ -			| m68k \ -			| m88110 \ -			| m88k \ -			| maxq \ -			| mb \ -			| mcore \ -			| mep \ -			| metag \ -			| microblaze \ -			| microblazeel \ -			| mips* \ -			| mmix \ -			| mn10200 \ -			| mn10300 \ -			| moxie \ -			| msp430 \ -			| mt \ -			| nanomips* \ -			| nds32 \ -			| nds32be \ -			| nds32le \ -			| nfp \ -			| nios \ -			| nios2 \ -			| nios2eb \ -			| nios2el \ -			| none \ -			| np1 \ -			| ns16k \ -			| ns32k \ -			| nvptx \ -			| open8 \ -			| or1k* \ -			| or32 \ -			| orion \ -			| pdp10 \ -			| pdp11 \ -			| picochip \ -			| pj \ -			| pjl \ -			| pn \ -			| power \ -			| powerpc \ -			| powerpc64 \ -			| powerpc64le \ -			| powerpcle \ -			| powerpcspe \ -			| pru \ -			| pyramid \ -			| riscv \ -			| riscv32 \ -			| riscv32be \ -			| riscv64 \ -			| riscv64be \ -			| rl78 \ -			| romp \ -			| rs6000 \ -			| rx \ -			| s390 \ -			| s390x \ -			| score \ -			| sh \ -			| sh64 \ -			| sh64le \ -			| sh[12345][lb]e \ -			| sh[1234] \ -			| sh[1234]e[lb] \ -			| sh[23]e \ -			| sh[23]ele \ -			| sh[24]a \ -			| sh[24]ae[lb] \ -			| sh[lb]e \ -			| she[lb] \ -			| shl \ -			| sparc \ -			| sparc64 \ -			| sparc64b \ -			| sparc64v \ -			| sparc86x \ -			| sparclet \ -			| sparclite \ -			| sparcv8 \ -			| sparcv9 \ -			| sparcv9b \ -			| sparcv9v \ -			| spu \ -			| sv1 \ -			| sx* \ -			| tahoe \ -			| thumbv7* \ -			| tic30 \ -			| tic4x \ -			| tic54x \ -			| tic55x \ -			| tic6x \ -			| tic80 \ -			| tron \ -			| ubicom32 \ -			| v70 \ -			| v810 \ -			| v850 \ -			| v850e \ -			| v850e1 \ -			| v850e2 \ -			| v850e2v3 \ -			| v850es \ -			| vax \ -			| vc4 \ -			| visium \ -			| w65 \ -			| wasm32 \ -			| wasm64 \ -			| we32k \ -			| x86 \ -			| x86_64 \ -			| xc16x \ -			| xgate \ -			| xps100 \ -			| xstormy16 \ -			| xtensa* \ -			| ymp \ -			| z80 \ -			| z8k) -				;; - -			*) -				echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 -				exit 1 -				;; -		esac -		;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $vendor in -	digital*) -		vendor=dec -		;; -	commodore*) -		vendor=cbm -		;; -	*) -		;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if test x"$basic_os" != x -then - -# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just -# set os. -obj= -case $basic_os in -	gnu/linux*) -		kernel=linux -		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` -		;; -	os2-emx) -		kernel=os2 -		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` -		;; -	nto-qnx*) -		kernel=nto -		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` -		;; -	*-*) -		saved_IFS=$IFS -		IFS="-" read kernel os <<EOF -$basic_os -EOF -		IFS=$saved_IFS -		;; -	# Default OS when just kernel was specified -	nto*) -		kernel=nto -		os=`echo "$basic_os" | sed -e 's|nto|qnx|'` -		;; -	linux*) -		kernel=linux -		os=`echo "$basic_os" | sed -e 's|linux|gnu|'` -		;; -	managarm*) -		kernel=managarm -		os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` -		;; -	*) -		kernel= -		os=$basic_os -		;; -esac - -# Now, normalize the OS (knowing we just have one component, it's not a kernel, -# etc.) -case $os in -	# First match some system type aliases that might get confused -	# with valid system types. -	# solaris* is a basic system type, with this one exception. -	auroraux) -		os=auroraux -		;; -	bluegene*) -		os=cnk -		;; -	solaris1 | solaris1.*) -		os=`echo "$os" | sed -e 's|solaris1|sunos4|'` -		;; -	solaris) -		os=solaris2 -		;; -	unixware*) -		os=sysv4.2uw -		;; -	# The marketing names for NeXT's operating systems were -	# NeXTSTEP, NeXTSTEP 2, OpenSTEP 3, OpenSTEP 4.  'openstep' is -	# mapped to 'openstep3', but 'openstep1' and 'openstep2' are -	# mapped to 'nextstep' and 'nextstep2', consistent with the -	# treatment of SunOS/Solaris. -	ns | ns1 | nextstep | nextstep1 | openstep1) -		os=nextstep -		;; -	ns2 | nextstep2 | openstep2) -		os=nextstep2 -		;; -	ns3 | nextstep3 | openstep | openstep3) -		os=openstep3 -		;; -	ns4 | nextstep4 | openstep4) -		os=openstep4 -		;; -	# es1800 is here to avoid being matched by es* (a different OS) -	es1800*) -		os=ose -		;; -	# Some version numbers need modification -	chorusos*) -		os=chorusos -		;; -	isc) -		os=isc2.2 -		;; -	sco6) -		os=sco5v6 -		;; -	sco5) -		os=sco3.2v5 -		;; -	sco4) -		os=sco3.2v4 -		;; -	sco3.2.[4-9]*) -		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` -		;; -	sco*v* | scout) -		# Don't match below -		;; -	sco*) -		os=sco3.2v2 -		;; -	psos*) -		os=psos -		;; -	qnx*) -		os=qnx -		;; -	hiux*) -		os=hiuxwe2 -		;; -	lynx*178) -		os=lynxos178 -		;; -	lynx*5) -		os=lynxos5 -		;; -	lynxos*) -		# don't get caught up in next wildcard -		;; -	lynx*) -		os=lynxos -		;; -	mac[0-9]*) -		os=`echo "$os" | sed -e 's|mac|macos|'` -		;; -	opened*) -		os=openedition -		;; -	os400*) -		os=os400 -		;; -	sunos5*) -		os=`echo "$os" | sed -e 's|sunos5|solaris2|'` -		;; -	sunos6*) -		os=`echo "$os" | sed -e 's|sunos6|solaris3|'` -		;; -	wince*) -		os=wince -		;; -	utek*) -		os=bsd -		vendor=`echo "$vendor" | sed -e 's|^unknown$|tektronix|'` -		;; -	dynix*) -		os=bsd -		;; -	acis*) -		os=aos -		;; -	atheos*) -		os=atheos -		;; -	syllable*) -		os=syllable -		;; -	386bsd) -		os=bsd -		;; -	ctix*) -		os=sysv -		vendor=`echo "$vendor" | sed -e 's|^unknown$|convergent|'` -		;; -	uts*) -		os=sysv -		;; -	nova*) -		kernel=rtmk -		os=nova -		;; -	# Preserve the version number of sinix5. -	sinix5.*) -		os=`echo "$os" | sed -e 's|sinix|sysv|'` -		vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'` -		;; -	sinix*) -		os=sysv4 -		vendor=`echo "$vendor" | sed -e 's|^unknown$|sni|'` -		;; -	tpf*) -		os=tpf -		;; -	triton*) -		os=sysv3 -		;; -	oss*) -		os=sysv3 -		;; -	svr4*) -		os=sysv4 -		;; -	svr3) -		os=sysv3 -		;; -	sysvr4) -		os=sysv4 -		;; -	ose*) -		os=ose -		;; -	*mint | mint[0-9]* | *MiNT | MiNT[0-9]*) -		os=mint -		;; -	dicos*) -		os=dicos -		;; -	pikeos*) -		# Until real need of OS specific support for -		# particular features comes up, bare metal -		# configurations are quite functional. -		case $cpu in -		    arm*) -			os=eabi -			;; -		    *) -			os= -			obj=elf -			;; -		esac -		;; -	aout* | coff* | elf* | pe*) -		# These are machine code file formats, not OSes -		obj=$os -		os= -		;; -	*) -		# No normalization, but not necessarily accepted, that comes below. -		;; -esac - -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system.  Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -kernel= -obj= -case $cpu-$vendor in -	score-*) -		os= -		obj=elf -		;; -	spu-*) -		os= -		obj=elf -		;; -	*-acorn) -		os=riscix1.2 -		;; -	arm*-rebel) -		kernel=linux -		os=gnu -		;; -	arm*-semi) -		os= -		obj=aout -		;; -	c4x-* | tic4x-*) -		os= -		obj=coff -		;; -	c8051-*) -		os= -		obj=elf -		;; -	clipper-intergraph) -		os=clix -		;; -	hexagon-*) -		os= -		obj=elf -		;; -	tic54x-*) -		os= -		obj=coff -		;; -	tic55x-*) -		os= -		obj=coff -		;; -	tic6x-*) -		os= -		obj=coff -		;; -	# This must come before the *-dec entry. -	pdp10-*) -		os=tops20 -		;; -	pdp11-*) -		os=none -		;; -	*-dec | vax-*) -		os=ultrix4.2 -		;; -	m68*-apollo) -		os=domain -		;; -	i386-sun) -		os=sunos4.0.2 -		;; -	m68000-sun) -		os=sunos3 -		;; -	m68*-cisco) -		os= -		obj=aout -		;; -	mep-*) -		os= -		obj=elf -		;; -	# The -sgi and -siemens entries must be before the mips- entry -	# or we get the wrong os. -	*-sgi) -		os=irix -		;; -	*-siemens) -		os=sysv4 -		;; -	mips*-cisco) -		os= -		obj=elf -		;; -	mips*-*|nanomips*-*) -		os= -		obj=elf -		;; -	or32-*) -		os= -		obj=coff -		;; -	# This must be before the sparc-* entry or we get the wrong os. -	*-tti) -		os=sysv3 -		;; -	sparc-* | *-sun) -		os=sunos4.1.1 -		;; -	pru-*) -		os= -		obj=elf -		;; -	*-be) -		os=beos -		;; -	*-ibm) -		os=aix -		;; -	*-knuth) -		os=mmixware -		;; -	*-wec) -		os=proelf -		;; -	*-winbond) -		os=proelf -		;; -	*-oki) -		os=proelf -		;; -	*-hp) -		os=hpux -		;; -	*-hitachi) -		os=hiuxwe2 -		;; -	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) -		os=sysv -		;; -	*-cbm) -		os=amigaos -		;; -	*-dg) -		os=dgux -		;; -	*-dolphin) -		os=sysv3 -		;; -	m68k-ccur) -		os=rtu -		;; -	m88k-omron*) -		os=luna -		;; -	*-next) -		os=nextstep -		;; -	*-sequent) -		os=ptx -		;; -	*-crds) -		os=unos -		;; -	*-ns) -		os=genix -		;; -	i370-*) -		os=mvs -		;; -	*-gould) -		os=sysv -		;; -	*-highlevel) -		os=bsd -		;; -	*-encore) -		os=bsd -		;; -	*-masscomp) -		os=rtu -		;; -	f30[01]-fujitsu | f700-fujitsu) -		os=uxpv -		;; -	*-rom68k) -		os= -		obj=coff -		;; -	*-*bug) -		os= -		obj=coff -		;; -	*-apple) -		os=macos -		;; -	*-atari*) -		os=mint -		;; -	*-wrs) -		os=vxworks -		;; -	*) -		os=none -		;; -esac - -fi - -# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). - -case $os in -	# Sometimes we do "kernel-libc", so those need to count as OSes. -	llvm* | musl* | newlib* | relibc* | uclibc*) -		;; -	# Likewise for "kernel-abi" -	eabi* | gnueabi*) -		;; -	# VxWorks passes extra cpu info in the 4th filed. -	simlinux | simwindows | spe) -		;; -	# See `case $cpu-$os` validation below -	ghcjs) -		;; -	# Now accept the basic system types. -	# Each alternative MUST end in a * to match a version number. -	  abug \ -	| aix* \ -	| amdhsa* \ -	| amigados* \ -	| amigaos* \ -	| android* \ -	| aof* \ -	| aos* \ -	| aros* \ -	| atheos* \ -	| auroraux* \ -	| aux* \ -	| beos* \ -	| bitrig* \ -	| bme* \ -	| bosx* \ -	| bsd* \ -	| cegcc* \ -	| chorusos* \ -	| chorusrdb* \ -	| clix* \ -	| cloudabi* \ -	| cnk* \ -	| conix* \ -	| cos* \ -	| cxux* \ -	| cygwin* \ -	| darwin* \ -	| dgux* \ -	| dicos* \ -	| dnix* \ -	| domain* \ -	| dragonfly* \ -	| drops* \ -	| ebmon* \ -	| ecoff* \ -	| ekkobsd* \ -	| emscripten* \ -	| emx* \ -	| es* \ -	| fiwix* \ -	| freebsd* \ -	| fuchsia* \ -	| genix* \ -	| genode* \ -	| glidix* \ -	| gnu* \ -	| go32* \ -	| haiku* \ -	| hcos* \ -	| hiux* \ -	| hms* \ -	| hpux* \ -	| ieee* \ -	| interix* \ -	| ios* \ -	| iris* \ -	| irix* \ -	| ironclad* \ -	| isc* \ -	| its* \ -	| l4re* \ -	| libertybsd* \ -	| lites* \ -	| lnews* \ -	| luna* \ -	| lynxos* \ -	| mach* \ -	| macos* \ -	| magic* \ -	| mbr* \ -	| midipix* \ -	| midnightbsd* \ -	| mingw32* \ -	| mingw64* \ -	| minix* \ -	| mint* \ -	| mirbsd* \ -	| mks* \ -	| mlibc* \ -	| mmixware* \ -	| mon960* \ -	| morphos* \ -	| moss* \ -	| moxiebox* \ -	| mpeix* \ -	| mpw* \ -	| msdos* \ -	| msys* \ -	| mvs* \ -	| nacl* \ -	| netbsd* \ -	| netware* \ -	| newsos* \ -	| nextstep* \ -	| nindy* \ -	| nonstopux* \ -	| nova* \ -	| nsk* \ -	| nucleus* \ -	| nx6 \ -	| nx7 \ -	| oabi* \ -	| ohos* \ -	| onefs* \ -	| openbsd* \ -	| openedition* \ -	| openstep* \ -	| os108* \ -	| os2* \ -	| os400* \ -	| os68k* \ -	| os9* \ -	| ose* \ -	| osf* \ -	| oskit* \ -	| osx* \ -	| palmos* \ -	| phoenix* \ -	| plan9* \ -	| powermax* \ -	| powerunix* \ -	| proelf* \ -	| psos* \ -	| psp* \ -	| ptx* \ -	| pw32* \ -	| qnx* \ -	| rdos* \ -	| redox* \ -	| rhapsody* \ -	| riscix* \ -	| riscos* \ -	| rtems* \ -	| rtmk* \ -	| rtu* \ -	| scout* \ -	| secbsd* \ -	| sei* \ -	| serenity* \ -	| sim* \ -	| skyos* \ -	| solaris* \ -	| solidbsd* \ -	| sortix* \ -	| storm-chaos* \ -	| sunos \ -	| sunos[34]* \ -	| superux* \ -	| syllable* \ -	| sym* \ -	| sysv* \ -	| tenex* \ -	| tirtos* \ -	| toppers* \ -	| tops10* \ -	| tops20* \ -	| tpf* \ -	| tvos* \ -	| twizzler* \ -	| uclinux* \ -	| udi* \ -	| udk* \ -	| ultrix* \ -	| unicos* \ -	| uniplus* \ -	| unleashed* \ -	| unos* \ -	| uwin* \ -	| uxpv* \ -	| v88r* \ -	|*vms* \ -	| vos* \ -	| vsta* \ -	| vxsim* \ -	| vxworks* \ -	| wasi* \ -	| watchos* \ -	| wince* \ -	| windiss* \ -	| windows* \ -	| winnt* \ -	| xenix* \ -	| xray* \ -	| zephyr* \ -	| zvmoe* ) -		;; -	# This one is extra strict with allowed versions -	sco3.2v2 | sco3.2v[4-9]* | sco5v6*) -		# Don't forget version if it is 3.2v4 or newer. -		;; -	# This refers to builds using the UEFI calling convention -	# (which depends on the architecture) and PE file format. -	# Note that this is both a different calling convention and -	# different file format than that of GNU-EFI -	# (x86_64-w64-mingw32). -	uefi) -		;; -	none) -		;; -	kernel* | msvc* ) -		# Restricted further below -		;; -	'') -		if test x"$obj" = x -		then -			echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 -		fi -		;; -	*) -		echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 -		exit 1 -		;; -esac - -case $obj in -	aout* | coff* | elf* | pe*) -		;; -	'') -		# empty is fine -		;; -	*) -		echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 -		exit 1 -		;; -esac - -# Here we handle the constraint that a (synthetic) cpu and os are -# valid only in combination with each other and nowhere else. -case $cpu-$os in -	# The "javascript-unknown-ghcjs" triple is used by GHC; we -	# accept it here in order to tolerate that, but reject any -	# variations. -	javascript-ghcjs) -		;; -	javascript-* | *-ghcjs) -		echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 -		exit 1 -		;; -esac - -# As a final step for OS-related things, validate the OS-kernel combination -# (given a valid OS), if there is a kernel. -case $kernel-$os-$obj in -	linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ -		    | linux-mlibc*- | linux-musl*- | linux-newlib*- \ -		    | linux-relibc*- | linux-uclibc*- | linux-ohos*- ) -		;; -	uclinux-uclibc*- | uclinux-gnu*- ) -		;; -	managarm-mlibc*- | managarm-kernel*- ) -		;; -	windows*-msvc*-) -		;; -	-dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ -		    | -uclibc*- ) -		# These are just libc implementations, not actual OSes, and thus -		# require a kernel. -		echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 -		exit 1 -		;; -	-kernel*- ) -		echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 -		exit 1 -		;; -	*-kernel*- ) -		echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 -		exit 1 -		;; -	*-msvc*- ) -		echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 -		exit 1 -		;; -	kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-) -		;; -	vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) -		;; -	nto-qnx*-) -		;; -	os2-emx-) -		;; -	rtmk-nova-) -		;; -	*-eabi*- | *-gnueabi*-) -		;; -	none--*) -		# None (no kernel, i.e. freestanding / bare metal), -		# can be paired with an machine code file format -		;; -	-*-) -		# Blank kernel with real OS is always fine. -		;; -	--*) -		# Blank kernel and OS with real machine code file format is always fine. -		;; -	*-*-*) -		echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 -		exit 1 -		;; -esac - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer.  We pick the logical manufacturer. -case $vendor in -	unknown) -		case $cpu-$os in -			*-riscix*) -				vendor=acorn -				;; -			*-sunos* | *-solaris*) -				vendor=sun -				;; -			*-cnk* | *-aix*) -				vendor=ibm -				;; -			*-beos*) -				vendor=be -				;; -			*-hpux*) -				vendor=hp -				;; -			*-mpeix*) -				vendor=hp -				;; -			*-hiux*) -				vendor=hitachi -				;; -			*-unos*) -				vendor=crds -				;; -			*-dgux*) -				vendor=dg -				;; -			*-luna*) -				vendor=omron -				;; -			*-genix*) -				vendor=ns -				;; -			*-clix*) -				vendor=intergraph -				;; -			*-mvs* | *-opened*) -				vendor=ibm -				;; -			*-os400*) -				vendor=ibm -				;; -			s390-* | s390x-*) -				vendor=ibm -				;; -			*-ptx*) -				vendor=sequent -				;; -			*-tpf*) -				vendor=ibm -				;; -			*-vxsim* | *-vxworks* | *-windiss*) -				vendor=wrs -				;; -			*-aux*) -				vendor=apple -				;; -			*-hms*) -				vendor=hitachi -				;; -			*-mpw* | *-macos*) -				vendor=apple -				;; -			*-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) -				vendor=atari -				;; -			*-vos*) -				vendor=stratus -				;; -		esac -		;; -esac - -echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" -exit - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/exclude-kernel-source-and-EFI-files-in-digest-list-building.patch b/exclude-kernel-source-and-EFI-files-in-digest-list-building.patch new file mode 100644 index 0000000..a86b7b7 --- /dev/null +++ b/exclude-kernel-source-and-EFI-files-in-digest-list-building.patch @@ -0,0 +1,74 @@ +From 85e9f95d163eb3daa75add855be3208472c51850 Mon Sep 17 00:00:00 2001 +From: Anakin Zhang <benjamin93@163.com> +Date: Thu, 8 Apr 2021 19:09:00 +0800 +Subject: [PATCH] exclude kernel source and EFI files in digest list building + +Signed-off-by: Anakin Zhang <benjamin93@163.com> +--- + brp-digest-list | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/brp-digest-list b/brp-digest-list +index c3b2156..e698b7a 100644 +--- a/brp-digest-list ++++ b/brp-digest-list +@@ -8,8 +8,6 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then + 	exit 0 + fi +  +- +- + # Create temporary file listing files in the manifest + #[ -n "$TMPDIR" ] || TMPDIR="/tmp" + TMPDIR="/tmp" +@@ -34,6 +32,8 @@ mkdir -p $DIGEST_LIST_DIR.sig + gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR -i l:policy \ + 	-i i: -o add -p -1 -m immutable -i L:$BIN_PKG_FILES -i u: \ + 	-A $RPM_BUILD_ROOT -i e: \ ++	-i E:/usr/src \ ++	-i E:/boot/efi \ + 	-i F:/lib \ + 	-i F:/usr/lib \ + 	-i F:/lib64 \ +@@ -43,16 +43,18 @@ gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR -i l:policy \ + 	-i F:/lib/firmware \ + 	-i F:/usr/lib/firmware +  +-f="$DIGEST_LIST_DIR/0-metadata_list-compact-$(basename $BIN_PKG_FILES)" +-[ -f $f ] || exit 0 ++DIGEST_LIST_PATH="$DIGEST_LIST_DIR/0-metadata_list-compact-$(basename $BIN_PKG_FILES)" ++[ -f $DIGEST_LIST_PATH ] || exit 0 +  +-chmod 644 $f +-echo $f ++chmod 644 $DIGEST_LIST_PATH ++echo $DIGEST_LIST_PATH +  + # Generate TLV digest list to check metadata + gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR.tlv \ + 	-i l:policy -i i: -o add -p -1 -m immutable -i L:$BIN_PKG_FILES -i u: \ + 	-T -A $RPM_BUILD_ROOT -i e: \ ++	-i E:/usr/src \ ++	-i E:/boot/efi \ + 	-i F:/lib \ + 	-i F:/usr/lib \ + 	-i F:/lib64 \ +@@ -62,11 +64,11 @@ gen_digest_lists -i M: -t metadata -f compact -d $DIGEST_LIST_DIR.tlv \ + 	-i F:/lib/firmware \ + 	-i F:/usr/lib/firmware +  +-f="$DIGEST_LIST_DIR.tlv/0-metadata_list-compact_tlv-$(basename $BIN_PKG_FILES)" +-[ -f $f ] || exit 0 ++DIGEST_LIST_TLV_PATH="$DIGEST_LIST_DIR.tlv/0-metadata_list-compact_tlv-$(basename $BIN_PKG_FILES)" ++[ -f $DIGEST_LIST_TLV_PATH ] || exit 0 +  +-chmod 644 $f +-echo $f ++chmod 644 $DIGEST_LIST_TLV_PATH ++echo $DIGEST_LIST_TLV_PATH +  + if [[ "$(basename $BIN_PKG_FILES)" =~ "digest-list-tools" && \ +       ! $(basename $BIN_PKG_FILES) =~ "debug" ]]; then +--  +1.8.3.1 + diff --git a/find-requires b/find-requires deleted file mode 100755 index 3e61e59..0000000 --- a/find-requires +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# -# Auto-generate requirements for executables (both ELF and a.out) and library -# sonames, script interpreters, and perl modules. -# - -ulimit -c 0 - -filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"` - -[ -x /usr/lib/rpm/rpmdeps -a -n "$filelist" ] && \ -    echo $filelist | tr '[:blank:]' \\n | /usr/lib/rpm/rpmdeps --requires - -# -# --- Kernel module imported symbols -# -# Since we don't (yet) get passed the name of the package being built, we -# cheat a little here by looking first for a kernel, then for a kmod. -# - -unset is_kmod - -for f in $filelist; do -    if [ $(echo "$f" | sed -r -ne 's:^.*/lib/modules/(.*)/(.*)\.ko(\.gz|\.bz2|\.xz)?$:\2:p') ] -    then -        is_kmod=1; -    elif [ $(echo "$f" | sed -r -ne 's:^.*/boot/(.*):\1:p') ] -    then -	unset is_kmod; -	break; -    fi -done - -[ -x /usr/lib/rpm/@VENDOR@/find-requires.ksyms ] && [ "$is_kmod" ] && -    printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/@VENDOR@/find-requires.ksyms - -exit 0 diff --git a/find-requires.ksyms b/find-requires.ksyms deleted file mode 100755 index 42af85f..0000000 --- a/find-requires.ksyms +++ /dev/null @@ -1,155 +0,0 @@ -#! /bin/bash -# -# This script is called during external module building to create dependencies -# both upon the linux kernel, and on additional external modules. Symbols that -# cannot be reconciled against those provided by the kernel are assumed to be -# provided by an external module and "ksym" replaces th regular "kernel" dep. - -IFS=$'\n' - -# Extract all of the symbols provided by this module. -all_provides() { -    for module in "$@"; do -        tmpfile="" -        if [ "x${module%.ko}" = "x${module}" ]; then -            tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) -            proc_bin= -            case "${module##*.}" in -            xz) -                    proc_bin=xz -                    ;; -            bz2) -                    proc_bin=bzip2 -                    ;; -            gz) -                    proc_bin=gzip -                    ;; -            esac - -            [ -n "$proc_bin" ] || continue - -            "$proc_bin" -d -c - < "$module" > "$tmpfile" || continue -            module="$tmpfile" -        fi - -        if [[ -n $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p') ]]; then -            nm "$module" \ -            | sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):0x\1 \2:p' \ -            | awk --non-decimal-data '{printf("%s:0x%08x\n", $2, $1)}' -        else -            ELFRODATA=$(readelf -R .rodata "$module" | awk '/0x/{printf $2$3$4$5}') -            if [[ -n $(readelf -h "$module" | grep "little endian") ]]; then -                RODATA=$(echo $ELFRODATA | sed 's/\(..\)\(..\)\(..\)\(..\)/\4\3\2\1/g') -            else -                RODATA=$ELFRODATA -            fi -            for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do -                echo $sym $RODATA -            done \ -            | awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}' -        fi - -        [ -z "$tmpfile" ] || rm -f -- "$tmpfile" -    done \ -    | LC_ALL=C sort -k1,1 -u -} - -# Extract all of the requirements of this module. -all_requires() { -    for module in "$@"; do -        set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q) -        /sbin/modprobe --dump-modversions "$module" \ -        | awk --non-decimal-data ' -            BEGIN { FS = "\t" ; OFS = "\t" } -            {printf("%s:0x%08x\n", $2, $1)}' \ -        | sed -r -e 's:$:\t'"$1"':' -    done \ -    | LC_ALL=C sort -k1,1 -u -} - -# Filter out requirements fulfilled by the module itself. -mod_requires() { -    LC_ALL=C join -t $'\t' -j 1 -v 1 \ -        <(all_requires "$@") \ -        <(all_provides "$@") \ -    | LC_ALL=C sort -k1,1 -u -} - -if ! [ -e /sbin/modinfo -a -e /sbin/modprobe ]; then -    cat > /dev/null -    exit 0 -fi - -check_kabi() { -    arch=$(uname -m) -    kabi_file="/lib/modules/kabi-current/kabi_stablelist_$arch" - -    # If not installed, output a warning and return (continue) -    if [ ! -f "$kabi_file" ]; then -        echo "" >&2 -        echo "********************************************************************************" >&2 -        echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2 -        echo "********************************************************************************" >&2 -        echo "The kernel ABI reference files (provided by "kernel-abi-stablelists") were not found." >&2 -        echo "No compatibility check was performed. Please install the kABI reference files" >&2 -        echo "and rebuild if you would like to verify compatibility with kernel ABI." >&2 -        echo "" >&2 -        return -    fi - -    unset non_kabi -    for symbol in "$@"; do -        if ! egrep "^$symbol\$" $kabi_file >/dev/null; then -            non_kabi=("${non_kabi[@]}" "$symbol") -        fi -    done - -    if [ ${#non_kabi[@]} -gt 0 ]; then -        echo "" >&2 -        echo "********************************************************************************" >&2 -        echo "*********************** KERNEL ABI COMPATIBILITY WARNING ***********************" >&2 -        echo "********************************************************************************" >&2 -        echo "The following kernel symbols are not guaranteed to remain compatible with" >&2 -        echo "future kernel updates to this RHEL release:" >&2 -        echo "" >&2 -        for symbol in "${non_kabi[@]}"; do -            printf "\t$symbol\n" >&2 -        done -        echo "" >&2 -        echo "@VENDOR@ recommends that you consider using only official kernel ABI symbols" >&2 -        echo "where possible. Requests for additions to the kernel ABI can be filed with" >&2 -        echo "your partner or customer representative (component: driver-update-program)." >&2 -        echo "" >&2 -    fi -} - -modules=($(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$')) -if [ ${#modules[@]} -gt 0 ]; then -    kernel=$(/sbin/modinfo -F vermagic "${modules[0]}" | sed -e 's: .*::' -e q) - -    # get all that kernel provides -    symvers=$(mktemp -t ${0##*/}.XXXXX) - -    cat /usr/src/kernels/$kernel/Module.symvers | awk ' -        BEGIN { FS = "\t" ; OFS = "\t" } -        { print $2 ":" $1 } -    ' \ -    | sed -r -e 's:$:\t'"$kernel"':' \ -    | LC_ALL=C sort -k1,1 -u > $symvers - -    # Symbols matching with the kernel get a "kernel" dependency -    mod_req=$(mktemp -t mod_req.XXXXX) -    mod_requires "${modules[@]}" > "$mod_req" -    LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \ -    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "kernel(" $1 ") = " $2 }' - -    # Symbols from elsewhere get a "ksym" dependency -    LC_ALL=C join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | LC_ALL=C sort -u \ -    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }' - -    # Check kABI if the kernel-abi-stablelists package is installed -    # Do this last so we can try to output this error at the end -    kabi_check_symbols=($(LC_ALL=C join -t $'\t' -j 1 $symvers "$mod_req" | LC_ALL=C sort -u \ -    | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }')) -    check_kabi "${kabi_check_symbols[@]}" -fi diff --git a/fix-brp-ldconfig-riscv-default-library-directory.patch b/fix-brp-ldconfig-riscv-default-library-directory.patch new file mode 100644 index 0000000..5a448b7 --- /dev/null +++ b/fix-brp-ldconfig-riscv-default-library-directory.patch @@ -0,0 +1,15 @@ +--- openEuler-rpm-config/brp-ldconfig	2020-08-20 17:13:06.000000000 +0800 ++++ openEuler-rpm-config/brp-ldconfig.new	2023-03-08 19:45:58.241036244 +0800 +@@ -5,4 +5,12 @@ +   exit 0 + fi +  ++riscv64_lp64d=0 ++if [ "$HOSTTYPE" = "riscv64" -a -e $RPM_BUILD_ROOT/usr/lib64 -a ! -e $RPM_BUILD_ROOT/usr/lib64/lp64d ]; then ++    ln -s . $RPM_BUILD_ROOT/usr/lib64/lp64d ++    riscv64_lp64d=1 ++fi + /sbin/ldconfig -N -r "$RPM_BUILD_ROOT" ++if [ $riscv64_lp64d = 1 ]; then ++    rm -f $RPM_BUILD_ROOT/usr/lib64/lp64d ++fi diff --git a/fix-config-error-for-loongarch64.patch b/fix-config-error-for-loongarch64.patch new file mode 100644 index 0000000..d85a031 --- /dev/null +++ b/fix-config-error-for-loongarch64.patch @@ -0,0 +1,25 @@ +From 749215e0573475d3f8085c5976ec0a82b703ccae Mon Sep 17 00:00:00 2001 +From: Jingyun Hua <huajingyun@loongson.cn> +Date: Wed, 14 Dec 2022 07:00:44 +0000 +Subject: [PATCH] fix config error for loongarch64 + +Signed-off-by: Jingyun Hua <huajingyun@loongson.cn> +--- + config.sub | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/config.sub b/config.sub +index aca1d40..4d60f77 100644 +--- a/config.sub ++++ b/config.sub +@@ -395,6 +395,7 @@ case $basic_machine in + 	| k1om-* \ + 	| le32-* | le64-* \ + 	| lm32-* \ ++	| loongarch32-* | loongarch64-* | loongarchx32-* \ + 	| m32c-* | m32r-* | m32rle-* \ + 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + 	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ +--  +2.33.0 + diff --git a/fix-error-message-for-kmodtool.patch b/fix-error-message-for-kmodtool.patch new file mode 100644 index 0000000..ef323f0 --- /dev/null +++ b/fix-error-message-for-kmodtool.patch @@ -0,0 +1,25 @@ +From 177688aa4c6888a693da0ee7a06e01066cde4c54 Mon Sep 17 00:00:00 2001 +From: Yangyang Shen <shenyangyang4@huawei.com> +Date: Wed, 30 Sep 2020 14:45:14 +0800 +Subject: [PATCH] fix error message for kmodtool + +--- + kmodtool.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kmodtool.py b/kmodtool.py +index 724f481..75492b9 100644 +--- a/kmodtool.py ++++ b/kmodtool.py +@@ -39,7 +39,7 @@ def get_rpmtemplate(kmod_name,verrel): +     print("This package provides the " + kmod_name + " kernel modules built for the Linux")
 +     print("kernel "+ verrel + " for the %{_target_cpu} family of processors.")
 +     print("%post          -n kmod-" + kmod_name)
 +-    print("if [ -e /boot/System.map-" + verrel + "]; then")
 ++    print("if [ -e /boot/System.map-" + verrel + " ]; then")
 +     print("   /sbin/depmod -aeF /boot/System.map-" + verrel +" " + verrel +"> /dev/null || :")
 +     print("fi")
 +     if (kmp !=""):
 +--  +2.23.0 + diff --git a/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch b/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch new file mode 100644 index 0000000..ae85c22 --- /dev/null +++ b/fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch @@ -0,0 +1,25 @@ +From 4e1adcc36b0c2e379d6080ceb874f2413644c535 Mon Sep 17 00:00:00 2001 +From: xujing <xujing125@huawei.com> +Date: Wed, 15 Nov 2023 17:16:22 +0800 +Subject: [PATCH] fix the ELF file cannot be found due to escape of '\' + +--- + macros | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/macros b/macros +index 7cde63f..36621df 100644 +--- a/macros ++++ b/macros +@@ -275,7 +275,7 @@ 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 {} ++%chrpath_delete find $RPM_BUILD_ROOT/ -type f -exec file {} ';' | grep "\\<ELF\\>" | awk -F ':' '{print $1}' | xargs -i chrpath --delete {} +  + %package_help        \ + %package        help \ +--  +2.33.0 + diff --git a/fixed-a-bug-that-missing_-p-in-macros.kmp.patch b/fixed-a-bug-that-missing_-p-in-macros.kmp.patch new file mode 100644 index 0000000..457597b --- /dev/null +++ b/fixed-a-bug-that-missing_-p-in-macros.kmp.patch @@ -0,0 +1,37 @@ +From 7629ad0c54cc3970e49b2f78043e0fe1b1c6474d Mon Sep 17 00:00:00 2001 +From: liujing <liujing_yewu@cmss.chinamobile.com> +Date: Wed, 1 Dec 2021 00:46:20 -0500 +Subject: [PATCH] fixed a bug that missing -p in macros.kmp + +--- + macros.kmp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/macros.kmp b/macros.kmp +index be66e64..5207045 100644 +--- a/macros.kmp ++++ b/macros.kmp +@@ -5,17 +5,17 @@ kernel_module_package_release	1 + 
 + 
 + #kernel_module_package [ -n name ] [ -v version ] [ -r release ] 
 +-#                      [ -f filelist]   
 ++#                      [ -f filelist][-p preamble]   
 + #
 + 
 + %kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \
 + 					kernel-devel
 + 
 +-%kernel_module_package(n:v:r:f:) %{expand:%( \
 ++%kernel_module_package(n:v:r:f:p) %{expand:%( \
 + 	%define kmodtool /usr/lib/rpm/__vendor/kmodtool.py\
 + 	%define latest_kernel $(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel` | head -n 1) \
 + 	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
 + 	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
 +-        python3 %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} %{-f*}%{!-f:%filelist}  \
 ++        python3 %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} %{-f*}%{!-f:%filelist} %{-p*}%{!-p:%preamble} \
 + )}
 + 
 +--  +2.27.0 + diff --git a/generic-hardened-cc1 b/generic-hardened-cc1 deleted file mode 100644 index fc54bcb..0000000 --- a/generic-hardened-cc1 +++ /dev/null @@ -1,2 +0,0 @@ -*cc1_options: -+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} diff --git a/generic-hardened-clang.cfg b/generic-hardened-clang.cfg deleted file mode 100644 index ac596df..0000000 --- a/generic-hardened-clang.cfg +++ /dev/null @@ -1 +0,0 @@ --fPIE
\ No newline at end of file diff --git a/generic-hardened-ld b/generic-hardened-ld deleted file mode 100644 index bd6b907..0000000 --- a/generic-hardened-ld +++ /dev/null @@ -1,2 +0,0 @@ -*self_spec: -+ %{!static:%{!shared:%{!r:-pie}}} diff --git a/generic-pie-cc1 b/generic-pie-cc1 deleted file mode 100644 index 95615fa..0000000 --- a/generic-pie-cc1 +++ /dev/null @@ -1,2 +0,0 @@ -*cc1_options: -+ %{!r:%{!D__KERNEL__:%{!pie:%{!fpic:%{!fPIC:%{!fpie:%{!fPIE:%{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE:%{!shared:%{!static:%{!nostdlib:%{!nostartfiles:-fPIE}}}}}}}}}}}}}}} diff --git a/generic-pie-ld b/generic-pie-ld deleted file mode 100644 index ff33f64..0000000 --- a/generic-pie-ld +++ /dev/null @@ -1,2 +0,0 @@ -*self_spec: -+ %{!D__KERNEL__:%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r:%{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}} diff --git a/kmodtool b/kmodtool deleted file mode 100755 index fc69d9b..0000000 --- a/kmodtool +++ /dev/null @@ -1,281 +0,0 @@ -#!/usr/bin/bash - -# kmodtool - Helper script for building kernel module RPMs -# Copyright (c) 2003-2006 Ville Skyttä <ville.skytta@iki.fi>, -#                         Thorsten Leemhuis <fedora@leemhuis.info> -#                         Jon Masters <jcm@redhat.com> -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -shopt -s extglob - -myprog="kmodtool" -myver="0.10.10_kmp2" -knownvariants=@(BOOT|PAE|@(big|huge)mem|debug|enterprise|kdump|?(large)smp|uml|xen[0U]?(-PAE)|xen) -kmod_name= -kver= -verrel= -variant= -kmp= - -get_verrel () -{ -  verrel=${1:-$(uname -r)} -  verrel=${verrel%%$knownvariants} -} - -print_verrel () -{ -  get_verrel $@ -  echo "${verrel}" -} - -get_variant () -{ -  get_verrel $@ -  variant=${1:-$(uname -r)} -  variant=${variant##$verrel} -  variant=${variant:-'""'} -} - -print_variant () -{ -  get_variant $@ -  echo "${variant}" -} - -get_filelist() { -    local IFS=$'\n' -    filelist=($(cat)) - -    if [ ${#filelist[@]} -gt 0 ]; -    then -        for ((n = 0; n < ${#filelist[@]}; n++)); -        do -            line="${filelist[n]}" -            line=$(echo "$line" \ -                | sed -e "s/%verrel/$verrel/g" \ -                | sed -e "s/%variant/$variant/g" \ -                | sed -e "s/%dashvariant/$dashvariant/g" \ -                | sed -e "s/%dotvariant/$dotvariant/g" \ -                | sed -e "s/\.%1/$dotvariant/g" \ -                | sed -e "s/\-%1/$dotvariant/g" \ -                | sed -e "s/%2/$verrel/g") -            echo "$line" -        done -    else -        echo "%defattr(644,root,root,755)" -        echo "/lib/modules/${verrel}${dotvariant}" -    fi -} - -get_rpmtemplate () -{ -    local variant="${1}" -    local dashvariant="${variant:+-${variant}}" -    case "$verrel" in -        *.el*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; -        *.EL*) kdep="kernel${dashvariant}-%{_target_cpu} = ${verrel}" ;; -        *)     kdep="kernel-%{_target_cpu} = ${verrel}${variant}"     ;; -    esac - -    echo "%package       -n kmod-${kmod_name}${dashvariant}" - -    if [ -z "$kmp_provides_summary" ]; then -        echo "Summary:          ${kmod_name} kernel module(s)" -    fi - -    if [ -z "$kmp_provides_group" ]; then -        echo "Group:            System Environment/Kernel" -    fi - -    if [ ! -z "$kmp_version" ]; then -        echo "Version: %{kmp_version}" -    fi - -    if [ ! -z "$kmp_release" ]; then -        echo "Release: %{kmp_release}" -    fi - -    cat <<EOF -Provides:         kernel-modules = ${verrel}${variant} -Provides:         ${kmod_name}-kmod = %{?epoch:%{epoch}:}%{version}-%{release} -EOF - -    if [ -z "$kmp" ]; then -        echo "Requires:         ${kdep}" -    fi - -# -# RHEL5 - Remove common package requirement on general kmod packages. -# Requires: ${kmod_name}-kmod-common >= %{?epoch:%{epoch}:}%{version} -# - -    cat <<EOF -Requires(post):   /usr/sbin/depmod -Requires(postun): /usr/sbin/depmod -EOF - -if [ "" != "$kmp_override_preamble" ] -then -    cat "$kmp_override_preamble" -fi - -cat <<EOF -%description   -n kmod-${kmod_name}${dashvariant} -This package provides the ${kmod_name} kernel modules built for the Linux -kernel ${verrel}${variant} for the %{_target_cpu} family of processors. -%post          -n kmod-${kmod_name}${dashvariant} -if [ -e "/boot/System.map-${verrel}${variant}" ]; then -    /sbin/depmod -aeF "/boot/System.map-${verrel}${variant}" "${verrel}${variant}" > /dev/null || : -fi -EOF - -    if [ ! -z "$kmp" ]; then -        cat <<EOF - -modules=( \$(find /lib/modules/${verrel}${variant}/extra/${kmod_name} | grep '\.ko$') ) -if [ -x "/sbin/weak-modules" ]; then -    printf '%s\n' "\${modules[@]}" \ -    | /sbin/weak-modules --add-modules -fi -%preun         -n kmod-${kmod_name}${dashvariant} -rpm -ql kmod-${kmod_name}${dashvariant} | grep '\.ko$' \ -    > /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules -EOF - -    fi - -    cat <<EOF -%postun        -n kmod-${kmod_name}${dashvariant} -/sbin/depmod -aF /boot/System.map-${verrel}${variant} ${verrel}${variant} &> /dev/null || : -EOF - -    if [ ! -z "$kmp" ]; then -        cat <<EOF -modules=( \$(cat /var/run/rpm-kmod-${kmod_name}${dashvariant}-modules) ) -if [ -x "/sbin/weak-modules" ]; then -    printf '%s\n' "\${modules[@]}" \ -    | /sbin/weak-modules --remove-modules -fi -EOF -    fi - -echo "%files         -n kmod-${kmod_name}${dashvariant}" -if [ "" == "$kmp_override_filelist" ]; -then -    echo "%defattr(644,root,root,755)" -    echo "/lib/modules/${verrel}${variant}/" -else -    cat "$kmp_override_filelist" | get_filelist -fi -} - -print_rpmtemplate () -{ -  kmod_name="${1}" -  shift -  kver="${1}" -  get_verrel "${1}" -  shift -  if [ -z "${kmod_name}" ] ; then -    echo "Please provide the kmodule-name as first parameter." >&2 -    exit 2 -  elif [ -z "${kver}" ] ; then -    echo "Please provide the kver as second parameter." >&2 -    exit 2 -  elif [ -z "${verrel}" ] ; then -    echo "Couldn't find out the verrel." >&2 -    exit 2 -  fi - -  for variant in "$@" ; do -      if [ "default" == "$variant" ]; -      then -            get_rpmtemplate "" -      else -            get_rpmtemplate "${variant}" -      fi -  done -} - -usage () -{ -  cat <<EOF -You called: ${invocation} - -Usage: ${myprog} <command> <option>+ - Commands: -  verrel <uname> -    - Get "base" version-release. -  variant <uname> -    - Get variant from uname. -  rpmtemplate <mainpgkname> <uname> <variants> -    - Return a template for use in a source RPM -  rpmtemplate_kmp <mainpgkname> <uname> <variants> -    - Return a template for use in a source RPM with KMP dependencies -  version -    - Output version number and exit. -EOF -} - -invocation="$(basename ${0}) $@" -while [ "${1}" ] ; do -  case "${1}" in -    verrel) -      shift -      print_verrel $@ -      exit $? -      ;; -    variant) -      shift -      print_variant $@ -      exit $? -      ;; -    rpmtemplate) -      shift -      print_rpmtemplate "$@" -      exit $? -      ;; -    rpmtemplate_kmp) -      shift -      kmp=1 -      print_rpmtemplate "$@" -      exit $? -      ;; -    version) -      echo "${myprog} ${myver}" -      exit 0 -      ;; -    *) -      echo "Error: Unknown option '${1}'." >&2 -      usage >&2 -      exit 2 -      ;; -  esac -done - -# Local variables: -# mode: sh -# sh-indentation: 2 -# indent-tabs-mode: nil -# End: -# ex: ts=2 sw=2 et - @@ -1,399 +0,0 @@ -# Per-platform rpm configuration file. - -%_vendor 		@VENDOR@ -%_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 - -%_build_id_links none - -# GCC toolchain -%__cc_gcc gcc -%__cxx_gcc g++ -%__cpp_gcc gcc -E -  -# Clang toolchain -%__cc_clang clang -%__cxx_clang clang++ -%__cpp_clang clang-cpp -  -# Default to the GCC toolchain -# -# It is enough to override `toolchain` macro and all relevant macro for C/C++ -# compilers will be switched. Either in the spec or in the command-line. -# -#     %global toolchain clang -# -# or: -# -#     rpmbuild -D "toolchain clang" … -# -# Inside a spec file it is also possible to determine which toolchain is in use -# by testing the same macro. For example: -# -#     %if "%{toolchain}" == "gcc" -#     BuildRequires: gcc -#     %endif -# -# or: -# -#     %if "%{toolchain}" == "clang" -#     BuildRequires: clang compiler-rt -#     %endif -# -%toolchain gcc -  -%__cc %{expand:%%{__cc_%{toolchain}}} -%__cxx %{expand:%%{__cxx_%{toolchain}}} -%__cpp %{expand:%%{__cpp_%{toolchain}}} - -#============================================================================== -# ---- compiler flags. - -%build_cflags %{optflags} -%build_cxxflags %{optflags} -fexceptions -%build_fflags %{optflags} -fexceptions -I%{_fmoddir} -%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} - -%set_build_cc \ -  CC=%{__cc}; export CC ; \ -  CXX=%{__cxx}; export CXX ; \ -  CCC="${CCC:-%{__cxx}}" ; export CCC - -%set_build_flags \ -  %[ "%{toolchain}" == "gcc" ? "" : "%{set_build_cc};" ] \ -  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 - -# Automatically use set_build_flags macro for build, check, and -# install phases. -# Use "%undefine _auto_set_build_flags" to disable" -# Automatically use set_build_cc macro for build, check, and -# install phases. -# Use "%undefine _auto_set_build_cc" to disable" -%_auto_set_build_cc %["%{toolchain}" == "gcc" ? 0 : 1] -%_auto_set_build_flags 0 - -%__spec_build_pre %{___build_pre} \ -  %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""] \ -  %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""] -%__spec_check_pre %{___build_pre} \ -  %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""] \ -  %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""] - -#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 - -#update config.guess and config.sub -%_update_config_guess \ -  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find . -name config.guess) ; do \ -      [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && \ -      %{__rm} -f $i && \ -      %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ -  done ; - -%_update_config_sub \ -  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find . -name config.sub) ; do \ -      [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && \ -      %{__rm} -f $i && \ -      %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ -  done ; - -%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/%{_vendor}/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(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"\ -    %[0%{?_auto_set_build_cc} ? "%{set_build_cc}" : ""]\ -    %[0%{?_auto_set_build_flags} ? "%{set_build_flags}" : ""]\ -%{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_chrpath /usr/lib/rpm/brp-chrpath %{buildroot} -%__brp_ldconfig /usr/lib/rpm/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_check_elf_files /usr/lib/rpm/brp-check-elf-files -%__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 -%__brp_remove_la_files /usr/lib/rpm/brp-remove-la-files -%__brp_remove_info_dir /usr/lib/rpm/brp-remove-info-dir - -%__os_install_post    \ -    %{?__brp_ldconfig} \ -    %{?__brp_compress} \ -    %{!?__debug_package:\ -    %{?__brp_strip} \ -    %{?__brp_strip_comment_note} \ -    } \ -    %{?__brp_strip_static_archive} \ -    %{?__brp_check_elf_files} \ -    %{?__brp_remove_la_files} \ -    %{?__brp_remove_info_dir} \ -    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ -    %{?__brp_python_hardlink} \ -%{nil} - -%__spec_install_post\ -    %{?__debug_package:%{__debug_install_post}}\ -    %{?@VENDOR@_delete_rpath:%{?__brp_chrpath}} \ -    %{__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_gcc_cflags	-specs=/usr/lib/rpm/generic-hardened-cc1 -%_hardening_clang_cflags --config /usr/lib/rpm/generic-hardened-clang.cfg -%_hardening_cflags	 %{expand:%%{_hardening_%{toolchain}_cflags}} -%_hardening_ldflags	-Wl,-z,now %[ "%{toolchain}" == "gcc" ? "-specs=/usr/lib/rpm/generic-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/generic-pie-cc1 -%_pie_pre_ldflags  -Wl,-z,now -specs=/usr/lib/rpm/generic-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/generic-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 "%undefine _ld_as_needed" to disable. -%_ld_as_needed		1 -%_ld_as_needed_flags	%{?_ld_as_needed:-Wl,--as-needed} - -%_general_options         -O2 -g -grecord-gcc-switches -pipe -fstack-protector-strong %[ "%{toolchain}" == "clang" ? "-fgcc-compatible" : "" ] -%_warning_options         -Wall -Werror=format-security -%_preprocessor_defines    -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS - -%__global_compiler_flags %{_general_options} %{_warning_options} %{_preprocessor_defines} %{_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 loongarch64 powerpc64le ppc64le -%ldc_arches %{generic_arches} -%valgrind_arches %{generic_arches} -%nodejs_arches %{generic_arches} riscv64 -%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} -%ocaml_native_compiler   %{generic_arches} riscv64 -%ocaml_natdynlink        %{generic_arches} riscv64 -%ocaml_native_profiling  %{generic_arches} riscv64 -%openblas_arches 	 %{generic_arches} riscv64 - -#%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 %{nil} - -%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 || : - -# macros that used for perl -%__perl                 /usr/bin/perl -%requires_eq()  %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not") -%perl_sitearch  %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch) -%perl_sitelib   %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib) -%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch) -%perl_vendorlib  %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib) -%perl_archlib   %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib) -%perl_privlib   %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib) diff --git a/macros.forge b/macros.forge deleted file mode 100644 index 18e9dba..0000000 --- a/macros.forge +++ /dev/null @@ -1,283 +0,0 @@ -# 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. Don’t call the macro if you don’t -# 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 we’re 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} diff --git a/macros.go b/macros.go deleted file mode 100644 index f20f6a1..0000000 --- a/macros.go +++ /dev/null @@ -1,170 +0,0 @@ -# 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 riscv64 loongarch64 -%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 that’s 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. Don’t call the macro if you don’t -# 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 we’re 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} -} diff --git a/macros.kmp b/macros.kmp deleted file mode 100644 index 291066e..0000000 --- a/macros.kmp +++ /dev/null @@ -1,64 +0,0 @@ -# Use these macros to differentiate between @VENDOR@ and other KMP implementation(s). - -kernel_module_package_release  1 - -%__find_provides        /usr/lib/rpm/find-provides -%__find_requires        /usr/lib/rpm/@VENDOR@/find-requires - -#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ] -#                      [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ... - -%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \ -					kernel-devel - -%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ -	%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/@VENDOR@/kmodtool} \ -	%define kmp_version %{-v*}%{!-v:%{version}} \ -	%define kmp_release %{-r*}%{!-r:%{release}} \ -	%define latest_kernel %(rpm -q --qf '%%{VERSION}-%%{RELEASE}.%%{ARCH}\\\\n' `rpm -q kernel-devel | 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" \ -	if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \ -	then \ -		xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\ -		kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\ -		if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \ -		then \ -			flavors="$flavors xen" \ -		fi \ -		if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \ -		then \ -			flavors="$flavors kdump" \ -		fi \ -	fi \ -	if [ -z "%*" ]; then \ -		flavors_to_build=$flavors \ -	elif [ -z "%{-x}" ]; then \ -		flavors_to_build="%*" \ -	else \ -		flavors_to_build=" $flavors "\ -		rm -rf /tmp/tmp.$$ \ -		echo "[$flavors_to_build]" >/tmp/tmp.$$ \ -		for i in %* \ -		do \ -			flavors_to_build=${flavors_to_build//$i /} -		done \ -	fi \ -	echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \ -	echo "%%global kernel_source() /usr/src/kernels/%kverrel\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")" \ -	if [ ! -z "%{-f*}" ] \ -	then \ -		filelist="%{-f*}" \ -	fi \ -	if [ ! -z "%{-p*}" ] \ -	then \ -		preamble="%{-p*}" \ -	fi \ -	nobuildreqs="yes" \ -	if [ "x%{kmodtool_generate_buildreqs}" != "x1" ] \ -	then \ -		nobuildreqs="no" \ -	fi \ -	kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$nobuildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \ -)} diff --git a/macros.perl b/macros.perl deleted file mode 100644 index 9c1fd0c..0000000 --- a/macros.perl +++ /dev/null @@ -1,151 +0,0 @@ -# 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/ - diff --git a/macros.python b/macros.python deleted file mode 100644 index 334c0ab..0000000 --- a/macros.python +++ /dev/null @@ -1,328 +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 -%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 -} - -%pyproject_build() %{expand:\\\ -  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ -  %{__python3} -mpip wheel --verbose --progress-bar off --disable-pip-version-check --use-pep517 --no-build-isolation --no-deps --wheel-dir ./build .  %{?*} -  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} %{?*} -} - -%pyproject_install() %{expand:\\\ -  specifier=$(ls ./build/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/') -  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\ -  %{__python3} -mpip install --verbose --progress-bar off --disable-pip-version-check   --root %{buildroot} --no-compile --ignore-installed --no-deps --no-index --find-links ./build $specifier %{?*} -} - -%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 -    --No unversioned provides as python2 is not default -  elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then -    print("\\nProvides: python-") -    l = 8 + string.len(rpm.expand("%{python3_pkgversion}")) -    print(string.sub(package,l,string.len(package))) -    print(" = ") -    print(vr) -    --Obsoleting the previous default python package (if it doesn't have isa) -    if (string.sub(package, "-1") ~= ")") then -      print("\\nObsoletes: python-") -      print(string.sub(package,l,string.len(package))) -      print(" < ") -      print(vr) -    end -  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, "pypy2-")) 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 -    --No unversioned provides needed for unversioned python -  else -    print("%python_provide: ERROR: ") -    print(package) -    print(" not recognized.") -  end -} - -%python_enable_dependency_generator() \ -%global __pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires \ -%{nil} -%__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 -} -%__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('{0.major}.{0.minor}'.format(sys.version_info))") -%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))") -%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}  --no-deps -} -# 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) -} - -# New python macros -%__python /usr/bin/python -%python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())") -%python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))") -%python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])") - -# New python test macros -%pytest() %{expand:\\\ -CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\ -PATH="%{buildroot}%{_bindir}:$PATH" \\ -PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\ -PYTHONDONTWRITEBYTECODE=1 \\ -%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \\ -PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ -%{_bindir}/pytest %{?*} -} - -%tox() %{expand:\\\ -TOX_TESTENV_PASSENV="${TOX_TESTENV_PASSENV:-*}" \\ -CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\ -PATH="%{buildroot}%{_bindir}:$PATH" \\ -PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\ -PYTHONDONTWRITEBYTECODE=1 \\ -%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \\ -PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \\ -%{__python3} -m tox -e py%{python3_version_nodots} --current-env %{?*} -} diff --git a/openEuler-rpm-config-add-optflags-for-loongarch64-and-sw_64.patch b/openEuler-rpm-config-add-optflags-for-loongarch64-and-sw_64.patch new file mode 100644 index 0000000..a50dd54 --- /dev/null +++ b/openEuler-rpm-config-add-optflags-for-loongarch64-and-sw_64.patch @@ -0,0 +1,26 @@ +From ed8b90665c3bda8ca6bea1bf541e0232f03fb371 Mon Sep 17 00:00:00 2001 +From: yueyuankun <yueyuankun@kylinos.cn> +Date: Fri, 15 Mar 2024 11:17:38 +0800 +Subject: [PATCH] add optflags for loongarch64 and sw_64 + +--- + rpmrc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rpmrc b/rpmrc +index 10d7c86..45840e6 100644 +--- a/rpmrc ++++ b/rpmrc +@@ -8,6 +8,9 @@ optflags: x86_64 %{__global_compiler_flags} -m64 -mtune=generic -fasynchronous-u + optflags: aarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection + optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection +  ++optflags: loongarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection ++optflags: sw_64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection ++ + optflags: ppc64le %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection +  + buildarchtranslate: athlon: i686 +--  +2.43.0 + diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec index 96c2f95..938d5eb 100644 --- a/openEuler-rpm-config.spec +++ b/openEuler-rpm-config.spec @@ -2,56 +2,45 @@  %global rpmvdir /usr/lib/rpm/%{vendor}  Name:		%{vendor}-rpm-config -Version:	31 -Release:	3 +Version:	30 +Release:	59  License:	GPL+  Summary:	specific rpm configuration files -URL:		https://gitee.com/src-openeuler/openEuler-rpm-config -Buildarch:	noarch - -# Core rpm settings -Source0: macros -Source1: rpmrc - -# gcc specs files for hardened builds -Source10: generic-hardened-cc1 -Source11: generic-hardened-ld -Source12: generic-pie-cc1  -Source13: generic-pie-ld - -# clang config spec files -Source51: generic-hardened-clang.cfg - -# The macros defined by these files are for things that need to be defined -# at srpm creation time when it is not feasible to require the base packages -# that would otherwise be providing the macros. -Source100: macros.perl -Source101: macros.forge -Source102: macros.go -Source103: macros.python -Source104: macros.kmp - -# Dependency generator scripts -Source200: find-requires.ksyms - -# Misc helper scripts -Source300: kmodtool -Source301: find-requires - -# Snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git -Source500: config.guess -Source501: config.sub - -# BRPs -Source700: brp-chrpath -Source701: brp-digest-list -Source702: brp-ebs-sign -Source703: brp-ldconfig -Source704: brp-remove-info-dir -Source705: brp-check-elf-files - -# Convenience lua functions -Source800: common.lua +URL:		https://gitee.com/openeuler/openEuler-rpm-config + +Source0:        https://gitee.com/openeuler/openEuler-rpm-config/repository/archive/%{version}.tar.gz + +Patch0:         fix-error-message-for-kmodtool.patch +Patch1:         0001-1-Add-riscv64-to-golang_arches.patch +Patch2:         Fix-a-typo-in-brp-digest-list.patch +Patch3:         change-the-vendor-to-generic-for-common-use.patch +Patch4:         remove-fexceptions.patch +Patch5:         exclude-kernel-source-and-EFI-files-in-digest-list-building.patch +Patch6:         add-brp-scripts-to-delete-rpath.patch +Patch7:         add-common-script.patch +Patch8:         Fix-python3_version-macros-for-Python-3.10.patch +Patch9:         Give-a-warning-when-using-kabi-outside-our-stablelis.patch +Patch10:        fixed-a-bug-that-missing_-p-in-macros.kmp.patch +Patch11:        update-config.guess-and-config.sub-for-loongarch64.patch +Patch12:        add-loongarch64-to-generic_arches.patch +Patch13:	add-loongarch64-support-for-config.guess-and-config.sub.patch +Patch14:        backport-kmp-feature.patch +Patch15:	0001-add-loongarch64-for-golang_arches.patch +Patch16:	fix-config-error-for-loongarch64.patch +Patch17:	Feature-support-EBS-sign-for-IMA-digest-list.patch +Patch18:        fix-brp-ldconfig-riscv-default-library-directory.patch +Patch19:        add-pyproject-macros.patch +Patch20:        add-pytest-and-tox-macros.patch +Patch21:        check-if-the-file-is-a-symbolic-link-in-brp-digest-list.patch +Patch22:	fix-the-ELF-file-cannot-be-found-due-to-escape-of.patch +Patch23:	add-powerpc64le-and-ppc64le-support.patch +Patch24:	Delete-the-commented-code.patch +Patch25:	Add-support-for-selecting-clang-as-a-toolchain.patch +Patch26:	Call-set_build_flags-cc-before-build-check-and-insta.patch +Patch27:	openEuler-rpm-config-add-optflags-for-loongarch64-and-sw_64.patch +Patch28:	add-riscv64-to-some-arches-macro.patch +Patch29:	backport-Enable-as-needed-by-default.patch +Patch30:	0001-Enable-LTO-By-Default.patch  Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release}  Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} @@ -67,31 +56,30 @@ Provides: perl-srpm-macros = 1-28  Provides: rust-srpm-macros = 10-1  Provides: go-srpm-macros = 2-18  Provides: perl-macros = 4:5.32.0-1 -Obsoletes: perl-macros < 4:5.32.0-1 -Obsoletes: python-rpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} -Obsoletes: python2-rpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} -Obsoletes: python3-rpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} -Obsoletes: python-srpm-macros < %{?epoch:%{epoch}:}%{version}-%{release} -Obsoletes: fpc-srpm-macros < 1.1-6 -Obsoletes: ghc-srpm-macros < 1.4.2-8 -Obsoletes: gnat-srpm-macros < 4-6 -Obsoletes: nim-srpm-macros < 1-3 -Obsoletes: ocaml-srpm-macros < 5-4 -Obsoletes: openblas-srpm-macros < 2-4 -Obsoletes: perl-srpm-macros < 1-28 -Obsoletes: rust-srpm-macros < 10-1 -Obsoletes: go-srpm-macros < 2-18 +Obsoletes: perl-macros <= 4:5.32.0-1 +Obsoletes: python-rpm-macros <= %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: python2-rpm-macros <= %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: python3-rpm-macros <= %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: python-srpm-macros <= %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: fpc-srpm-macros <= 1.1-6 +Obsoletes: ghc-srpm-macros <= 1.4.2-8 +Obsoletes: gnat-srpm-macros <= 4-6 +Obsoletes: nim-srpm-macros <= 1-3 +Obsoletes: ocaml-srpm-macros <= 5-4 +Obsoletes: openblas-srpm-macros <= 2-4 +Obsoletes: perl-srpm-macros <= 1-28 +Obsoletes: rust-srpm-macros <= 10-1 +Obsoletes: go-srpm-macros <= 2-18  %if "%{vendor}" != "openEuler"  Provides: openEuler-rpm-config = %{?epoch:%{epoch}:}%{version}-%{release} -Obsoletes: openEuler-rpm-config < %{?epoch:%{epoch}:}%{version}-%{release} +Obsoletes: openEuler-rpm-config <= %{?epoch:%{epoch}:}%{version}-%{release}  %endif  Requires: efi-srpm-macros  Requires: qt5-srpm-macros -Requires: rpm >= 4.17.0 -Requires: rpm-build >= 4.17.0 +Requires: rpm >= 4.11.0  Requires: zip  Requires: curl  #Requires: (annobin if gcc) @@ -102,9 +90,10 @@ Requires: %{_bindir}/file  Requires: %{_bindir}/grep  Requires: %{_bindir}/sed  Requires: %{_bindir}/xargs -Requires: %{_bindir}/chrpath +%if "%{_arch}" == "riscv64"  Requires: coreutils +%endif  # -fstack-clash-protection and -fcf-protection require GCC 8.  Conflicts: gcc < 7 @@ -121,14 +110,12 @@ Summary: Macros and scripts for building kernel module packages  Macros and scripts for building kernel module packages.  %prep -%setup -Tc -n %{name}-%{version} -cp %{_sourcedir}/* . -rm -f generic-rpm-config.yaml  -%autopatch -p1 +%autosetup -n openEuler-rpm-config -p1  %install  mkdir -p %{buildroot}%{rpmvdir} -install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc +install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc lto_white_list +install -p -m 755 -t %{buildroot}%{rpmvdir} lto_flag  install -p -m 755 -t %{buildroot}%{rpmvdir} config.*  install -p -m 755 -t %{buildroot}%{_rpmconfigdir} brp-*  install -p -m 644 -t %{buildroot}%{_rpmconfigdir} generic-* @@ -144,12 +131,14 @@ mkdir -p %{buildroot}%{_rpmluadir}/%{_vendor}/{rpm,srpm}  install -p -m 644 -t %{buildroot}%{_rpmluadir}/%{_vendor} common.lua  # Adaptive according to vendor -sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir}` +sed -i "s/__vendor/%{vendor}/g" `grep "__vendor" -rl %{buildroot}%{_rpmconfigdir}`  %files  %dir %{rpmvdir}  %{rpmvdir}/macros  %{rpmvdir}/rpmrc +%{rpmvdir}/lto_flag +%{rpmvdir}/lto_white_list  %{_rpmconfigdir}/brp-*  %{rpmvdir}/config.*  %{_rpmconfigdir}/generic-* @@ -159,25 +148,15 @@ sed -i "s/@VENDOR@/%{vendor}/g" `grep "@VENDOR@" -rl %{buildroot}%{_rpmconfigdir  %exclude %{_rpmconfigdir}/macros.d/macros.kmp  %files -n kernel-rpm-macros +%exclude %{_prefix}/lib/rpm/*/__pycache__/*  %{rpmvdir}/kmodtool  %{_rpmconfigdir}/macros.d/macros.kmp  %{rpmvdir}/find-requires  %{rpmvdir}/find-requires.ksyms  %changelog -* Thu Aug 29 2024 Funda Wang <fudnawang@yeah.net> - 31-3 -- Output elf check result for maintainer to analyse - -* Thu Aug 29 2024 Funda Wang <fudnawang@yeah.net> - 31-2 -- remove /usr/share/info/dir in buildroot automatically - -* Sun Aug 25 2024 Funda Wang <fudnawang@yeah.net> - 31-1 -- merge two messy repositories -- update config.sub and config.guess, without support on loongarchx32, -  as it does not exist in real world -- add chrpath and coreutils runtime dependecies -- bump rpm version requirement for brp-remove-la-files -- package becomes noarch now +* Wed Aug 21 2024 wangchunyang <wangchunyang15@huawei.com> - 30-59 +- Enable LTO By Default  * Tue Aug 6 2024 liyunfei <liyunfei33@huawei.com> - 30-58  - Fix for "%undefine _auto_set_build_XX" usage diff --git a/remove-fexceptions.patch b/remove-fexceptions.patch new file mode 100644 index 0000000..d198123 --- /dev/null +++ b/remove-fexceptions.patch @@ -0,0 +1,36 @@ +From 783b74a4778101223da41c8d3eb0457a1f9938f2 Mon Sep 17 00:00:00 2001 +From: Yangyang Shen <shenyangyang4@huawei.com> +Date: Thu, 18 Mar 2021 16:00:27 +0800 +Subject: [PATCH] openEuler remove fexceptions + +--- + macros | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/macros b/macros +index b06faea..118614d 100644 +--- a/macros ++++ b/macros +@@ -27,8 +27,8 @@ + # ---- compiler flags. +  + %build_cflags %{optflags} +-%build_cxxflags %{optflags} +-%build_fflags %{optflags} -I%{_fmoddir} ++%build_cxxflags %{optflags} -fexceptions ++%build_fflags %{optflags} -fexceptions -I%{_fmoddir} + %build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} +  + %set_build_flags \ +@@ -177,7 +177,7 @@ + #%_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}  ++%__global_compiler_flags	-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags}  +  + # Automatically trim changelog entries after 2 years + %_changelog_trimtime	%{lua:print(os.time() - 2 * 365 * 86400)} +--  +2.23.0 + @@ -1,25 +0,0 @@ -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 -optflags: riscv64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection - -optflags: loongarch64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection -optflags: sw_64 %{__global_compiler_flags} -fasynchronous-unwind-tables -fstack-clash-protection - -optflags: ppc64le %{__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 @@ -0,0 +1 @@ +51eb1809aa9bc05c281ad801f61b7f42  30.tar.gz diff --git a/update-config.guess-and-config.sub-for-loongarch64.patch b/update-config.guess-and-config.sub-for-loongarch64.patch new file mode 100644 index 0000000..4e4b88a --- /dev/null +++ b/update-config.guess-and-config.sub-for-loongarch64.patch @@ -0,0 +1,39 @@ +From fe6cff21eb18cc05704db85520db57c0d58bd2d3 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang <zhangwenlong@loongson.cn> +Date: Tue, 12 Apr 2022 22:31:41 +0800 +Subject: [PATCH] update config.guess and config.sub for loongarch64 + +--- + macros | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/macros b/macros +index 5c7447b..dc8c749 100644 +--- a/macros ++++ b/macros +@@ -49,6 +49,22 @@ + # ---- configure and makeinstall. + %_configure_gnuconfig_hack	1 + %_configure_libtool_hardening_hack	1 ++ ++#update config.guess and config.sub ++%_update_config_guess \ ++  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find . -name config.guess) ; do \ ++      [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && \ ++      %{__rm} -f $i && \ ++      %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ ++  done ; ++ ++%_update_config_sub \ ++  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find . -name config.sub) ; do \ ++      [ -f /usr/lib/rpm/%{_vendor}/$(basename $i) ] && \ ++      %{__rm} -f $i && \ ++      %{__cp} -fv /usr/lib/rpm/%{_vendor}/$(basename $i) $i ; \ ++  done ; ++ + %configure \ +   %{set_build_flags}; \ +   [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \ +--  +2.27.0 +  | 
