Use SHLIBEXT and EXEEXT to make dist-files.mk platform independent

This commit is contained in:
Anirudha Bose 2014-06-21 21:01:08 +05:30 committed by sftnight
parent 12687731b3
commit f276927209
2 changed files with 24 additions and 6 deletions

View File

@ -18,13 +18,8 @@
###############################################################################
BIN_FILES := \
bin/cling \
bin/cling.exe
bin/cling@EXEEXT@
# CAUTION: The trailing space above is needed. DO NOT delete.
# TODO: This is currently hard-coded. There must be a platform agnostic way to
# guess the extension of binaries (and libraries ?) after compilation,
# like in this case .exe. At present there is little need for such a
# mechanism since cling.exe is the only case we are dealing with.
DOCS_FILES := \
docs/llvm/html/cling/cling.html \

View File

@ -25,6 +25,8 @@ function platform_init {
if [ "${OS}" = "Cygwin" ]; then
DIST="Win"
SHLIBEXT=".dll"
EXEEXT=".exe"
elif [ "{$OS}" = "Darwin" ]; then
OS="Mac OS"
@ -208,6 +210,22 @@ function set_version {
fi
}
function set_ext {
box_draw "Set binary/library extensions"
if [ "${LLVM_OBJ_ROOT}" = "" ]; then
LLVM_OBJ_ROOT=${builddir}
fi
if [ -f ${LLVM_OBJ_ROOT}/config.log ]; then
SHLIBEXT=$(grep "SHLIBEXT=" ${LLVM_OBJ_ROOT}/config.log | sed -e "s|SHLIBEXT=||g" -e "s|'||g")
EXEEXT=$(grep "^EXEEXT=" ${LLVM_OBJ_ROOT}/config.log | sed -e "s|EXEEXT=||g" -e "s|'||g")
else
echo "No config.log found in ${LLVM_OBJ_ROOT}. Using default values."
fi
echo "EXEEXT: ${EXEEXT}"
echo "SHLIBEXT: ${SHLIBEXT}"
}
function compile {
prefix=${1}
python=$(type -p python)
@ -243,7 +261,12 @@ function compile {
function install_prefix {
set_ext
box_draw "Filtering Cling's libraries and binaries"
echo "This is going to take a while. Please wait."
sed -i "s|@EXEEXT@|${EXEEXT}|g" ${HOST_CLING_SRC_DIR}/dist-files.mk
sed -i "s|@SHLIBEXT@|${SHLIBEXT}|g" ${HOST_CLING_SRC_DIR}/dist-files.mk
for f in $(find ${TMP_PREFIX} -type f -printf "%P\n"); do
grep -q $(echo $f | sed "s|${TMP_PREFIX}||g")[[:space:]] ${HOST_CLING_SRC_DIR}/dist-files.mk
if [ ${?} = 0 ]; then