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 9fd33f6
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 43 deletions.
17 changes: 10 additions & 7 deletions 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,11 @@ 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
)
22 changes: 10 additions & 12 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,21 @@ fi

if [[ `uname` == "Linux" ]]
then
mv lib/jli/*.so lib
mv lib/jli/*.so lib/

# Include dejavu fonts to allow java to work even on minimal cloud
# images where these fonts are missing (thanks to @chapmanb)
mkdir -p lib/fonts
cd lib/fonts
curl -L -O -C - http://sourceforge.net/projects/dejavu/files/dejavu/2.36/dejavu-fonts-ttf-2.36.tar.bz2
tar -xjvpf dejavu-fonts-ttf-2.36.tar.bz2
mv dejavu-fonts-ttf-*/ttf/* .
rm -rf dejavu-fonts-ttf-*
cd ../../
mv ./fonts/ttf/* ./lib/fonts/
rm -rf ./fonts
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
29 changes: 16 additions & 13 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@
{% set version = "9.0.7" %}
{% set zulu_build = "9.0.7.1" %}
{% set build_number = 0 %}
{% set sha256_linux = "45f2dfbee93b91b1468cf81d843fc6d9a47fef1f831c0b7ceff4f1eb6e6851c8" %}
{% set sha256_osx = "4b1f8529ff3a8bebc974e2a22395cb27ad8750e386c8c4d1b0a1b16f89cfcf66" %}
{% set sha256_win = "75f76c53c6a1f12b1a571b86bd9708ab75adf582d689dddc94fdd77dcc0f3f5c" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-linux_x64.tar.gz # [linux64]
url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-macosx_x64.zip # [osx]
url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-win_x64.zip # [win64]
sha256: {{ sha256_linux }} # [linux64]
sha256: {{ sha256_osx }} # [osx]
sha256: {{ sha256_win }} # [win64]
- url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-linux_x64.tar.gz # [linux64]
sha256: 45f2dfbee93b91b1468cf81d843fc6d9a47fef1f831c0b7ceff4f1eb6e6851c8

- url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-macosx_x64.zip # [osx]
sha256: 4b1f8529ff3a8bebc974e2a22395cb27ad8750e386c8c4d1b0a1b16f89cfcf66

- url: https://cdn.azul.com/zulu/bin/zulu{{ zulu_build }}-jdk{{ version }}-win_x64.zip # [win64]
sha256: 75f76c53c6a1f12b1a571b86bd9708ab75adf582d689dddc94fdd77dcc0f3f5c

- url: https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.zip # [linux64]
sha256: 7576310b219e04159d35ff61dd4a4ec4cdba4f35c00e002a136f00e96a908b0a
folder: fonts

build:
number: {{ build_number }}
Expand All @@ -29,18 +32,18 @@ build:

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

test:
files:
- test-jni # [not win]
- test-jni # [not win]
- test-jni.sh # [not win]
- test-nio
commands:
- java -version
- ./test-jni.sh # [not win]
- ./test-jni.sh # [not win]
- conda inspect linkages -p ${PREFIX} openjdk # [linux]
- conda inspect objects -p ${PREFIX} openjdk # [osx]
- conda inspect objects -p ${PREFIX} openjdk # [osx]

about:
home: https://www.azul.com/products/zulu/
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 9fd33f6

Please sign in to comment.