# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../maven1/maven1.conf
# Copyright (C) 2007 - 2008 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

# Prevent executing normal make and install build steps.
# This package has custom make and install.
makeopt=
makeinstopt=

# Make prefix same a java_home. This way artifacts like the bin, lib
# and doc directory are created at the proper level.
prefix=opt/maven-${ver}
set_confopt

# To be able to run maven a JRE needs to be installed. To be able to
# have maven compile java stuff a JDK needs to be available as well.
# Todo: check for jdk, after java alternatives are working properly.

# Custom installation.
maven_postmake() {
	# Copy the extracted archive to the current prefix location.
	# But make sure to preserve any possible links.
	( cd $builddir/maven-${ver}; tar -c * | tar -x -C $root/$prefix )

	# Prepare necessary environment variables.
	cat <<-EOF > $root/etc/profile.d/maven1
	MAVEN_HOME=$root/$prefix
	export MAVEN_HOME

	PATH=\$PATH:\$MAVEN_HOME/bin
	export PATH
	EOF
}

hook_add postmake 5 maven_postmake