diff --git a/recipe/bld.bat b/recipe/bld.bat index 4f215f5d..67c238e1 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -1,3 +1,5 @@ +setlocal EnableDelayedExpansion + XCOPY bin\* %LIBRARY_BIN% /s /i /y if errorlevel 1 exit 1 @@ -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 +) \ No newline at end of file diff --git a/recipe/build.sh b/recipe/build.sh index 278e78c4..cdec9391 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -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 diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5c5df05b..7d92621b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -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 }} @@ -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/ diff --git a/recipe/scripts/deactivate.bat b/recipe/scripts/deactivate.bat index c7c4e055..0f13d18c 100644 --- a/recipe/scripts/deactivate.bat +++ b/recipe/scripts/deactivate.bat @@ -1 +1,2 @@ set "JAVA_HOME=%JAVA_HOME_CONDA_BACKUP%" +set "JAVA_HOME_CONDA_BACKUP=" diff --git a/recipe/test-jni.sh b/recipe/test-jni.sh index af24fd06..e3067dc0 100755 --- a/recipe/test-jni.sh +++ b/recipe/test-jni.sh @@ -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