libem.bash 14.7 KB
Newer Older
1
#!/bin/bash
gsell's avatar
gsell committed
2

3
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin
gsell's avatar
gsell committed
4

5 6
declare -r	MODULECMD="${MODULESHOME}/bin/modulecmd"

7
declare -r	BUILDSCRIPT=$( cd $(dirname "$0") && pwd )/$(basename "$0")
8 9 10
declare -rx	ARGS="$@"
declare -rx	SHLIBDIR=$( cd $(dirname "$BASH_SOURCE") && pwd )
declare -r	OS=$(uname -s)
gsell's avatar
gsell committed
11

12 13
# number of parallel make jobs
declare -i	JOBS=3
gsell's avatar
gsell committed
14 15 16

source "${SHLIBDIR}/lib.bash"

gsell's avatar
gsell committed
17 18 19 20 21
# while bootstraping the module command is not yet available
if typeset -f module > /dev/null 2>&1 ; then
	module purge
fi

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
declare -rx BUILD_BASEDIR=$(abspath $SHLIBDIR/..)

source "$(readlink ${BUILD_BASEDIR}/config/environment.bash)"

declare -xr BUILD_CONFIGDIR="${BUILD_BASEDIR}/config"
declare -xr BUILD_SCRIPTSDIR="${BUILD_BASEDIR}/scripts"
declare -xr BUILD_TMPDIR="${BUILD_BASEDIR}/tmp"
declare -xr BUILD_DOWNLOADSDIR="${BUILD_BASEDIR}/Downloads"
declare -xr BUILD_VERSIONSFILE="${BUILD_CONFIGDIR}/versions.conf"

if [[ -z "${BUILD_CONFIGDIR}/families.d/"*.conf ]]; then
	die 1 "Default family configuration not set in ${BUILD_CONFIGDIR}/families.d"
fi
for f in "${BUILD_CONFIGDIR}/families.d/"*.conf; do
	source "${f}"
done

declare -x  PREFIX=''
declare -x  DOCDIR=''
declare -x  MODULE_FAMILY=''
declare	-x  MODULE_RELEASE=''
43 44 45
declare     cur_module_release=''

declare     DEPEND_RELEASE=''
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
declare -x  MODULE_NAME=''


# these directories are module dependend
declare -x  MODULE_SRCDIR=''
declare -x  MODULE_BUILDDIR=''

declare -x  MODULE_BUILD_DEPENDENCIES
declare -x  MODULE_DEPENDENCIES

declare -x C_INCLUDE_PATH
declare -x CPLUS_INCLUDE_PATH
declare -x CPP_INCLUDE_PATH
declare -x LIBRARY_PATH
declare -x LD_LIBRARY_PATH
declare -x DYLD_LIBRARY_PATH

if [[ $DEBUG_ON ]]; then
	trap 'echo "$BASH_COMMAND"' DEBUG
fi
gsell's avatar
gsell committed
66

67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
function usage() {
	error "
Usage: $0 [OPTIONS..] [VERSION] [ENV=VALUE...]

VERSION
        Version of module to compile.

ENV=VALUE
        Set environment variable ENV to VALUE. This can be used to
        overwrite default versions.

-? | -h | --help
        Print usage

-v | --verbose )
        Verbose output

-j N | --jobs=N
        Run N parallel make jobs

-f | --force-rebuild
        Force rebuild of module.

90 91 92
--with=P/V
        Preload module P with version V. To preload multiple modules,
        use this option per module. Nete that order may matter.
93

94
--release=stable|unstable|deprecated
95 96 97 98 99

"
	exit 1
}

100

gsell's avatar
gsell committed
101 102
P=$(basename $0)
P=${P%.*}
gsell's avatar
gsell committed
103 104 105 106 107 108
_P=$(echo $P | tr [:lower:] [:upper:])
_V=${_P}_VERSION

DEBUG_ON=''
FORCE_REBUILD=''
ENVIRONMENT_ARGS=''
109
WITH_ARGS=''
110
DRY_RUN=''
111
with_modules=()
gsell's avatar
gsell committed
112 113 114 115 116 117
while (( $# > 0 )); do
	case $1 in
	-j )
		JOBS=$2
		shift
		;;
118 119 120 121
	--jobs=[0-9]* )
		JOBS=${1/--jobs=}
		;;
	-v | --verbose)
gsell's avatar
gsell committed
122 123 124 125 126
		DEBUG_ON=':'
		;;
	-f | --force-rebuild )
		FORCE_REBUILD=':'
		;;
127 128 129
	-? | -h | --help )
		usage
		;;
130 131 132
	--dry-run )
		DRY_RUN='dry-run'
		;;
133 134 135 136 137 138
	--release=* )
		MODULE_RELEASE=${1/--release=}
		if [[ -n ${MODULE_RELEASE} ]] && [[ ${MODULE_RELASE:0:1} != . ]]; then
			MODULE_RELEASE=".${MODULE_RELEASE}"
		fi
		;;
139 140 141
	--with=*/* )
		with_modules+=( ${1/--with=} )
		;;
142 143 144
	*=* )
		eval $1
		ENVIRONMENT_ARGS="${ENVIRONMENT_ARGS} $1"
145
		;;
gsell's avatar
gsell committed
146
	* )
147
		V=$1
gsell's avatar
gsell committed
148 149 150 151 152
		;;
	esac
	shift
done

153 154 155

eval "${ENVIRONMENT_ARGS}"

156 157
function is_release () {
	local -a releases=( '' )
158
	releases+=( $(< "${PSI_PREFIX}/${PSI_RELEASES_CONF}") )
159 160 161 162 163 164
        local rel
        for rel in "${releases[@]}"; do
		[[ "${rel}" == "$1" ]] && return 0
	done
        return 1
}
165

gsell's avatar
gsell committed
166

167 168
function em.set_release() {
	is_release "$1" || die 1 "$P: unknown release type: $1"
169
	[[ "$1" == "deprecated" ]] && die 0 "$P: is deprecated, we don't rebuild it."
170
	MODULE_RELEASE=".$1"
gsell's avatar
gsell committed
171 172
}

173 174 175
function em.supported_os() {
	for os in "$@"; do
		[[ ${os} == ${OS} ]] && return 0
gsell's avatar
gsell committed
176
	done
177
	die 0 "${P}: Not available for ${OS}."
gsell's avatar
gsell committed
178 179
}

gsell's avatar
gsell committed
180
function em.add_to_family() {
gsell's avatar
gsell committed
181
	if [[ -z ${1} ]]; then
gsell's avatar
gsell committed
182
		die 42 "${FUNCNAME}: Missing family argument."
gsell's avatar
gsell committed
183
	fi
184
	if [[ ! -d ${PSI_PREFIX}/${PSI_CONFIG_DIR}/${1} ]]; then
185
		die 43 "${1}: family does not exist."
gsell's avatar
gsell committed
186
	fi
187
	MODULE_FAMILY=$1
gsell's avatar
gsell committed
188 189
}

190
function em.set_build_dependencies() {
191
	MODULE_BUILD_DEPENDENCIES=("$@")
192 193
}

gsell's avatar
gsell committed
194
function em.set_runtime_dependencies() {
195
	MODULE_DEPENDENCIES=("$@")
gsell's avatar
gsell committed
196 197
}

gsell's avatar
gsell committed
198
function em.set_supported_compilers() {
199
	MODULE_SUPPORTED_COMPILERS=("$@")
gsell's avatar
gsell committed
200 201 202
}

function em.set_docfiles() {
203
	MODULE_DOCFILES=("$@")
gsell's avatar
gsell committed
204 205
}

206
function is_module_available() {
207
	[[ -n $("${MODULECMD}" bash avail "$1" 2>&1 1>/dev/null) ]]
208 209
}

210
function _load_build_dependencies() {
211 212 213
	for m in "${with_modules[@]}"; do
		module load "${m}"
	done
214
	for m in "${MODULE_BUILD_DEPENDENCIES[@]}"; do
215 216
		[[ -z $m ]] && continue
		if [[ ! $m =~ "*/*" ]]; then
gsell's avatar
gsell committed
217 218 219 220
			local _V=$(echo -n $m | tr [:lower:] [:upper:] )_VERSION
			if [[ -n ${!_V} ]]; then
		    		m=$m/${!_V}
			else
gsell's avatar
gsell committed
221
				echo "$m: warning: No version set, loading default ..."
gsell's avatar
gsell committed
222
			fi
223
		fi
224
		if [[ -z $("${MODULECMD}" bash avail "$m" 2>&1 1>/dev/null) ]]; then
225
			debug "${m}: module not available"
226
			for rel in $(< "${PSI_PREFIX}/${PSI_RELEASES_CONF}"); do
227
				debug "${m}: check release \"${rel/.}\""
228
				eval $("${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/use.bash" ${rel/.})
229 230 231 232
				if is_module_available "${m}"; then
					die 1 "${m}: module available in release \"${rel/.}\", add this release with \"module use ${rel/.}\" and re-run build script."
				fi
			done
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
			[[ ${DRY_RUN} ]] && die 1 "${m}: module does not exist, cannot continue with dry run..."

			echo "$m: module does not exist, trying to build it..."
			local args=( '' )
			set -- ${ARGS[@]}
			while (( $# > 0 )); do
				case $1 in
				-j )
					args+=( "-j $2" )
					shift
					;;
				--jobs=[0-9]* )
					args+=( $1 )
					;;
				-v | --verbose)
					args+=( $1 )
					;;
				--release=* )
					args+=( $1 )
					;;
				--with=*/* )
					args+=( $1 )
					;;
				*=* )
					args+=( $1 )
					;;
				esac
				shift
			done
			"${BUILD_SCRIPTSDIR}/${m/\/*}.build" ${args[@]}
263
			if [[ -z $(module avail "$m" 2>&1) ]]; then
gsell's avatar
gsell committed
264
				die 1 "$m: oops: build failed..."
265 266
			fi
		fi
267 268 269
		local modulepath_root="${PSI_PREFIX}/${PSI_MODULES_ROOT}"
		local tmp=$( module display "${m}" 2>&1 | grep -m1 -- "${modulepath_root}" )
		tmp=${tmp/${modulepath_root}\/}
270 271
		tmp=${tmp%%/*}
		local _family=( ${tmp//./ } )
272 273
		# set module release to 'deprecated' if a build dependency
		# is deprecated
274
		if [[ ${_family[1]} == deprecated ]]; then
275
			DEPEND_RELEASE='.deprecated'
276 277
		# set module release to 'unstable' if a build dependency is
		# unstable and release not yet set
278 279
		elif [[ ${_family[1]} == unstable ]] && [[ -z ${DEPEND_RELEASE} ]]; then
			DEPEND_RELEASE='.unstable'
280 281 282
		fi
		echo "Loading module: ${m}"
		module load "${m}"
283 284 285
	done
}

gsell's avatar
gsell committed
286 287
function _write_runtime_dependencies() {
	local -r fname="${PREFIX}/.dependencies"
288
	info "Writing run-time dependencies to ${fname}"
gsell's avatar
gsell committed
289 290
	local dep
	echo -n "" > "${fname}"
291
	for dep in "${MODULE_DEPENDENCIES[@]}"; do
gsell's avatar
gsell committed
292 293
		[[ -z $dep ]] && continue
		if [[ ! $dep =~ "*/*" ]]; then
294
		    local _V=$(echo -n $dep | tr [:lower:] [:upper:] )_VERSION
gsell's avatar
gsell committed
295 296 297 298 299 300 301 302
		    dep=$dep/${!_V}
		fi
		echo "${dep}" >> "${fname}"
	done
}

function _write_build_dependencies() {
	local -r fname="${PREFIX}/.build_dependencies"
303
	info "Writing build dependencies to ${fname}"
gsell's avatar
gsell committed
304 305
	local dep
	echo -n "" > "${fname}"
306
	for dep in "${MODULE_BUILD_DEPENDENCIES[@]}"; do
gsell's avatar
gsell committed
307 308
		[[ -z $dep ]] && continue
		if [[ ! $dep =~ "*/*" ]]; then
309
		    local _V=$(echo -n $dep | tr [:lower:] [:upper:] )_VERSION
gsell's avatar
gsell committed
310 311 312 313 314 315
		    dep=$dep/${!_V}
		fi
		echo "${dep}" >> "${fname}"
	done
}

316
# setup general environment
317
function _setup_env1() {
gsell's avatar
gsell committed
318 319 320 321 322 323 324
	C_INCLUDE_PATH=''
	CPLUS_INCLUDE_PATH=''
	CPP_INCLUDE_PATH=''
	LIBRARY_PATH=''
	LD_LIBRARY_PATH=''
	DYLD_LIBRARY_PATH=''

325 326 327 328 329 330 331 332 333 334
	while read _name _version; do
		[[ -z ${_name} ]] && continue
		[[ -z ${_version} ]] && continue
		[[ "${_name:0:1}" == '#' ]] && continue
		_NAME=$(echo ${_name} | tr [:lower:] [:upper:])
		eval ${_NAME}_VERSION=$_version 
	done < "${BUILD_VERSIONSFILE}"

}

335
#setup module specific environment
336
function _setup_env2() {
337
	if [[ -z ${MODULE_FAMILY} ]]; then
gsell's avatar
gsell committed
338
		die 1 "$P: family not set."
gsell's avatar
gsell committed
339 340 341
	fi

	# overwrite environment variables with values we got on the cmd line
gsell's avatar
gsell committed
342
	eval "${ENVIRONMENT_ARGS}"
gsell's avatar
gsell committed
343 344 345 346 347 348 349 350 351 352

	# this allows us to specify the version as PKGNAME_VERSION=1.2.3 on the cmd-line
        if [[ -z $V ]]; then
		V=$(eval echo \$${_P}_VERSION)
	fi

	# oops, we need a version
	if [[ -z $V ]]; then
		die 1 "$P: Missing version."
	fi
353 354
	MODULE_SRCDIR="${BUILD_TMPDIR}/src/${P/_serial}-$V"
	MODULE_BUILDDIR="${BUILD_TMPDIR}/build/$P-$V/$COMPILER/$COMPILER_VERSION"
gsell's avatar
gsell committed
355 356

	# build module name
357 358
	# :FIXME: the MODULE_PREFIX should be derived from MODULE_NAME
	# :FIXME: this should be read from a configuration file
359
	case ${MODULE_FAMILY} in
360
	    Tools )
361 362
		MODULE_RPREFIX="${P}/${V}"
		MODULE_NAME="${P}/${V}"
363 364
		;;
	    Programming )
365 366
		MODULE_RPREFIX="${P}/${V}"
		MODULE_NAME="${P}/${V}"
gsell's avatar
gsell committed
367
		;;
368
	    Libraries )
369 370
		MODULE_RPREFIX="${P}/${V}"
		MODULE_NAME="${P}/${V}"
371
		;;
372
	    System )
373 374
		MODULE_RPREFIX="${P}/${V}"
		MODULE_NAME="${P}/${V}"
375
		;;
376
	    Compiler )
377 378
		MODULE_RPREFIX="${P}/${V}/${COMPILER}/${COMPILER_VERSION}"
		MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/${P}/${V}"
gsell's avatar
gsell committed
379
		;;
380
	    MPI )
381 382
		MODULE_RPREFIX="${P}/${V}/${MPI}/${MPI_VERSION}/${COMPILER}/${COMPILER_VERSION}"
		MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/${MPI}/${MPI_VERSION}/${P}/${V}"
gsell's avatar
gsell committed
383
		;;
384
	    HDF5 )
385 386
		MODULE_RPREFIX="${P}/${V}/${HDF5}/${HDF5_VERSION}/${MPI}/${MPI_VERSION}/${COMPILER}/${COMPILER_VERSION}/"
		MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/${MPI}/${MPI_VERSION}/${HDF5}/${HDF5_VERSION}/${P}/${V}"
gsell's avatar
gsell committed
387
		;;
388
	    HDF5_serial )
389 390
		MODULE_RPREFIX="${P}/${V}/hdf5_serial/${HDF5_SERIAL_VERSION}/${COMPILER}/${COMPILER_VERSION}"
		MODULE_NAME="${COMPILER}/${COMPILER_VERSION}/hdf5_serial/${HDF5_VERSION}/${P}/${V}"
gsell's avatar
gsell committed
391
		;;
gsell's avatar
gsell committed
392
	    * )
393
		die 1 "$P: oops: unknown family: ${MODULE_FAMILY}"
gsell's avatar
gsell committed
394 395 396
		;;
	esac

gsell's avatar
gsell committed
397
	# set PREFIX of module
398
	PREFIX="${PSI_PREFIX}/${MODULE_FAMILY}/${MODULE_RPREFIX}"
gsell's avatar
gsell committed
399

400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
	# get module release if already installed
	local saved_modulepath=${MODULEPATH}
	for rel in $(< "${PSI_PREFIX}/${PSI_RELEASES_CONF}"); do
		eval $("${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/unuse.bash" ${rel/.})
	done
	for rel in '.stable' $(< "${PSI_PREFIX}/${PSI_RELEASES_CONF}"); do
		if [[ "${rel}" != '.stable' ]]; then
			eval $("${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/use.bash" ${rel/.})
		fi
		if is_module_available "${P}/${V}"; then
			cur_module_release=${rel}
			info "${P}/${V}: already available and is in release \"${rel/.}\""
			break
		fi
	done
	MODULEPATH=${saved_modulepath}

	# set release of module
	# release is deprecated
	#   - if a build-dependency is deprecated or 
	#   - the module already exists and is deprecated or
	#   - is forced to be deprecated by setting this on the command line
	if [[ "${depend_release}" == '.deprecated' ]] || \
		[[ "${cur_module_release}" == '.deprecated' ]] \
		|| [[ "${MODULE_RELEASE}" == '.deprecated' ]]; then
		MODULE_RELEASE='.deprecated'
		info "${P}/${V}: will be released as \"deprecated\""
	#
	# release is stable
	#   - if all build-dependency are stable or
	#   - the module already exists and is stable
	#   - an unstable release of the module exists and the release is changed to stable on the command line
	elif [[ "${depend_release}" == '.stable' ]] \
		|| [[ "${cur_module_release}" == '.stable' ]] \
		|| [[ "${MODULE_RELEASE}" == '.stable' ]]; then
		MODULE_RELEASE='.stable'
		info "${P}/${V}: will be released as \"stable\""
	#
	# release is unstable
	#   - if a build-dependency is unstable or 
	#   - if the module does not exists and no other release-type is given on the command line
	#   - and all the cases I didn't think of
	else
		MODULE_RELEASE='.unstable'
		info "${P}/${V}: will be released as \"unstable\""
	fi
446 447

	# directory for README's, license files etc
gsell's avatar
gsell committed
448 449
	DOCDIR="${PREFIX}/share/doc/$P"

450
	# set tar-ball and flags for tar
451
	TARBALL="${BUILD_DOWNLOADSDIR}/${P/_serial}-$V.tar"
gsell's avatar
gsell committed
452 453 454 455 456 457 458
	if [[ -r $TARBALL.gz ]]; then
		TARBALL=${TARBALL}.gz
		_UNTAR_FLAGS='xvzf'
	elif [[ -r ${TARBALL}.bz2 ]]; then
		TARBALL=${TARBALL}.bz2
		_UNTAR_FLAGS='xvjf'
	else
459
		error "tar-ball for $P/$V not found."
gsell's avatar
gsell committed
460 461
		exit 43
	fi
462

gsell's avatar
gsell committed
463 464
}

465
function _prep() {
gsell's avatar
gsell committed
466 467

	# untar sources
468 469 470
	if [[ ! -d ${MODULE_SRCDIR} ]]; then
		mkdir -p "${BUILD_TMPDIR}/src"
		(cd "${BUILD_TMPDIR}/src" && tar ${_UNTAR_FLAGS} "${TARBALL}")
gsell's avatar
gsell committed
471 472 473
	fi

	# create build directory
474
	mkdir -p "${MODULE_BUILDDIR}"
gsell's avatar
gsell committed
475 476 477 478 479 480 481 482

}

function em.pre_configure() {
	:
}

function em.configure() {
483
	${MODULE_SRCDIR}/configure \
gsell's avatar
gsell committed
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
		--prefix="${PREFIX}"
}

function em.build() {
	make -j${JOBS}
}

function em.install() {
	make install
}

function em.post_install() {
	:
}

function em.install_doc() {
500
	info "Installing documentation to ${DOCDIR}"
501
	install -m 0755 -d "${DOCDIR}"
502
	install -m0444 "${MODULE_DOCFILES[@]/#/${MODULE_SRCDIR}/}" "${BUILDSCRIPT}" "${DOCDIR}"
gsell's avatar
gsell committed
503 504 505
}

function _set_link() {
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
	[[ ${cur_module_release} == ${MODULE_RELEASE} ]] && return 0
	local _path
	if [[ "${cur_module_release}" != '' ]]; then
		_path="${PSI_PREFIX}/${PSI_MODULES_ROOT}/${MODULE_FAMILY}${cur_module_release/.stable}/${MODULE_NAME}"
		info "Removing old sym-link \"${_path}\" ..."
		rm "${_path}"
	fi
	(
		_path="${PSI_PREFIX}/${PSI_MODULES_ROOT}/${MODULE_FAMILY}${MODULE_RELEASE/.stable}/${MODULE_NAME%/*}"
		info "Setting new sym-link \"${_path}/${V}\" ..."
		mkdir -p "${_path}"
		cd "${_path}"
		local x
		IFS='/' x=( ${_path/${PSI_PREFIX}\/${PSI_MODULES_ROOT}\/} )
		local n=${#x[@]}
		local -r _target="../"$(eval printf "../%.s" {1..${n}})${PSI_CONFIG_DIR##*/}/"${MODULE_FAMILY}/${P}/modulefile"
		ln -fs "${_target}" "${MODULE_NAME##*/}"
gsell's avatar
gsell committed
523 524 525 526 527
	)
}

function _cleanup_build() {
    (
528 529
	[[ -d /${MODULE_BUILDDIR} ]] || return 0
	cd "/${MODULE_BUILDDIR}/..";
gsell's avatar
gsell committed
530
	if [[ $(pwd) != / ]]; then
gsell's avatar
gsell committed
531
		echo "Cleaning up $(pwd)/${COMPILER_VERSION}"
gsell's avatar
gsell committed
532 533 534 535 536
		rm -rf *
	fi
    );
}

537 538
function em.cleanup_src() {
    (
539 540
	[[ -d /${MODULE_SRCDIR} ]] || return 0
	cd "/${MODULE_SRCDIR}/..";
541 542
	if [[ $(pwd) != / ]]; then
		echo "Cleaning up $(pwd)"
543
		rm -rf ${MODULE_SRCDIR##*/}
544 545 546 547
	fi
    );
}

gsell's avatar
gsell committed
548
function _check_compiler() {
549 550
	test -z ${MODULE_SUPPORTED_COMPILERS} && return 0
	for cc in ${MODULE_SUPPORTED_COMPILERS[@]}; do
gsell's avatar
gsell committed
551 552 553 554 555 556
		if [[ ${COMPILER}/${COMPILER_VERSION} =~ ${cc} ]]; then
			return 0
		fi
	done
	die 0 "Package cannot be build with ${COMPILER}/${COMPILER_VERSION}."
}
557

558 559 560 561 562 563 564 565 566 567
# unfortunatelly we need sometime an OS depended post-install
function _post_install_linux() {
	cd "${PREFIX}"
	# solve multilib problem with LIBRARY_PATH on 64bit Linux
	[[ -d "lib" ]] && [[ ! -d "lib64" ]] && ln -s lib lib64
}

function _post_install() {
	info "Run post-installation for ${OS}"
	[[ "${OS}" == "Linux" ]] && _post_install_linux
gsell's avatar
gsell committed
568
	return 0
569
}
570

571 572
function em.make_all() {
	echo "${P}:"
573
	_setup_env1
574
	_load_build_dependencies
575
	# setup module specific environment
576 577
	_setup_env2

gsell's avatar
gsell committed
578
	if [[ ! -d "${PREFIX}" ]] || [[ ${FORCE_REBUILD} ]]; then
579
 		echo "Building $P/$V ..."
580
		[[ "${DRY_RUN}" ]] && die 0 ""
gsell's avatar
gsell committed
581
		_check_compiler
582
		_prep
583
		cd "${MODULE_SRCDIR}"
gsell's avatar
gsell committed
584
		em.pre_configure
585
		cd "${MODULE_BUILDDIR}"
gsell's avatar
gsell committed
586 587 588 589 590
		em.configure
		em.build
		em.install
		em.post_install
		em.install_doc
591 592 593 594
		_post_install
		_write_runtime_dependencies
		_write_build_dependencies
		
gsell's avatar
gsell committed
595
	else
596
 		echo "Not rebuilding $P/$V ..."
gsell's avatar
gsell committed
597 598 599 600 601
	fi
	_set_link
	_cleanup_build
}

602 603 604 605 606 607

# Local Variables:
# mode: sh
# sh-basic-offset: 8
# tab-width: 8
# End: