From 089d5af1817ad1d30c79525330befc0993ce057b Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Sun, 27 Apr 2014 10:45:45 +0200 Subject: [PATCH] em.cleanup_src() added, required for modules which must be build in the src directory --- lib/libem.bash | 18 +++++++++++++++++- scripts/lua.build | 6 +++++- scripts/mathlib.build | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/libem.bash b/lib/libem.bash index bccdf50..7466c00 100644 --- a/lib/libem.bash +++ b/lib/libem.bash @@ -1,3 +1,4 @@ +#!/bin/bash declare -rx SHLIBDIR=$( cd $(dirname "$BASH_SOURCE") && pwd ) @@ -138,10 +139,13 @@ declare -x DOCDIR='' declare -x EM_FAMILY='' declare -x EM_MODULENAME='' +declare -x CONFIG_DIR="${EM_BASEDIR}/config" +declare -x SCRIPTDIR="${EM_BASEDIR}/scripts" declare -x EM_TMPDIR="${EM_BASEDIR}/tmp" + +# these directories are module dependend declare -x EM_SRCDIR='' declare -x EM_BUILDDIR='' -declare -x CONFIG_DIR="${EM_BASEDIR}/config" declare -x EM_BUILD_DEPENDENCIES @@ -375,6 +379,18 @@ function _cleanup_build() { ); } +function em.cleanup_src() { + ( + [[ -d /${EM_SRCDIR} ]] || return 0 + cd "/${EM_SRCDIR}"; + if [[ $(pwd) != / ]]; then + echo "Cleaning up $(pwd)" + rm -rf * + fi + ); +} + + function em.make_all() { _set_env if [[ ! -d "${PREFIX}" ]] || [[ ${FORCE_REBUILD} ]]; then diff --git a/scripts/lua.build b/scripts/lua.build index 0109bff..00dcea8 100755 --- a/scripts/lua.build +++ b/scripts/lua.build @@ -1,4 +1,7 @@ #!/bin/bash +# +# Lua cannot be build in a seperate directory! +# source "$(dirname $0)/../lib/libem.bash" @@ -12,9 +15,10 @@ function em.configure() { function em.build() { cd "${EM_SRCDIR}" - make + make -j ${JOBS} } em.add_to_family "core" em.set_build_dependencies "${COMPILER}" em.make_all +em.cleanup_src diff --git a/scripts/mathlib.build b/scripts/mathlib.build index 5ad2f8d..c1e7403 100755 --- a/scripts/mathlib.build +++ b/scripts/mathlib.build @@ -51,4 +51,4 @@ em.add_to_family "compiler" em.set_runtime_dependencies "${COMPILER}" em.set_build_dependencies "${COMPILER}" em.make_all - +em.cleanup_src