Package: coreutils
Version: 8.32
Epoch: 1
Revision: 1
BuildDepends: <<
	expat1,
	fink (>= 0.32),
	gettext-bin,
	gettext-tools,
	gmp5,
	help2man,
	libgettext8-dev,
	libiconv-dev
<<
Depends: <<
	gmp5-shlibs,
	libgettext8-shlibs,
	libiconv
<<
NoSetLDFLAGS: true
SetLIBS: -L%p/lib
Source: mirror:gnu:%n/%n-%v.tar.xz
Source-Checksum: SHA256(4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa)

# Fink will cause test-getlogin to fail as getlogin will report the original
# user that invoked su/sudo. The failure of test-getcwd.sh is residual breakage
# from the fix for "bug#13516: tests/rm/unread3 fails on Mac OS X 10.8".
# Buggy 64-bit posixtime implementation fails posixtm-tests on darwin10.

InfoTest: <<
	TestScript: << 
		#!/bin/bash -ex
		if [ $UID = 0 ]; then
			make NON_ROOT_USERNAME=nobody check-root || :
		else
			make check || :
		fi
	<<
<<

ConfigureParams: <<
	--bindir=%p/lib/%N/bin \
	--mandir=%p/lib/%N/share/man \
	--infodir=%p/share/info \
	--libexecdir=%p/lib \
	$asroot \
	gl_cv_func_getcwd_abort_bug=no
<<
CompileScript: <<
	#!/bin/sh -ex
	if [ $UID = 0 ]; then 
		asroot="FORCE_UNSAFE_CONFIGURE=1"
	fi
	%{default_script}
<<
InstallScript: <<
	#!/bin/sh -ex

	make install DESTDIR=%d AM_UPDATE_INFO_DIR=no
	rm -f %i/lib/charset.alias
	rm -f %i/lib/%N/bin/su %i/lib/%N/bin/users %i/lib/%N/bin/who
	
	# NB: we can never in the future switch to using a "real"
	# share/man once it has ever existed as a symlink (limitation
	# in dpkg).
	ln -s share/man %i/lib/%N/man

	for d in bin share/man/man1; do
		dd=`echo "$d" | sed 's,[^/]*,..,g'`/lib/%N/$d
		mkdir -p "%I/$d"
		cd "%I/$d"
		for f in "$dd/"*; do
			ff=`basename "$f"`
			ln -s "$f" "g$ff"
		done
	done
	rm %i/bin/g[
	mv %i/bin/grm %i/bin/rm.gnu
	mv %i/share/man/man1/grm.1 %i/share/man/man1/rm.1.gnu.1

	install_name_tool -id %p/lib/coreutils/libstdbuf.so %i/lib/coreutils/libstdbuf.so
<<
# leave .so suffix as shared library is loaded by insertion
Shlibs: !%p/lib/coreutils/libstdbuf.so
DocFiles: COPYING README
InfoDocs: coreutils.info
Description: GNU flavoured basic commands
DescDetail: <<
The GNU Core Utilities are the basic file, shell and text manipulation
utilities of the GNU operating system.  These are the core utilities
which are expected to exist on every operating system.

Previously these utilities were offered as three individual sets of
GNU utilities, fileutils, shellutils, and textutils. Those three have
been combined into a single set of utilities called the coreutils.

The commands are named with 'g' prefix like 'gls' or 'gcp'. If you want
to use them as 'ls' or 'cp', add %p/lib/coreutils/bin to your PATH
or install the coreutils-default package.

As the exception, the 'rm' command is named as 'rm.gnu' instead of 'grm'
because the cwp-su package has another 'grm'.
<<
DescUsage: <<
The exotic commands like mknod may or may not work in a useful manner
on Darwin. Following commands are removed due to their breakage:
- su
- users
- who
<<
DescPort: <<
	charset.alias is deleted because it is empty on Darwin anyway
	and causes unnecessary conflicts between packages.

	AKH:  made running the test suite optional.

	gl_cv_func_getcwd_abort_bug=no works around a bug on 10.11.{0,1}
<<
DescPackaging: <<
	We omit a few non-"g"-prefixed symlinks:

	* 'md5sum' and 'mktemp': supplied by Essential packages
	* 'tsort': breaks other packages. The GNU version of tsort
	           doesn't output files that are part of a cycle,
	           while the BSD tsort that ships with Darwin does
	* 'base64': conflicts with the "base64" package
<<

SplitOff: <<
	Package: coreutils-default
	Description: GNU coreutils, without 'g' prefix
	Depends: <<
		coreutils (>= %e:%v-%r)
	<<
	Conflicts: <<
		fileutils (<< 1:5-1),
		shellutils (<< 1:5-1),
		textutils (<< 1:5-1)
	<<
	Replaces: <<
		fileutils (<< 1:5-1),
		shellutils (<< 1:5-1),
		textutils (<< 1:5-1)
	<<
	DescDetail: << 
The GNU Core Utilities are the basic file, shell and text manipulation
utilities of the GNU operating system.  These are the core utilities
which are expected to exist on every operating system.

This package serves the commands without 'g' prefix like 'ls' or 'cp'.
	<<
	InstallScript: <<
		#!/bin/sh -ex

		for d in bin share/man/man1; do
			dd=`echo "$d" | sed 's,[^/]*,..,g'`/lib/%N/$d
			mkdir -p "%i/$d"
			cd "%I/$d"
			for f in "$dd/"*; do
				ff=`basename "$f"`
				ln -s "$f" "%i/$d/$ff"
			done
		done
		for f in md5sum mktemp tsort base64; do
			rm %i/bin/$f
			rm %i/share/man/man1/$f.1
		done

		# NB: we can never in the future switch to using a
		# "real" share/man once it has ever existed as a
		# symlink (limitation in dpkg).
		mkdir -p %i/share/doc
		ln -s %N %i/share/doc/%n
	<<
<<
License: GPL
Maintainer: None <fink-devel@lists.sourceforge.net>
Homepage: https://www.gnu.org/software/coreutils/