Skip to content

Commit

Permalink
Update recipe with some commits from #36. Credits for this commit go to
Browse files Browse the repository at this point in the history
  • Loading branch information
hadim committed Nov 21, 2018
1 parent 4612949 commit 4faed3a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
12 changes: 11 additions & 1 deletion recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
setlocal EnableDelayedExpansion

XCOPY bin\* %LIBRARY_BIN% /s /i /y
if errorlevel 1 exit 1

Expand All @@ -7,10 +9,18 @@ if errorlevel 1 exit 1
XCOPY lib\* %LIBRARY_LIB% /s /i /y
if errorlevel 1 exit 1


:: ensure that JAVA_HOME is set correctly
mkdir %PREFIX%\etc\conda\activate.d
echo set "JAVA_HOME_CONDA_BACKUP=%%JAVA_HOME%%" > "%PREFIX%\etc\conda\activate.d\java_home.bat"
echo set "JAVA_HOME=%%CONDA_PREFIX%%\Library" >> "%PREFIX%\etc\conda\activate.d\java_home.bat"
mkdir %PREFIX%\etc\conda\deactivate.d
echo set "JAVA_HOME=%%JAVA_HOME_CONDA_BACKUP%%" > "%PREFIX%\etc\conda\deactivate.d\java_home.bat"

:: Copy the [de]activate scripts to %PREFIX%\etc\conda\[de]activate.d.
:: This will allow them to be run on environment activation.
FOR %%F IN (activate deactivate) DO (
if not exist %PREFIX%\etc\conda\%%F.d MKDIR %PREFIX%\etc\conda\%%F.d
if errorlevel 1 exit 1
copy %RECIPE_DIR%\scripts\%%F.bat %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.bat
if errorlevel 1 exit 1
)
12 changes: 7 additions & 5 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ fi

mv lib/* $PREFIX/lib

# Ensure that JAVA_HOME is set correctly
mkdir -p $PREFIX/etc/conda/activate.d
mkdir -p $PREFIX/etc/conda/deactivate.d
cp $RECIPE_DIR/scripts/activate.sh $PREFIX/etc/conda/activate.d/java_home.sh
cp $RECIPE_DIR/scripts/deactivate.sh $PREFIX/etc/conda/deactivate.d/java_home.sh
# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
done
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build:

requirements:
build:
- curl
- curl # [unix]

test:
files:
Expand Down
1 change: 1 addition & 0 deletions recipe/scripts/deactivate.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set "JAVA_HOME=%JAVA_HOME_CONDA_BACKUP%"
set "JAVA_HOME_CONDA_BACKUP="
21 changes: 10 additions & 11 deletions recipe/test-jni.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#!/bin/bash

set -e
export

if [ ! -d $JAVA_LD_LIBRARY_PATH ]; then
echo "Did you remember to activate the conda environment?"
exit -1
fi

os=$(uname -s | tr '[:upper:]' '[:lower:]')
gcc -I$JAVA_HOME/include \
-I$JAVA_HOME/include/$os \
-Wl,-rpath,$JAVA_LD_LIBRARY_PATH \
-L$JAVA_LD_LIBRARY_PATH \
-L$JAVA_LD_LIBRARY_PATH/server \
-o vmtest \
test-jni/vmtest.c \
-ljvm

gcc \
-I$JAVA_HOME/include \
-I$JAVA_HOME/include/$os \
-Wl,-rpath,$JAVA_LD_LIBRARY_PATH \
-L$JAVA_LD_LIBRARY_PATH \
-ljvm \
-o vmtest \
test-jni/vmtest.c

./vmtest

0 comments on commit 4faed3a

Please sign in to comment.