# -*-makefile-*-
#
# Copyright (C) @YEAR@ by @AUTHOR@
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_@PACKAGE@) += @package@

#
# Paths and names
#
ifdef PTXCONF_@PACKAGE@_TRUNK
@PACKAGE@_VERSION	:= trunk
else
@PACKAGE@_VERSION	:= @VERSION@
@PACKAGE@_MD5		:=
endif
@PACKAGE@		:= @package@-$(@PACKAGE@_VERSION)
@PACKAGE@_URL		:= file://$(PTXDIST_WORKSPACE)/local_src/$(@PACKAGE@)
@PACKAGE@_DIR		:= $(BUILDDIR)/$(@PACKAGE@)
@PACKAGE@_BUILD_OOT	:= YES
@PACKAGE@_LICENSE	:= unknown

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

ifdef PTXCONF_@PACKAGE@_TRUNK
$(STATEDIR)/@package@.extract: $(STATEDIR)/autogen-tools
endif

$(STATEDIR)/@package@.extract:
	@$(call targetinfo)
	@$(call clean, $(@PACKAGE@_DIR))
	@$(call extract, @PACKAGE@)
ifdef PTXCONF_@PACKAGE@_TRUNK
	cd $(@PACKAGE@_DIR) && sh autogen.sh
else
	cd $(@PACKAGE@_DIR) && [ -f configure ] || sh autogen.sh
endif
	@$(call patchin, @PACKAGE@)
	@$(call touch)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

#@PACKAGE@_CONF_ENV	:= $(CROSS_ENV)

#
# autoconf
#
@PACKAGE@_CONF_TOOL	:= autoconf
#@PACKAGE@_CONF_OPT	:= $(CROSS_AUTOCONF_USR)

#$(STATEDIR)/@package@.prepare:
#	@$(call targetinfo)
#	@$(call world/prepare, @PACKAGE@)
#	@$(call touch)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

#$(STATEDIR)/@package@.compile:
#	@$(call targetinfo)
#	@$(call world/compile, @PACKAGE@)
#	@$(call touch)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

#$(STATEDIR)/@package@.install:
#	@$(call targetinfo)
#	@$(call world/install, @PACKAGE@)
#	@$(call touch)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

$(STATEDIR)/@package@.targetinstall:
	@$(call targetinfo)

	@$(call install_init, @package@)
	@$(call install_fixup, @package@, PRIORITY, optional)
	@$(call install_fixup, @package@, SECTION, base)
	@$(call install_fixup, @package@, AUTHOR, "@AUTHOR@")
	@$(call install_fixup, @package@, DESCRIPTION, missing)

#	#
#	# example code:; copy all libraries, links and binaries
#	#

	@for i in $(shell cd $(@PACKAGE@_PKGDIR) && find bin sbin usr/bin usr/sbin -type f); do \
		$(call install_copy, @package@, 0, 0, 0755, -, /$$i); \
	done
	@for i in $(shell cd $(@PACKAGE@_PKGDIR) && find lib usr/lib -name "*.so*"); do \
		$(call install_copy, @package@, 0, 0, 0644, -, /$$i); \
	done
	@links="$(shell cd $(@PACKAGE@_PKGDIR) && find lib usr/lib -type l)"; \
	if [ -n "$$links" ]; then \
		for i in $$links; do \
			from="`readlink $(@PACKAGE@_PKGDIR)/$$i`"; \
			to="/$$i"; \
			$(call install_link, @package@, $$from, $$to); \
		done; \
	fi

#	#
#	# FIXME: add all necessary things here
#	#

	@$(call install_finish, @package@)

	@$(call touch)

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

#$(STATEDIR)/@package@.clean:
#	@$(call targetinfo)
#	@$(call clean_pkg, @PACKAGE@)

# vim: syntax=make
