diff options
author | CoprDistGit <infra@openeuler.org> | 2025-01-15 06:47:29 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-01-15 06:47:29 +0000 |
commit | 9d624aa4e88e5eb4b0df90060dcd40e518a7458b (patch) | |
tree | 70292c74c2ab4db698615e7d823d9357eeaced7f | |
parent | 1175fc575d157169d8592e937cba42181d0ec3f2 (diff) |
automatic import of openEuler-rpm-config
36 files changed, 7683 insertions, 0 deletions
diff --git a/0001-support-sw_64-arch.patch b/0001-support-sw_64-arch.patch new file mode 100644 index 0000000..2e150e4 --- /dev/null +++ b/0001-support-sw_64-arch.patch @@ -0,0 +1,44 @@ +From 62d742713b0d6ed67fad52821541a7d83f4ce702 Mon Sep 17 00:00:00 2001 +From: Funda Wang <fundawang@yeah.net> +Date: Sun, 12 Jan 2025 23:02:47 +0800 +Subject: [PATCH] support sw_64 arch + +--- + config.guess | 8 ++++++++ + config.sub | 1 + + 2 files changed, 9 insertions(+) + +diff --git a/config.guess b/config.guess +index 48a6846..b8fc0ac 100755 +--- a/config.guess ++++ b/config.guess +@@ -1194,6 +1186,14 @@ EOF + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi ++ GUESS=$UNAME_MACHINE-sunway-linux-$LIBC ++ ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +diff --git a/config.sub b/config.sub +index 4aaae46..d49ee9b 100755 +--- a/config.sub ++++ b/config.sub +@@ -1432,6 +1431,7 @@ case $cpu-$vendor in + | sparcv9v \ + | spu \ + | sv1 \ ++ | sw_64 \ + | sx* \ + | tahoe \ + | thumbv7* \ +-- +2.46.0 + diff --git a/brp-check-elf-files b/brp-check-elf-files new file mode 100644 index 0000000..d9db6b0 --- /dev/null +++ b/brp-check-elf-files @@ -0,0 +1,37 @@ +#!/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 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/brp-clean-perl-files b/brp-clean-perl-files new file mode 100644 index 0000000..ca30d63 --- /dev/null +++ b/brp-clean-perl-files @@ -0,0 +1,31 @@ +#!/bin/sh + +if [ -z "$RPM_BUILD_ROOT" ]; then + printf '%s\n' "No build root defined" >&2 + exit 1 +fi + +if [ ! -d "$RPM_BUILD_ROOT" ]; then + printf '%s\n' "Invalid build root" >&2 + exit 1 +fi + +perldirs="$RPM_BUILD_ROOT/usr/lib/perl5 $RPM_BUILD_ROOT/usr/lib64/perl5 $RPM_BUILD_ROOT/usr/share/perl5" +d="" +for i in $perldirs; do + [ -d "$i" ] || continue + d="$d $i" +done +[ -z "$d" ] && exit 0 + +find $d -name ".packlist" -o -name perllocal.pod | xargs rm -f + +for i in $(find $d -name "*.bs"); do + if [ -s "$i" ]; then + printf '%s\n' "non empty .bs file!" + else + rm -f "$i" + fi +done + +find $d -depth -type d -exec rmdir {} 2>/dev/null \; diff --git a/brp-digest-list b/brp-digest-list new file mode 100755 index 0000000..645f5e4 --- /dev/null +++ b/brp-digest-list @@ -0,0 +1,108 @@ +#!/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 + +# 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 +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 + + [ -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 new file mode 100755 index 0000000..885d7aa --- /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 diff --git a/brp-ldconfig b/brp-ldconfig new file mode 100755 index 0000000..7b2fb15 --- /dev/null +++ b/brp-ldconfig @@ -0,0 +1,16 @@ +#!/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-llvm-compile-lto-elf b/brp-llvm-compile-lto-elf new file mode 100644 index 0000000..9ef4d40 --- /dev/null +++ b/brp-llvm-compile-lto-elf @@ -0,0 +1,57 @@ +#!/usr/bin/bash -eu +# From fedora: +# https://src.fedoraproject.org/rpms/redhat-rpm-config +# version 287 + + +if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then + exit 0 +fi + +CLANG_FLAGS=$@ +NCPUS=${RPM_BUILD_NCPUS:-1} + +check_convert_bitcode () { + local file_name=$(realpath ${1}) + local file_type=$(file ${file_name}) + + shift + CLANG_FLAGS="$@" + + if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then + # Check the output of llvm-strings for the command line, which is in the LLVM bitcode because + # we pass -frecord-gcc-switches. + # Check for a line that has "-flto" after (or without) "-fno-lto". + llvm-strings ${file_name} | while read line ; do + flto=$(echo $line | grep -o -b -e -flto | tail -n 1 | cut -d : -f 1) + fnolto=$(echo $line | grep -o -b -e -fno-lto | tail -n 1 | cut -d : -f 1) + + if test -n "$flto" && { test -z "$fnolto" || test "$flto" -gt "$fnolto"; } ; then + echo "Compiling LLVM bitcode file ${file_name}." + clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \ + -x ir ${file_name} -c -o ${file_name} + break + fi + done + elif [[ "${file_type}" == *"current ar archive"* ]]; then + echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components." + # create archive stage for objects + local archive_stage=$(mktemp -d) + local archive=${file_name} + pushd ${archive_stage} + ar x ${archive} + for archived_file in $(find -not -type d); do + check_convert_bitcode ${archived_file} ${CLANG_FLAGS} + echo "Repacking ${archived_file} into ${archive}." + ar r ${archive} ${archived_file} + done + popd + fi +} + +echo "Checking for LLVM bitcode artifacts" +export -f check_convert_bitcode +# Deduplicate by device:inode to avoid processing hardlinks in parallel. +find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -printf "%D:%i %p\n" | \ + awk '!seen[$1]++' | cut -d" " -f2- | \ + xargs -d"\n" -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0 diff --git a/brp-remove-info-dir b/brp-remove-info-dir new file mode 100644 index 0000000..5961830 --- /dev/null +++ b/brp-remove-info-dir @@ -0,0 +1,19 @@ +#!/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/brp-strip-lto b/brp-strip-lto new file mode 100644 index 0000000..8890541 --- /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/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, +} diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..48a6846 --- /dev/null +++ b/config.guess @@ -0,0 +1,1815 @@ +#! /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 new file mode 100755 index 0000000..4aaae46 --- /dev/null +++ b/config.sub @@ -0,0 +1,2354 @@ +#! /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/find-provides.nbdkit b/find-provides.nbdkit new file mode 100644 index 0000000..7013ccd --- /dev/null +++ b/find-provides.nbdkit @@ -0,0 +1,23 @@ +#!/bin/bash - + +# Generate RPM provides automatically for nbdkit packages and filters. +# Copyright (C) 2009-2022 Red Hat Inc. + +# To test: +# find /usr/lib64/nbdkit/plugins | ./nbdkit-find-provides VER REL +# find /usr/lib64/nbdkit/filters | ./nbdkit-find-provides VER REL + +ver="$1" +rel="$2" + +function process_file +{ + if [[ $1 =~ /plugins/nbdkit-.*-plugin ]] || + [[ $1 =~ /filters/nbdkit-.*-filter ]]; then + echo "Provides:" "$(basename $1 .so)" "=" "$ver-$rel" + fi +} + +while read line; do + process_file "$line" +done diff --git a/find-requires b/find-requires new file mode 100755 index 0000000..3e61e59 --- /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 100755 index 0000000..42af85f --- /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/fix-libtool-from-moving-options-after-libs b/fix-libtool-from-moving-options-after-libs new file mode 100644 index 0000000..1f4d5ad --- /dev/null +++ b/fix-libtool-from-moving-options-after-libs @@ -0,0 +1,15 @@ +#!/usr/bin/sh +# Copyright 2011-2023, Mageia +# Modified 2024, Funda Wang <fundawang@yeah.net> +# Licensed under GPL-2.0-or-later + +CONFIGURE_TOP="${1:-.}" +if [ -e $CONFIGURE_TOP/configure ] && grep -q -F '$deplibs $compiler_flags' $CONFIGURE_TOP/configure; then + echo "Fixing libtool inside configure to pass -Wl,xxx options earliest" + + sed -i \ + -e 's,$libobjs $deplibs $compiler_flags,$compiler_flags $libobjs $deplibs,' \ + -e 's,$predep_objects $libobjs $deplibs $postdep_objects $compiler_flags,$compiler_flags $predep_objects $libobjs $deplibs $postdep_objects,' \ + $CONFIGURE_TOP/configure +fi + diff --git a/generic-hardened-cc1 b/generic-hardened-cc1 new file mode 100644 index 0000000..fc54bcb --- /dev/null +++ b/generic-hardened-cc1 @@ -0,0 +1,2 @@ +*cc1_options: ++ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} 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/generic-hardened-ld b/generic-hardened-ld new file mode 100644 index 0000000..bd6b907 --- /dev/null +++ b/generic-hardened-ld @@ -0,0 +1,2 @@ +*self_spec: ++ %{!static:%{!shared:%{!r:-pie}}} diff --git a/generic-pie-cc1 b/generic-pie-cc1 new file mode 100644 index 0000000..95615fa --- /dev/null +++ b/generic-pie-cc1 @@ -0,0 +1,2 @@ +*cc1_options: ++ %{!r:%{!D__KERNEL__:%{!pie:%{!fpic:%{!fPIC:%{!fpie:%{!fPIE:%{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE:%{!shared:%{!static:%{!nostdlib:%{!nostartfiles:-fPIE}}}}}}}}}}}}}}} diff --git a/generic-pie-ld b/generic-pie-ld new file mode 100644 index 0000000..ff33f64 --- /dev/null +++ b/generic-pie-ld @@ -0,0 +1,2 @@ +*self_spec: ++ %{!D__KERNEL__:%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r:%{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}} diff --git a/infopages.attr b/infopages.attr new file mode 100644 index 0000000..805c570 --- /dev/null +++ b/infopages.attr @@ -0,0 +1,4 @@ +%__infopages_requires() %{lua: + print(string.format("/usr/bin/info", rpm.expand("%1"))) +} +%__infopages_path ^%{_infodir}/.* diff --git a/kmodtool b/kmodtool new file mode 100755 index 0000000..fc69d9b --- /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 + @@ -0,0 +1,495 @@ +# 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} + +# When clang is used as a linker driver, it does not auto-detect the LTO +# bytecode and neither does bfd, so we need to explicitly pass the -flto +# flag when linking. +%_clang_extra_ldflags %{?_lto_cflags} + +%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_clang_extra_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}" : ""] + +# Internal-only. Do not use. Expand a variable and strip the flags +# not suitable to extension builders. +%__extension_strip_flags() %{lua: +--the only argument to this macro is the "name" of the flags we strip (e.g. cflags, ldflags, etc.) +local name = rpm.expand("%{1}") +--store all the individual flags in a variable as a continuous string +local flags = rpm.expand("%{build_" .. name .. "}") +--create an empty table for the minimal set of flags we wanna preserve +local stripped_flags = { } +--iterate over the individual flags and store the ones we want in the table as unique keys +for flag in flags:gmatch("%S+") do + if flag:find("^%-fexceptions") or flag:find("^%-fcf%-protection") then + stripped_flags[flag] = true end + end +--print out the finalized set of flags for use by the extension builders +for k,_ in pairs(stripped_flags) do print(k .. " ") end +} + +# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within +# extension builders. +%extension_cflags %{__extension_strip_flags cflags} +%extension_cxxflags %{__extension_strip_flags cxxflags} +%extension_fflags %{__extension_strip_flags fflags} +%extension_ldflags %{__extension_strip_flags ldflags} + +#For backwards compatibility only. +%__global_cflags %{build_cflags} +%__global_cxxflags %{build_cxxflags} +%__global_fflags %{build_fflags} +%__global_fcflags %{build_fflags} +%__global_ldflags %{build_ldflags} + +#============================================================================== +# ---- configure and makeinstall. +%_configure_gnuconfig_hack 1 +%_configure_libtool_hardening_hack 1 + +#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 ; + +# This fixes various easy resolved configure tests that are compromised by LTO. +# +# We use this within the standard %configure macro, but also make it available +# for packages which don't use %configure +# +# The first three are common ways to test for the existence of a function, so +# we ensure the reference to the function is preserved +# +# The fourth are constants used to then try to generate NaNs and other key +# floating point numbers. We then use those special FP numbers to try and +# raise a SIGFPE. By declaring x & y volatile we prevent the optimizers +# from removing the computation +# +# The fifth (and worst) addresses problems with autoconf/libtool's approach +# to extracting symbols from .o files and generating C code. In an LTO world +# types matter much more closely and you can't have an object in one context +# that is a function definition and a simple scalar variable in another. +# Thankfully HP-UX has always had that restriction and is supported by +# autoconf/libtool. The insane sed script replaces the "generic" code with +# the HP-UX version. +# +# If we do not make changes, we put the original file back. This avoids +# unnecessary rebuilds of things that may have dependencies on the configure +# files. +# +%_fix_broken_configure_for_lto \ + for file in $(find . -type f -name configure -print); do \ + %{__sed} -r --in-place=.backup 's/^char \\(\\*f\\) \\(\\) = /__attribute__ ((used)) char (*f) () = /g' $file; \ + diff -u $file.backup $file && mv $file.backup $file \ + %{__sed} -r --in-place=.backup 's/^char \\(\\*f\\) \\(\\);/__attribute__ ((used)) char (*f) ();/g' $file; \ + diff -u $file.backup $file && mv $file.backup $file \ + %{__sed} -r --in-place=.backup 's/^char \\$2 \\(\\);/__attribute__ ((used)) char \\$2 ();/g' $file; \ + diff -u $file.backup $file && mv $file.backup $file \ + %{__sed} --in-place=.backup '1{$!N;$!N};$!N;s/int x = 1;\\nint y = 0;\\nint z;\\nint nan;/volatile int x = 1; volatile int y = 0; volatile int z, nan;/;P;D' $file; \ + diff -u $file.backup $file && mv $file.backup $file \ + %{__sed} --in-place=.backup 's#^lt_cv_sys_global_symbol_to_cdecl=.*#lt_cv_sys_global_symbol_to_cdecl="sed -n -e '"'"'s/^T .* \\\\(.*\\\\)$/extern int \\\\1();/p'"'"' -e '"'"'s/^$symcode* .* \\\\(.*\\\\)$/extern char \\\\1;/p'"'"'"#' $file; \ + diff -u $file.backup $file && mv $file.backup $file \ + done + +%__fix_libtool_from_moving_options_after_libs /usr/lib/rpm/fix-libtool-from-moving-options-after-libs $(dirname %{_configure}) + +%configure \ + %{set_build_flags}; \ + [ "%{_lto_cflags}"x != x ] && %{_fix_broken_configure_for_lto}; \ + %{?_ld_as_needed:%{__fix_libtool_from_moving_options_after_libs} ;} \ + [ "%_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}" : ""]\ + export AM_UPDATE_INFO_DIR="no"\ +%{nil} + +# ---- Expanded at end of %install scriptlet. +%__arch_install_post /usr/lib/rpm/check-buildroot + +# Default extension to use (for man pages and info files) +%_extension .gz + +# 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_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_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 +%__brp_clean_perl_files /usr/lib/rpm/brp-clean-perl-files +%__brp_llvm_compile_lto_elf /usr/lib/rpm/brp-llvm-compile-lto-elf %{build_cflags} %{build_ldflags} + +%__os_install_post \ + %{?__brp_ldconfig} \ + %{?__brp_compress} \ + %{!?__debug_package:\ + %{?__brp_strip} \ + %{?__brp_strip_comment_note} \ + } \ + %{?__brp_strip_lto} \ + %{?__brp_strip_static_archive} \ + %{?__brp_check_elf_files} \ + %{?__brp_remove_la_files} \ + %{?__brp_remove_info_dir} \ + %{?__brp_clean_perl_files} \ + %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ + %{?__brp_python_hardlink} \ +%{nil} + +%__spec_install_post\ + %[ "%{toolchain}" == "clang" ? "%{?__brp_llvm_compile_lto_elf}" : "%{nil}" ] \ + %{?__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} + +# LTO is the default in openEuler since 25.03. +# "%define _lto_cflags %{nil}" to opt out +# +# We currently have -ffat-lto-objects turned on out of an abundance of +# caution. To remove it we need to do a check of the installed .o/.a files +# to verify they have real sections/symbols after LTO stripping. That +# way we can detect installing an unusable .o/.a file. +%_gcc_lto_cflags -flto=auto -ffat-lto-objects +%_clang_lto_cflags -flto=thin +%_lto_cflags %{expand:%%{_%{toolchain}_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 + +%__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 sw_64 +%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 l -name '*.la' 2>/dev/null -print0 | xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null | xargs -0 rm --force \ +find "$RPM_BUILD_ROOT" -type f -name '*.la' 2>/dev/null -print0 | xargs -0 grep --fixed-strings '.la - a libtool library file' --files-with-matches --null | xargs -0 rm --force \ +find "$RPM_BUILD_ROOT" -type l -name "*.a" -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 \ +\ +%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 new file mode 100644 index 0000000..18e9dba --- /dev/null +++ b/macros.forge @@ -0,0 +1,283 @@ +# Map forge information to rpm metadata. This macro will compute default spec +# variable values. +# +# The following spec variables SHOULD be set before calling the macro: +# +# forgeurl the project url on the forge, strongly recommended; +# alternatively, use -u <url> +# Version if applicable, set it with Version: <version> +# tag if applicable +# commit if applicable +# date if applicable (to override the mtime of the Source archive) +# +# The macro will attempt to compute and set the following variables if they are +# not already set by the packager: +# +# forgesource an URL that can be used as SourceX: value +# forgesetupargs the correct arguments to pass to %setup for this source +# used by %forgesetup and %forgeautosetup +# archivename the source archive filename, without extentions +# archiveext the source archive filename extensions, without leading dot +# archiveurl the url that can be used to download the source archive, +# without renaming +# scm the scm type, when packaging code snapshots: commits or tags +# +# If the macro is unable to parse your forgeurl value set at least archivename +# and archiveurl before calling it. +# +# Most of the computed variables are both overridable and optional. However, +# the macro WILL REDEFINE %{dist} when packaging a snapshot (commit or tag). +# The previous %{dist} value will be lost. 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 new file mode 100644 index 0000000..f20f6a1 --- /dev/null +++ b/macros.go @@ -0,0 +1,170 @@ +# Copyright (c) 2015-2018 Jakub Cajka <jcajka@redhat.com>, +# Jan Chaloupka <jchaloup@redhat.com>, +# Nicolas Mailhot <nim@fedoraproject.org> +# This file is distributed under the terms of GNU GPL license version 3, or +# any later version. + +# This file contains macros for building projects in golang for packages +# with golang compiler or gcc-go compiler based on an architecture. +# Golang is primarly for primary architectures, gcc-go for secondary. +# +# This file provides only macros and must not use any other package except +# redhat-rpm-macros. + +# Define arches for PA and SA +%golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x 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 new file mode 100644 index 0000000..291066e --- /dev/null +++ b/macros.kmp @@ -0,0 +1,64 @@ +# 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 new file mode 100644 index 0000000..9c1fd0c --- /dev/null +++ b/macros.perl @@ -0,0 +1,151 @@ +# Sensible Perl-specific RPM build macros. +# +# Note that these depend on the generic filtering system being in place in +# rpm core; but won't cause a build to fail if they're not present. +# +# Chris Weyl <cweyl@alumni.drew.edu> 2009 +# Marcela Mašláňová <mmaslano@redhat.com> 2011 + +# This macro unsets several common vars used to control how Makefile.PL (et +# al) build and install packages. We also set a couple to help some of the +# common systems be less interactive. This was blatantly stolen from +# cpanminus, and helps building rpms locally when one makes extensive use of +# local::lib, etc. +# +# Usage, in %build, before "%{__perl} Makefile.PL ..." +# +# %{?perl_ext_env_unset} + +%perl_ext_env_unset %{expand: +unset PERL_MM_OPT MODULEBUILDRC PERL5INC +export PERL_AUTOINSTALL="--defaultdeps" +export PERL_MM_USE_DEFAULT=1 +} + +############################################################################# +# Filtering macro incantations + +# keep track of what "revision" of the filtering we're at. Each time we +# change the filter we should increment this. + +%perl_default_filter_revision 3 + +# By default, for perl packages we want to filter all files in _docdir from +# req/prov scanning. +# Filtering out any provides caused by private libs in vendorarch/archlib +# (vendor/core) is done by rpmbuild since Fedora 20 +# <https://fedorahosted.org/fpc/ticket/353>. +# +# Note that this must be invoked in the spec file, preferably as +# "%{?perl_default_filter}", before any %description block. + +%perl_default_filter %{expand: \ +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_docdir} +%global __requires_exclude_from %{?__requires_exclude_from:%__requires_exclude_from|}^%{_docdir} +%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\\\(VMS|^perl\\\\(Win32|^perl\\\\(DB\\\\)|^perl\\\\(UNIVERSAL\\\\) +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\\\(VMS|^perl\\\\(Win32 +} + +############################################################################# +# Macros to assist with generating a "-tests" subpackage in a semi-automatic +# manner. +# +# The following macros are still in a highly experimental stage and users +# should be aware that the interface and behaviour may change. +# +# PLEASE, PLEASE CONDITIONALIZE THESE MACROS IF YOU USE THEM. +# +# See http://gist.github.com/284409 + +# These macros should be invoked as above, right before the first %description +# section, and conditionalized. e.g., for the common case where all our tests +# are located under t/, the correct usage is: +# +# %{?perl_default_subpackage_tests} +# +# If custom files/directories need to be specified, this can be done as such: +# +# %{?perl_subpackage_tests:%perl_subpackage_tests t/ one/ three.sql} +# +# etc, etc. + +%perl_version %(eval "`%{__perl} -V:version`"; echo $version) +%perl_testdir %{_libexecdir}/perl5-tests +%cpan_dist_name %(eval echo %{name} | %{__sed} -e 's/^perl-//') + +# easily mark something as required by -tests and BR to the main package +%tests_req() %{expand:\ +BuildRequires: %*\ +%%tests_subpackage_requires %*\ +} + +# fixup (and create if needed) the shbang lines in tests, so they work and +# rpmlint doesn't (correctly) have a fit +%fix_shbang_line() \ +TMPHEAD=`mktemp`\ +TMPBODY=`mktemp`\ +for file in %* ; do \ + head -1 $file > $TMPHEAD\ + tail -n +2 $file > $TMPBODY\ + %{__perl} -pi -e '$f = /^#!/ ? "" : "#!%{__perl}$/"; $_="$f$_"' $TMPHEAD\ + cat $TMPHEAD $TMPBODY > $file\ +done\ +%{__perl} -MExtUtils::MakeMaker -e "ExtUtils::MM_Unix->fixin(qw{%*})"\ +%{__rm} $TMPHEAD $TMPBODY\ +%{nil} + +# additional -tests subpackage requires, if any +%tests_subpackage_requires() %{expand: \ +%global __tests_spkg_req %{?__tests_spkg_req} %* \ +} + +# additional -tests subpackage provides, if any +%tests_subpackage_provides() %{expand: \ +%global __tests_spkg_prov %{?__tests_spkg_prov} %* \ +} + +# +# Runs after the body of %check completes. +# + +%__perl_check_pre %{expand: \ +%{?__spec_check_pre} \ +pushd %{buildsubdir} \ +%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \ +%{__mkdir_p} %{perl_br_testdir} \ +%{__tar} -cf - %{__perl_test_dirs} | ( cd %{perl_br_testdir} && %{__tar} -xf - ) \ +find . -maxdepth 1 -type f -name '*META*' -exec %{__cp} -vp {} %{perl_br_testdir} ';' \ +find %{perl_br_testdir} -type f -exec %{__chmod} -c -x {} ';' \ +T_FILES=`find %{perl_br_testdir} -type f -name '*.t'` \ +%fix_shbang_line $T_FILES \ +%{__chmod} +x $T_FILES \ +%{_fixperms} %{perl_br_testdir} \ +popd \ +} + +# +# The actual invoked macro +# + +%perl_subpackage_tests() %{expand: \ +%global __perl_package 1\ +%global __perl_test_dirs %* \ +%global __spec_check_pre %{expand:%{__perl_check_pre}} \ +%package tests\ +Summary: Test suite for package %{name}\ +Group: Development/Debug\ +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}\ +Requires: /usr/bin/prove \ +%{?__tests_spkg_req:Requires: %__tests_spkg_req}\ +%{?__tests_spkg_prov:Provides: %__tests_spkg_prov}\ +AutoReqProv: 0 \ +%description tests\ +This package provides the test suite for package %{name}.\ +%files tests\ +%defattr(-,root,root,-)\ +%{perl_testdir}\ +} + +# shortcut sugar +%perl_default_subpackage_tests %perl_subpackage_tests t/ + diff --git a/macros.python b/macros.python new file mode 100644 index 0000000..59df735 --- /dev/null +++ b/macros.python @@ -0,0 +1,342 @@ +# 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:\\\ + %{__python} -m pip install -I dist/%{1} --root %{buildroot} --prefix %{_prefix} --no-deps --no-index --no-warn-script-location + rm -rfv %{buildroot}%{_bindir}/__pycache__ + for distinfo in %{buildroot}%{python_sitelib}/*.dist-info %{buildroot}%{python_sitearch}/*.dist-info; do + if [ -f ${distinfo}/direct_url.json ]; then + rm -fv ${distinfo}/direct_url.json + sed -i '/direct_url.json/d' ${distinfo}/RECORD + fi + done +} + +%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:\\\ + %{__python3} -m pip install -I dist/%{1} --root %{buildroot} --prefix %{_prefix} --no-deps --no-index --no-warn-script-location + rm -rfv %{buildroot}%{_bindir}/__pycache__ + for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info %{buildroot}%{python3_sitearch}/*.dist-info; do + if [ -f ${distinfo}/direct_url.json ]; then + rm -fv ${distinfo}/direct_url.json + sed -i '/direct_url.json/d' ${distinfo}/RECORD + fi + done +} +# 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/macros.shell-completions b/macros.shell-completions new file mode 100644 index 0000000..8e505d7 --- /dev/null +++ b/macros.shell-completions @@ -0,0 +1,3 @@ +%bash_completions_dir %{_datadir}/bash-completion/completions +%zsh_completions_dir %{_datadir}/zsh/site-functions +%fish_completions_dir %{_datadir}/fish/vendor_completions.d diff --git a/manpages.attr b/manpages.attr new file mode 100644 index 0000000..6b4cbd7 --- /dev/null +++ b/manpages.attr @@ -0,0 +1,4 @@ +%__manpages_requires() %{lua: + print(string.format("/usr/bin/man", rpm.expand("%1"))) +} +%__manpages_path ^%{_mandir}/.* diff --git a/nbdkit.attr b/nbdkit.attr new file mode 100644 index 0000000..1053e1a --- /dev/null +++ b/nbdkit.attr @@ -0,0 +1,3 @@ +%__nbdkit_provides %{_rpmconfigdir}/@VENDOR@/find-provides.nbdkit %{version} %{release} +%__nbdkit_path %{_libdir}/nbdkit/(plugins|filters)/nbdkit-.*-(plugin|filter)(\.so)?$ +%__nbdkit_flags exeonly diff --git a/openEuler-rpm-config.spec b/openEuler-rpm-config.spec new file mode 100644 index 0000000..a36338f --- /dev/null +++ b/openEuler-rpm-config.spec @@ -0,0 +1,484 @@ +%global vendor %{?_vendor:%{_vendor}}%{!?_vendor:openEuler} +%global rpmvdir /usr/lib/rpm/%{vendor} + +Name: %{vendor}-rpm-config +Version: 31 +Release: 12 +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 +Source105: macros.shell-completions + +# Dependency generator scripts +Source200: find-requires.ksyms +Source201: infopages.attr +Source202: manpages.attr +Source203: nbdkit.attr +Source204: find-provides.nbdkit + +# Misc helper scripts +Source300: kmodtool +Source301: find-requires +Source303: fix-libtool-from-moving-options-after-libs + +# Snapshots from http://git.savannah.gnu.org/gitweb/?p=config.git +Source500: config.guess +Source501: config.sub +Patch0001: 0001-support-sw_64-arch.patch + +# 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 +Source706: brp-strip-lto +Source707: brp-clean-perl-files +Source708: brp-llvm-compile-lto-elf + +# Convenience lua functions +Source800: common.lua + +Provides: python-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: python2-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: python3-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: python-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} +Provides: fpc-srpm-macros = 1.1-6 +Provides: ghc-srpm-macros = 1.4.2-8 +Provides: gnat-srpm-macros = 4-6 +Provides: nim-srpm-macros = 1-3 +Provides: ocaml-srpm-macros = 5-4 +Provides: openblas-srpm-macros = 2-4 +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 +Provides: nbdkit-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} +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} +%endif + +Requires: efi-srpm-macros +Requires: qt5-srpm-macros + +Requires: rpm >= 4.17.0 +Requires: rpm-build >= 4.17.0 +Requires: zip +Requires: curl +#Requires: (annobin if gcc) + +# for brp-mangle-shebangs +Requires: %{_bindir}/find +Requires: %{_bindir}/file +Requires: %{_bindir}/grep +Requires: %{_bindir}/sed +Requires: %{_bindir}/xargs +Requires: %{_bindir}/chrpath +Requires: %{_bindir}/eu-elfclassify + +# for brp-llvm-compile-lto-elf +Requires: (llvm if clang) +Requires: (gawk if clang) + +Requires: coreutils + +# -fstack-clash-protection and -fcf-protection require GCC 8. +Conflicts: gcc < 7 + +Provides: system-rpm-config = %{version}-%{release} + +%description +specific rpm configuration files for %{vendor}. + +%package -n kernel-rpm-macros +Summary: Macros and scripts for building kernel module packages + +%description -n kernel-rpm-macros +Macros and scripts for building kernel module packages. + +%prep +%setup -Tc -n %{name}-%{version} +cp %{_sourcedir}/* . +rm -f generic-rpm-config.yaml +%autopatch -p1 + +%install +mkdir -p %{buildroot}%{rpmvdir} +install -p -m 644 -t %{buildroot}%{rpmvdir} macros rpmrc +install -p -m 755 -t %{buildroot}%{rpmvdir} config.* +install -p -m 755 -t %{buildroot}%{_rpmconfigdir} brp-* +install -p -m 644 -t %{buildroot}%{_rpmconfigdir} generic-* +install -p -m 755 -t %{buildroot}%{_rpmconfigdir} fix-libtool-from-moving-options-after-libs +install -p -m 755 -t %{buildroot}%{rpmvdir} kmodtool +install -p -m 755 -t %{buildroot}%{rpmvdir} find-requires* +install -p -m 755 -t %{buildroot}%{rpmvdir} find-provides* + +mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d +install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d/ macros.perl macros.python macros.go macros.forge macros.kmp macros.shell-completions + +mkdir -p %{buildroot}%{_fileattrsdir} +install -p -m 644 -t %{buildroot}%{_fileattrsdir} *.attr + +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}` + +%files +%dir %{rpmvdir} +%{rpmvdir}/macros +%{rpmvdir}/rpmrc +%{_rpmconfigdir}/brp-* +%{rpmvdir}/config.* +%{rpmvdir}/find-provides.nbdkit +%{_rpmconfigdir}/generic-* +%{_rpmconfigdir}/fix-libtool-from-moving-options-after-libs +%{_fileattrsdir}/*.attr +%{_rpmconfigdir}/macros.d/ +%{_rpmluadir}/%{_vendor}/*.lua +%exclude %{_rpmconfigdir}/macros.d/macros.kmp + +%files -n kernel-rpm-macros +%{rpmvdir}/kmodtool +%{_rpmconfigdir}/macros.d/macros.kmp +%{rpmvdir}/find-requires +%{rpmvdir}/find-requires.ksyms + +%changelog +* Wed Jan 15 2025 luhuaxin <luhuaxin1@huawei.com> - 31-12 +- ima: keep the process of OBS signing same as previous version + +* Sun Jan 12 2025 Funda Wang <fundawang@yeah.net> - 31-11 +- support sw_64 arch + +* Mon Jan 06 2025 Funda Wang <fundawang@yeah.net> - 31-10 +- add shell completions dir declaration + +* Wed Dec 11 2024 Funda Wang <fundawang@yeah.net> - 31-9 +- update py_install_wheel declaration + +* Sat Nov 16 2024 Funda Wang <fundawang@yeah.net> - 31-8 +- compile LLVM IR bitcode in object files or static libraries + into ELF object code for clang < 18 + +* Sat Oct 26 2024 Funda Wang <fundawang@yeah.net> - 31-7 +- remove useless perl .packlist, empty .bs files and + wrongly created perllocal.pod from buildroot + +* Sat Oct 19 2024 Funda Wang <fundawang@yeah.net> - 31-6 +- add extension flags for python modules + +* Thu Sep 19 2024 Funda Wang <fundawang@yeah.net> - 31-5 +- Drop symlinks of .la and .a also +- move hardcode requires on man and info to file attrs +- add helper script for mageia to fix libtool linking order +- disable info dir generatiion by setting AM_UPDATE_INFO_DIR=no +- add helper macro for extensions of man pages and info pages +- add helper scripts for nbdkit + +* Fri Sep 06 2024 Funda Wang <fudnawang@yeah.net> - 31-4 +- Enable LTO by default + +* 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 + +* Tue Aug 6 2024 liyunfei <liyunfei33@huawei.com> - 30-58 +- Fix for "%undefine _auto_set_build_XX" usage + +* Wed Jul 10 2024 xujing <xujing125@huawei.com> - 30-57 +- enable --as-needed by default + +* Mon Apr 29 2024 xujing <xujing125@huawei.com> - 30-56 +- don't delete the commented code in macros + +* Sun Apr 28 2024 laokz <zhangkai@iscas.ac.cn> - 30-55 +- add riscv64 to some arches macro + +* Sun Apr 7 2024 zhangguangzhi <zhangguangzhi3@huawei.com> - 30-54 +- ima digest list ebs sign ret 2 when errmsg is SIGN_PERMISSION_DENIED + +* Fri Mar 29 2024 zhangguangzhi <zhangguangzhi3@huawei.com> - 30-53 +- ima digest list ebs sign use file path and check errmsg + +* Fri Mar 22 2024 zhangguangzhi <zhangguangzhi3@huawei.com> - 30-52 +- ima digest list ebs sign support modsig + +* Fri Mar 15 2024 yueyuankun <yueyuankun@kylinos.cn> - 30-51 +- Add optflags for loongarch64 and sw_64 + +* Tue Mar 12 2024 liyunfei <liyunfei33@huawei.com> - 30-50 +- Add clang toolchain support + +* Tue Mar 5 2024 hongjinghao <hongjinghao@huawei.com> - 30-49 +- Delete the commented code + +* Tue Feb 20 2024 peng.zou <peng.zou@shingroup.cn> - 30-48 +- add powerpc64le to generic_arches + +* Mon Dec 11 2023 jiahua.yu <jiahua.yu@shingroup.cn> - 30-47 +- Init support for arch ppc64le + +* Wed Nov 22 2023 xujing <xujing125@huawei.com> - 30-46 +- add the scanning path of the rpath + fix the ELF file cannot be found due to escape of '\' + excute brp_chrpath before arch_install_post + +* Fri Nov 03 2023 fuanan <fuanan3@h-partners.com> - 30-45 +- check if the file is a symbolic link in brp-digest-list + +* Thu Nov 2 2023 Yang Yanchao <yangyanchao6@huawei.com> - 30-44 +- kmodtool: use tmp.$$ instand of tmp.txt + +* Mon Aug 28 2023 liyunfei <liyunfei33@huawei.com> - 30-43 +- Revert backport toolchain selecting and %%auto_set_build_flags patches + +* Thu Aug 17 2023 liyunfei <liyunfei33@huawei.com> - 30-42 +- Backport Call %%set_build_flags before %%build, %%check, and %%install stages + +* Thu Aug 17 2023 liyunfei <liyunfei33@huawei.com> - 30-41 +- Backport Add support for selecting a clang as a tool + +* Mon Jul 24 2023 Dongxing Wang <dxwangk@isoftstone.com> - 30-40 +- add pytest and tox macros + +* Thu May 11 2023 caodongxia <caodongxia@h-partners.com> - 30-39 +- improve pyproject_install macro + +* Thu Apr 20 2023 caodongxia <caodongxia@h-partners.com> - 30-38 +- support pyproject compilation + +* Fri Mar 24 2023 laokz <zhangkai@iscas.ac.cn> - 30-37 +- fix riscv64 default library directory of brp-ldconfig + +* Fri Mar 17 2023 Xinliang Liu <xinliang.liu@linaro.org> - 30-36 +- Fix kmod rpm install failed. + +* Sat Jan 14 2023 luhuaxin <luhuaxin1@huawei.com> - 30-35 +- support EBS sign + +* Wed Dec 14 2022 huajingyun <huajingyun@loongson.cn> - 30-34 +- fix config error for loongarch64 + +* Tue Dec 13 2022 Wenlong Zhang <zhangwenlong@loongson.cn> - 30-33 +- add loongarch64 for golang_arches + +* Wed Dec 7 2022 yangmingtai <yangmingtai@huawei.com> - 30-32 +- fix latest_kernel macro + +* Wed Dec 7 2022 Yang Yanchao <yangyanchao6@huawei.com> - 30-31 +- backport kmp feature + +* Wed Nov 30 2022 yangmingtai <yangmingtai@huawei.com> - 30-30 +- support Adaptive according to vendor + +* Mon Nov 21 2022 huajingyun <huajingyun@loongson.cn> - 30-29 +- add loongarch64 support + +* Wed Oct 12 2022 yangmingtai <yangmingtai@huawei.com> - 30-28 +- macro.kmp support -p preamble + +* Thu Sep 8 2022 yangmingtai <yangmingtai@huawei.com> - 30-27 +- add find-requires and find-requires.ksyms + +* Mon Jun 13 2022 yangmingtai <yangmingtai@huawei.com> - 30-26 +- fix build failed, bare words are no longer supported + +* Mon Dec 13 2021 Liu Zixian <liuzixian4@huawei.com> - 30-25 +- fix python macros + +* Fri Nov 26 2021 shixuantong <shixuantong@huawei.com> - 30-24 +- update the definition of python3_version + +* Wed Oct 13 2021 wangkerong <wangkerong@huawei.com> - 30-23 +- add common lua scripts resolve "%%fontpkg" macro translation failure + +* Sat Sep 4 2021 yangmingtai <yangmingtai@huawei.com> - 30-22 +- add brp scripts to delete rpath + +* Thu Apr 8 2021 Anakin Zhang <benjamin93@163.com> - 30-21 +- exclude kernel source and EFI files in digest list building + +* Mon Mar 29 2021 shenyangyang <shenyangyang4@huawei.com> - 30-20 +- Patched missing patch that remove fexceptions + +* Thu Mar 25 2021 shenyangyang <shenyangyang4@huawei.com> - 30-19 +- Modify support for change vendor with better method + +* Thu Mar 18 2021 shenyangyang <shenyangyang4@huawei.com> - 30-18 +- Change the name of spec to openEuler-rpm-spec and fix few bugs + +* Thu Mar 11 2021 shenyangyang <shenyangyang4@huawei.com> - 30-17 +- Add for support for change vendor + +* Tue Dec 1 2020 whoisxxx <zhangxuzhou4@huawei.com> - 30-16 +- Add riscv64 in macros.go + +* Wed Sep 30 2020 shenyangyang <shenyangyang4@huawei.com> - 30-15 +- Change the source code to tar + +* Fri Aug 21 2020 Wang Shuo <wangshuo_1994@foxmail.com> - 30-14 +- fix error message for kmodtool + +* Thu Aug 13 2020 shenyangyang <shenyangyang4@huawei.com> - 30-13 +- Add provides of perl-macros + +* Thu Aug 6 2020 tianwei <tianwei12@huawei.com> - 30-12 +- delete strip-file-prefix + +* Mon Aug 3 2020 Anakin Zhang <benjamin93@163.com> - 30-12 +- add brp-digest-list + +* Fri Jun 19 2020 zhangliuyan <zhangliuyan@huawei.com> - 30-11 +- add kmodtool.py macros.kmp + +* Wed May 6 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-10 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: disable buildid link macro + +* Tue Feb 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-9 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:modify python_provide macro from python2 to python3 + +* Sun Jan 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-8 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:revise vendor in macro + +* Sun Jan 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-7 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:revise macro file + +* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-6 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update macros file + +* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-5 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:add macros to macros.python + +* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-4 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:update macros.python + +* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-3 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:change type of files + +* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-2 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:add source10 to package + +* Mon Jan 13 2020 openEuler Buildteam <buildteam@openeuler.org> - 30-1 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:rebuild + +* Thu Dec 26 2019 openEuler Buildteam <buildteam@openeuler.org> - 29-20 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:delete unneeded provides + +* Wed Nov 27 2019 fanghuiyu<fanghuiyu@huwei.com> - 29-19 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:change to generic-rpm-config + +* Fri Nov 15 2019 jiangchuangang<jiangchuangang@huwei.com> - 29-18 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: remove fcf-protection for x86_64 from rpmrc + +* Wed Oct 30 2019 hexiaowen <hexiaowen@huawei.com> - 29-17 +- add custom macros + +* Wed Sep 25 2019 hexiaowen <hexiaowen@huawei.com> - 29-16 +- add rust-srpm-macros and go-srpm-macros + +* Fri Sep 20 2019 hexiaowen <hexiaowen@huawei.com> - 29-15 +- add version-release for python-rpm-macros + +* Fri Sep 20 2019 hexiaowen <hexiaowen@huawei.com> - 29-14 +- add python-rpm-macros fpc-srpm-macros ghc-srpm-macros gnat-srpm-macros +- nim-srpm-macros ocaml-srpm-macros openblas-srpm-macros perl-srpm-macros + +* Thu Aug 29 2019 hexiaowen <hexiaowen@huawei.com> - 29-13 +- fix typo + +* Tue Aug 27 2019 hexiaowen <hexiaowen@huawei.com> - 29-2 +- delete annobin + +* Wed Jul 18 2018 openEuler Buildteam <buildteam@openeuler.org> - 29-1 +- Package init @@ -0,0 +1,25 @@ +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 |