# vim: ft=make ts=4 sw=4 noet

NAME    = gettext
VERSION = 1.0
GARTYPE = v2

DESCRIPTION = GNU internationalization utilities
define BLURB
  GNU gettext provides a set of tools and documentation for producing
  multi-lingual programs.  It includes runtime libraries (libintl) and
  tools (msgfmt, msgmerge, xgettext, etc.).
endef

MASTER_SITES = http://ftp.gnu.org/gnu/gettext/
DISTFILES   += $(DISTNAME).tar.gz

LICENSE = COPYING

RUNTIME_DEP_PKGS_OZSWgettext += OZSWlibiconv
BUILD_DEP_PKGS += OZSWlibiconv

PACKAGES                  += OZSWgettext
SPKG_DESC_OZSWgettext     = GNU internationalization utilities and libintl
CATALOGNAME_OZSWgettext   = gettext
PKGFILES_OZSWgettext      = .*

# gettext uses gnulib heavily; enable Solaris POSIX extension macros.
EXTENSIONS = 1

CONFIGURE_ARGS  = --prefix=$(prefix)
CONFIGURE_ARGS += --with-libiconv-prefix=$(BUILD_PREFIX)
# Avoid optional deps that don't exist on this system
CONFIGURE_ARGS += --disable-java
CONFIGURE_ARGS += --disable-csharp
CONFIGURE_ARGS += --disable-openmp
# Use bundled libxml2 rather than system (none on OpenSolaris)
CONFIGURE_ARGS += --without-libxml2-prefix
# Disable pthreads to avoid GNU ld/Solaris ELF version symbol incompatibility.
# GNU binutils ld cannot resolve Solaris-versioned pthread symbols in libintl.
CONFIGURE_ARGS += --disable-threads

# Patch all libtool scripts generated by configure to replace ksh93's
# "print -r --" builtin with printf, so they work under bash (SHELL override).
post-configure:
	@echo "==> Patching libtool scripts for bash compatibility"
	@find $(WORKSRC) -name "libtool" -type f -exec \
	    gsed -i 's/ECHO="print -r --"/ECHO="printf %s\\\\n"/g' {} \;
	@$(MAKECOOKIE)

include gar/category.mk
