1+ # !/SBUILD ver @v1.0.0
2+ # SELF: https://raw.githubusercontent.com/pkgforge/soarpkgs/refs/heads/main/binaries/binutils/static.official.stable.yaml
3+ _disabled : false
4+
5+ pkg : " binutils"
6+ pkg_id : " nixpkgs.binutils"
7+ pkg_type : " static"
8+ category :
9+ - " ConsoleOnly"
10+ - " Utility"
11+ description :
12+ _default : " Tools for manipulating binaries (linker, assembler, etc.) [alias=bintools]"
13+ addr2line : " Converts addresses into filenames and line numbers [binutils]"
14+ ar : " A utility for creating, modifying and extracting from archives [binutils]"
15+ as : " The GNU Assembler [binutils]"
16+ c++filt : " Filter to demangle encoded C++ symbols [binutils]"
17+ dwp : " The DWARF packaging utility [binutils]"
18+ elfedit : " Allows alteration of ELF format files [binutils]"
19+ gprof : " Displays profiling information [binutils]"
20+ ld : " The GNU linker [binutils]"
21+ ld.bfd : " The GNU linker with BFD libraries [binutils]"
22+ ld.gold : " A new, faster, ELF only linker [binutils]"
23+ nm : " Lists symbols from object files [binutils]"
24+ objcopy : " Copies and translates object files [binutils]"
25+ objdump : " Displays information from object files [binutils]"
26+ ranlib : " Generates an index to the contents of an archive [binutils]"
27+ readelf : " Displays information from any ELF format object file [binutils]"
28+ size : " Lists the section sizes of an object or archive file [binutils]"
29+ strings : " Lists printable strings from files [binutils]"
30+ strip : " Discards symbols [binutils]"
31+ homepage :
32+ - " https://www.gnu.org/software/binutils/"
33+ maintainer :
34+ - " Azathothas (https://github.com/Azathothas)"
35+ note :
36+ - " [DO NOT RUN] (Meant for pkgforge CI Only)"
37+ - " Built Using Nix. Check/Report @ https://github.com/NixOS/nixpkgs"
38+ provides :
39+ - " addr2line"
40+ - " ar"
41+ - " as"
42+ - " c++filt"
43+ - " dwp"
44+ - " elfedit"
45+ - " gprof"
46+ - " ld"
47+ - " ld.bfd"
48+ - " ld.gold"
49+ - " nm"
50+ - " objcopy"
51+ - " objdump"
52+ - " ranlib"
53+ - " readelf"
54+ - " size"
55+ - " strings"
56+ - " strip"
57+ repology :
58+ - " binutils"
59+ src_url :
60+ - " https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git"
61+ tag :
62+ - " build-tools"
63+ x_exec :
64+ bsys : " host://nix"
65+ host :
66+ - " aarch64-Linux"
67+ - " riscv64-Linux"
68+ - " x86_64-Linux"
69+ shell : " bash"
70+ pkgver : |
71+ nix derivation show "nixpkgs#binutils" --impure --refresh --quiet 1>&1 2>/dev/null | sed -n '/^[[:space:]]*{/,$p' | jq -r '.. | objects | (select(has("version")).version, (select(has("env")) | select(.env.__json != null) | .env.__json | fromjson | select(has("version")).version) | select(.))' | tr -d '"'\''[:space:]'
72+ run : |
73+ #Build
74+ echo -e "\n" ; nix-instantiate --eval --expr "builtins.toJSON (with import <nixpkgs> {}; ${PKG}.meta)" --quiet 2>/dev/null | jq -r fromjson 2>/dev/null ; echo -e "\n"
75+ nix-build '<nixpkgs>' --impure --attr "pkgsStatic.binutils" --cores "$(($(nproc)+1))" --max-jobs "$(($(nproc)+1))" --log-format bar-with-logs --out-link "${SBUILD_TMPDIR}/nixbuild"
76+ find -L "${SBUILD_TMPDIR}/nixbuild" | sort | awk -F/ '{indent=""; for (i=2; i<NF; i++) indent=indent " "; print (NF>1 ? indent "--> " $NF : $NF)}'
77+ #Fix Perms
78+ find "${SBUILD_TMPDIR}" -maxdepth 1 -type d -o -type l -exec realpath "{}" \; | grep -Ev '^\.$' |\
79+ xargs -I{} find -L "{}" -type d -iregex ".*\(bin\|exec\).*" | \
80+ xargs -I{} sudo rsync -achLv --no-relative "{}/." "${SBUILD_TMPDIR}/."
81+ sudo chown -R "$(whoami):$(whoami)" "${SBUILD_TMPDIR}" && chmod -R 755 "${SBUILD_TMPDIR}"
82+ #Fix Shell Scripts
83+ find "${SBUILD_TMPDIR}" -type f -iregex '.*\.\(bin\|pl\)$' -exec bash -c 'mv -fv "$1" "${1%.*}"' _ "{}" \;
84+ find "${SBUILD_TMPDIR}" -type f \( -name "*.sh" -o -exec sh -c 'file -i "$1" | grep -qiv "application/.*executable"' sh {} \; \) -print0 | xargs -0 -I {} sh -c '
85+ sed "s|^#!/nix/store/.*/bin/sh|#!/bin/sh|" -i "{}" 2>/dev/null
86+ sed "s|/nix/store[^ ]*/bin/\([^ ]*\)|/usr/local/bin/\1|g" -i "{}" 2>/dev/null
87+ sed "s|/nix/store/[^/]*/bin|/usr/local/bin|g" -i "{}" 2>/dev/null
88+ sed "s|/nix/store[^/ ]*/bin|/usr/local/bin|g" -i "{}" 2>/dev/null
89+ sed "s|/nix/store[^ \"'\'']*|/|g" -i "{}" 2>/dev/null
90+ '
91+ #Copy
92+ find "${SBUILD_TMPDIR}" -maxdepth 1 -type f -exec file -i "{}" \; | grep -Ei 'application/.*executable|text/x-perl|text/.*script' | cut -d":" -f1 | xargs realpath | sort -u | xargs -I "{}" rsync -achvL "{}" "${SBUILD_OUTDIR}"
93+ ( askalono --format "json" crawl --follow "${SBUILD_TMPDIR}" | jq -r ".. | objects | .path? // empty" | head -n 1 | xargs -I "{}" cp -fv "{}" "${SBUILD_OUTDIR}/LICENSE" ) 2>/dev/null
0 commit comments