// GNU software with trivial packaging.

package m4 {
	description = "a macro processor with GNU extensions"
	website = "https://www.gnu.org/software/m4"
	anitya = 1871

	version# = "1.4.21"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/m4/m4-${version}.tar.bz2"
		checksum = "pPa6YOo722Jw80l1OsH1tnUaklnPFjFT-bxGw5iAVrZTm1P8FQaWao_NXop46-pm"
		compress = bzip2
	}

	writable
	early = "chmod +w tests/test-c32ispunct.sh && echo '#!/bin/sh' > tests/test-c32ispunct.sh"

	exec = make()

	inputs = [
		diffutils

		kernel-headers
	]
}

package autoconf {
	description = "M4 macros to produce self-contained configure script"
	website = "https://www.gnu.org/software/autoconf"
	anitya = 141

	version# = "2.73"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/autoconf/autoconf-${version}.tar.gz"
		checksum = "yGabDTeOfaCUB0JX-h3REYLYzMzvpDwFmFFzHNR7QilChCUNE4hR6q7nma4viDYg"
		compress = gzip
	}

	// test suite is very expensive
	exclusive

	exec = make {
		check = [
			"TESTSUITEFLAGS=${jobsFlagE}
			"check"
		]
	}

	inputs = [
		m4
		perl
		bash
		diffutils
	]

	runtime = [
		m4
		perl
	]
}

package automake {
	description = "a tool for automatically generating Makefile.in files"
	website = "https://www.gnu.org/software/automake"
	anitya = 144

	version# = "1.18.1"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/automake/automake-${version}.tar.gz"
		checksum = "FjvLG_GdQP7cThTZJLDMxYpRcKdpAVG-YDs1Fj1yaHlSdh_Kx6nRGN14E0r_BjcG"
		compress = gzip
	}

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' t/objcxx-minidemo.sh
	         test_disable '#!/bin/sh' t/objcxx-deps.sh

	         test_disable '#!/bin/sh' t/dist-no-built-sources.sh
	         test_disable '#!/bin/sh' t/distname.sh
	         test_disable '#!/bin/sh' t/pr9.sh`

	exec = make()

	inputs = [
		grep
		gzip
		autoconf
		diffutils
	]

	runtime = [ autoconf ]
}

package libtool {
	description = "a generic library support script"
	website = "https://www.gnu.org/software/libtool"
	anitya = 1741

	version# = "2.5.4"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/libtool/libtool-${version}.tar.gz"
		checksum = "pa6LSrQggh8mSJHQfwGjysAApmZlGJt8wif2cCLzqAAa2jpsTY0jZ-6stS3BWZ2Q"
		compress = gzip
	}

	exec = make {
		// _Z2a2c: symbol not found
		skipEarlyStageCheck

		check = [
			"TESTSUITEFLAGS=${jobsFlagE}"
			"check"
		]
	}

	inputs = [
		m4
		diffutils
	]
}

package gzip {
	description = "a popular data compression program"
	website = "https://www.gnu.org/software/gzip"
	anitya = 1290

	version# = "1.14"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/gzip/gzip-${version}.tar.gz"
		checksum = "NWhjUavnNfTDFkZJyAUonL9aCOak8GVajWX2OMlzpFnuI0ErpBFyj88mz2xSjz0q"
		compress = gzip
	}

	exec = make {
		// dependency loop
		skipCheck
	}
}

package sed {
	description = "a non-interactive command-line text editor"
	website = "https://www.gnu.org/software/sed"
	anitya = 4789

	version# = "4.10"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/sed/sed-${version}.tar.gz"
		checksum = "TXTRFQJCyflb-bpBRI2S5Y1DpplwvT7-KfXtpqN4AdZgZ5OtI6yStn1-bkhDKx51"
		compress = gzip
	};

	exec = make()

	inputs = [
		diffutils

		kernel-headers
	]
}

package diffutils {
	description = "several programs related to finding differences between files"
	website = "https://www.gnu.org/software/diffutils"
	anitya = 436

	version# = "3.12"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/diffutils/diffutils-${version}.tar.gz"
		checksum = "9J5VAq5oA7eqwzS1Yvw-l3G5o-TccUrNQR3PvyB_lgdryOFAfxtvQfKfhdpquE44"
		compress = gzip
	};

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' gnulib-tests/test-c32ispunct.sh
	         test_disable 'int main(){return 0;}' gnulib-tests/test-c32ispunct.c
	         test_disable '#!/bin/sh' tests/cmp`

	toyboxEarly
	exec = make()
}

package patch {
	description = "a program to apply diff output to files"
	website = "https://savannah.gnu.org/projects/patch"
	anitya = 2597

	version# = "2.8"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/patch/patch-${version}.tar.gz"
		checksum = "MA0BQc662i8QYBD-DdGgyyfTwaeALZ1K0yusV9rAmNiIsQdX-69YC4t9JEGXZkeR"
		compress = gzip
	}

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' tests/ed-style
	         test_disable '#!/bin/sh' tests/need-filename`

	toyboxEarly
	exec = make()
}

package gawk {
	description = "an implementation of awk with GNU extensions"
	website = "https://www.gnu.org/software/gawk"
	anitya = 868

	version := "5.4.0"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/gawk/gawk-${version}.tar.gz"
		checksum = "m0RkIolC-PI7EY5q8pcx5Y-0twlIW0Yp3wXXmV-QaHorSdf8BhZ7kW9F8iWomz0C"
		compress = gzip
	}

	toyboxEarly
	exec = make {
		// dependency loop
		skipCheck
	}
}

package grep {
	description = "searches input for lines containing a match to a pattern"
	website = "https://www.gnu.org/software/grep"
	anitya = 1251

	version := "3.12"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/grep/grep-${version}.tar.gz"
		checksum = "qMB4RjaPNRRYsxix6YOrjE8gyAT1zVSTy4nW4wKW9fqa0CHYAuWgPwDTirENzm_1"
		compress = gzip
	};

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' gnulib-tests/test-c32ispunct.sh
	         test_disable 'int main(){return 0;}' gnulib-tests/test-c32ispunct.c`

	exec = make()

	inputs = [ diffutils ]
}

package gettext {
	description = "tools for producing multi-lingual messages"
	website = "https://www.gnu.org/software/gettext"
	anitya = 898

	version := "1.0"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/gettext/gettext-${version}.tar.gz"
		checksum = "3MasKeEdPeFEgWgzsBKk7JqWqql1wEMbgPmzAfs-mluyokoW0N8oQVxPQoOnSdgC"
		compress = gzip
	}

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' gettext-tools/tests/msgcat-22
	         test_disable '#!/bin/sh' gettext-tools/tests/msgconv-2
	         test_disable '#!/bin/sh' gettext-tools/tests/msgconv-8
	         test_disable '#!/bin/sh' gettext-tools/tests/xgettext-python-3
	         test_disable '#!/bin/sh' gettext-tools/tests/msgmerge-compendium-6
	         test_disable '#!/bin/sh' gettext-tools/tests/gettextpo-1
	         test_disable '#!/bin/sh' gettext-tools/tests/format-c-5
	         test_disable '#!/bin/sh' gettext-tools/gnulib-tests/test-c32ispunct.sh
	         test_disable 'int main(){return 0;}' gettext-tools/gnulib-tests/test-stdcountof-h.c

	         touch gettext-tools/autotools/archive.dir.tar`

	exec = make()

	inputs = [
		diffutils
		gzip
		sed

		kernel-headers
	]
}

package findutils {
	description = "the basic directory searching utilities"
	website = "https://www.gnu.org/software/findutils"
	anitya = 812

	version := "4.10.0"
	source = remoteFile {
		url = "https://ftpmirror.gnu.org/gnu/findutils/findutils-${version}.tar.xz"
		checksum = "ZXABdNBQXL7QjTygynRRTdXYWxQKZ0Wn5eMd3NUnxR0xaS0u0VfcKoTlbo50zxv6"
	};

	early = `echo '#!/bin/sh' > gnulib-tests/test-c32ispunct.sh
	         echo 'int main(){return 0;}' > tests/xargs/test-sigusr.c`

    exec = make()

	inputs = [
		diffutils
		xz
		sed
	]
}

package bash {
	description = "the Bourne Again SHell"
	website = "https://www.gnu.org/software/bash"
	anitya = 166

	version := "5.3"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/bash/bash-${version}.tar.gz"
		checksum = "4LQ_GRoB_ko-Ih8QPf_xRKA02xAm_TOxQgcJLmFDT6udUPxTAWrsj-ZNeuTusyDq"
		compress = gzip
	}

	toyboxEarly
	exec = make {
		configure = {
			"without-bash-malloc"
		}
		postInstall = "ln -s bash /work/system/bin/sh"
	}
}

package coreutils {
	description = "the basic file, shell and text manipulation utilities"
	website = "https://www.gnu.org/software/coreutils"
	anitya = 343

	version := "9.11"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/coreutils/coreutils-${version}.tar.gz"
		checksum = "t8UMed5wpFEoC56aa42_yidfOAaRGzOfj7MRtQkkqgGbpXiskNA8bd-EmVSQkZie"
		compress = gzip
	}

	toyboxEarly
	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' gnulib-tests/test-c32ispunct.sh
	         test_disable '#!/bin/sh' tests/ls/hyperlink.sh
	         test_disable '#!/bin/sh' tests/misc/user.sh
	         test_disable 'int main(){return 0;}' gnulib-tests/test-chown.c
	         test_disable 'int main(){return 0;}' gnulib-tests/test-fchownat.c
	         test_disable 'int main(){return 0;}' gnulib-tests/test-lchown.c`

	exec = make {
		configure = [
			"enable-single-binary": "symlinks"
		]
	}

	inputs = [
		perl
		bash

		kernel-headers
	]
}

package tar {
	description = "provides the ability to create tar archives"
	website = "https://www.gnu.org/software/tar"
	anitya = 4939

	version := "1.35"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/tar/tar-${version}.tar.gz"
		checksum = "zSaoSlVUDW0dSfm4sbL4FrXLFR8U40Fh3zY5DWhR5NCIJ6GjU6Kc4VZo2-ZqpBRA"
		compress = gzip
	}

	exec = make {
		configure = [
			"disable-acl"
			"without-posix-acls"
			"without-xattrs"
		]

		check = [
			// very expensive
			"TARTEST_SKIP_LARGE_FILES=1"

			"TESTSUITEFLAGS=${jobsFlagE}"
			"check"
		]
	}

	inputs = [
		diffutils

		gzip
		bzip2
		zstd
	]
}

package texinfo {
	description = "the GNU square-wheel-reinvension of man pages"
	website = "https://www.gnu.org/software/texinfo"
	anitya = 4958

	version := "7.3"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/texinfo/texinfo-${version}.tar.gz"
		checksum = "RRmC8Xwdof7JuZJeWGAQ_GeASIHAuJFQMbNONXBz5InooKIQGmqmWRjGNGEr5n4-"
		compress = gzip
	}

	exec = make {
		// nonstandard glibc extension
		skipCheck
	}

	inputs = [ perl ]

	runtime = [
		perl
		gawk
	]
}

package gperf {
	description = "a perfect hash function generator"
	website = "https://www.gnu.org/software/gperf"
	anitya = 1237

	version := "3.3"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gperf/gperf-${version}.tar.gz"
		checksum = "RtIy9pPb_Bb8-31J2Nw-rRGso2JlS-lDlVhuNYhqR7Nt4xM_nObznxAlBMnarJv7"
		compress = gzip
	};

	exec = make()

	inputs = [ diffutils ]
}

package bc {
	description = "an arbitrary precision numeric processing language"
	website = "https://www.gnu.org/software/bc"
	anitya = 170

	version := "1.08.2"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/bc/bc-${version}.tar.gz"
		checksum = "8h6f3hjV80XiFs6v9HOPF2KEyg1kuOgn5eeFdVspV05ODBVQss-ey5glc8AmneLy"
		compress = gzip
	}

	// source expected to be writable
	writable
	chmod

	exec = make()

	inputs = [
		texinfo
	]
}

package libiconv {
	description = "iconv implementation independent of glibc"
	website = "https://www.gnu.org/software/libiconv"
	anitya = 10656

	version := "1.19"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/libiconv/libiconv-${version}.tar.gz"
		checksum = "UibB6E23y4MksNqYmCCrA3zTFO6vJugD1DEDqqWYFZNuBsUWMVMcncb_5pPAr88x"
		compress = gzip
	}

	exec = make()
}

package parallel {
	description = "a shell tool for executing jobs in parallel using one or more computers"
	website = "https://www.gnu.org/software/parallel"
	anitya = 5448

	version := "20260422"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/parallel/parallel-${version}.tar.bz2"
		checksum = "eTsepxgqhXpMEhPd55qh-W5y4vjKn0x9TD2mzbJCNZYtFf4lT4Wzoqr74HGJYBEH"
		compress = bzip2
	}

	early = "ln -s ../system/bin/bash /bin/"

	exec = make()

	inputs = [
		perl
		bash
	]

	runtime = [ perl ]
}

package libunistring {
	description = "provides functions for manipulating Unicode strings"
	website = "https://www.gnu.org/software/libunistring"
	anitya = 1747

	version := "1.4.2"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/libunistring/libunistring-${version}.tar.gz"
		checksum = "iW9BbfLoVlXjWoLTZ4AekQSu4cFBnLcZ4W8OHWbv0AhJNgD3j65_zqaLMzFKylg2"
		compress = gzip
	}

	writable
	early = `test_disable() { chmod +w "$2" && echo "$1" > "$2"; }
	         test_disable '#!/bin/sh' tests/test-c32ispunct.s
	         test_disable 'int main(){return 0;}' tests/test-c32ispunct.c`

	exec = make()

	inputs = [
		diffutils
	]
}

package libtasn1 {
	description = "the ASN.1 library used by GnuTLS, p11-kit and some other packages"
	website = "https://www.gnu.org/software/libtasn1"
	anitya = 1734

	version := "4.21.0"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/libtasn1/libtasn1-${version}.tar.gz"
		checksum = "9DYI3UYbfYLy8JsKUcY6f0irskbfL0fHZA91Q-JEOA3kiUwpodyjemRsYRjUpjuq"
		compress = gzip
	}

	exec = make()
}

package readline {
	description = "provides a set of functions for use by applications that allow users to edit command lines as they are typed in"
	website = "https://tiswww.cwru.edu/php/chet/readline/rltop.html"
	anitya = 4173

	version := "8.3"
	source = remoteTar {
		url = "https://ftpmirror.gnu.org/gnu/readline/readline-${version}.tar.gz"
		checksum = "r-lcGRJq_MvvBpOq47Z2Y1OI2iqrmtcqhTLVXR0xWo37ZpC2uT_md7gKq5o_qTMV"
		compress = gzip
	}

	exec = make {
		configure = [
			"with-curses"
			"with-shared-termcap-library"
		]
	}

	inputs = [ ncurses ]
	runtime = [ ncurses ]
}

package gmp {
	description = "a free library for arbitrary precision arithmetic"
	website = "https://gmplib.org"
	anitya = 1186

	version := "6.3.0"
	source = remoteTar {
		url = "https://gcc.gnu.org/pub/gcc/infrastructure/gmp-${version}.tar.bz2"
		checksum = "yrgbgEDWKDdMWVHh7gPbVl56-sRtVVhfvv0M_LX7xMUUk_mvZ1QOJEAnt7g4i3k5"
		compress = bzip2
	}

	env = [
		"CC=cc"
	]

	exec = make()

	inputs = [ m4 ]
}

package mpfr {
	description = "a C library for multiple-precision floating-point computations"
	website = "https://www.mpfr.org"
	anitya = 2019

	version := "4.2.2"
	source = remoteTar {
		url = "https://gcc.gnu.org/pub/gcc/infrastructure/mpfr-${version}.tar.bz2"
		checksum = "wN3gx0zfIuCn9r3VAn_9bmfvAYILwrRfgBjYSD1IjLqyLrLojNN5vKyQuTE9kA-B"
		compress = bzip2
	}

	exec = make()

	inputs = [ gmp ]
	runtime = [ gmp ]
}

package mpc {
	description = "a C library for the arithmetic of complex numbers"
	website = "https://www.multiprecision.org"
	anitya = 1667

	version := "1.4.1"
	source = remoteGitLab {
		domain = "gitlab.inria.fr"
		suffix = "mpc/mpc"
		ref = version
		checksum = "ZffaZyWkvIw0iPvRe5EJ7O-VvHtSkbbb3K_7SgPtK810NvGan7nbF0T5-6tozjQN"
	}

	// does not find mpc-impl.h otherwise
	enterSource

	exec = make {
		inPlace
		generate = "autoreconf -vfi"
	}

	inputs = [
		automake
		libtool
		texinfo

		mpfr
	]

	runtime = [ mpfr ]
}
