xref: /unit/auto/modules/java_get_jar (revision 1340)
1977Smax.romanov@gmail.com
2977Smax.romanov@gmail.com# Copyright (C) NGINX, Inc.
3977Smax.romanov@gmail.com
4977Smax.romanov@gmail.com# NXT_JAR_NAME=
5977Smax.romanov@gmail.com# NXT_JAR_VERSION=
6977Smax.romanov@gmail.com# NXT_JAR_NAMESPACE=
7977Smax.romanov@gmail.com# NXT_JAR_REPO=http://central.maven.org/maven2/
8977Smax.romanov@gmail.com# NXT_JAR_LOCAL_REPO=$HOME/.m2/repository/
9977Smax.romanov@gmail.com
10977Smax.romanov@gmail.comNXT_JAR_FILE=${NXT_JAR_NAME}-${NXT_JAR_VERSION}.jar
111309Smax.romanov@nginx.comNXT_JAR_LOCAL_DIR="${NXT_JAR_LOCAL_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}"
121309Smax.romanov@nginx.comNXT_JAR_LOCAL="${NXT_JAR_LOCAL_DIR}/${NXT_JAR_FILE}"
131309Smax.romanov@nginx.comNXT_JAR_LOCAL_TMP="${NXT_JAR_LOCAL_DIR}/.${NXT_JAR_FILE}.$$"
14977Smax.romanov@gmail.comNXT_JAR_URL=${NXT_JAR_REPO}${NXT_JAR_NAMESPACE}${NXT_JAR_NAME}/${NXT_JAR_VERSION}/${NXT_JAR_FILE}
15977Smax.romanov@gmail.com
16*1340Smax.romanov@nginx.comNXT_JAR_CHK_FILE="$NXT_BUILD_DIR/$NXT_JAR_FILE"
17*1340Smax.romanov@nginx.com. auto/modules/java_chk_sha512
18*1340Smax.romanov@nginx.com
19977Smax.romanov@gmail.comif [ ! -f "$NXT_BUILD_DIR/$NXT_JAR_FILE" ]; then
20*1340Smax.romanov@nginx.com    NXT_JAR_CHK_FILE=$NXT_JAR_LOCAL
21*1340Smax.romanov@nginx.com    . auto/modules/java_chk_sha512
22*1340Smax.romanov@nginx.com
23*1340Smax.romanov@nginx.com    if [ ! -f "${NXT_JAR_LOCAL}" ]; then
24977Smax.romanov@gmail.com        $echo "getting remote $NXT_JAR_FILE ... "
25977Smax.romanov@gmail.com        $echo "getting remote $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR
26977Smax.romanov@gmail.com
271309Smax.romanov@nginx.com        mkdir -p "${NXT_JAR_LOCAL_DIR}"
281309Smax.romanov@nginx.com        curl --progress-bar "$NXT_JAR_URL" -o "$NXT_JAR_LOCAL_TMP"
29*1340Smax.romanov@nginx.com
30*1340Smax.romanov@nginx.com        NXT_JAR_CHK_FILE=$NXT_JAR_LOCAL_TMP
31*1340Smax.romanov@nginx.com        . auto/modules/java_chk_sha512
32*1340Smax.romanov@nginx.com
331309Smax.romanov@nginx.com        mv "$NXT_JAR_LOCAL_TMP" "$NXT_JAR_LOCAL"
34977Smax.romanov@gmail.com    else
35977Smax.romanov@gmail.com        $echo "getting local $NXT_JAR_FILE"
36977Smax.romanov@gmail.com        $echo "getting local $NXT_JAR_FILE ..." >> $NXT_AUTOCONF_ERR
37977Smax.romanov@gmail.com    fi
38977Smax.romanov@gmail.com
39977Smax.romanov@gmail.com    cp "$NXT_JAR_LOCAL" "$NXT_BUILD_DIR/$NXT_JAR_FILE"
40977Smax.romanov@gmail.comfi
41977Smax.romanov@gmail.com
42977Smax.romanov@gmail.comNXT_JAVA_BUILD_CP="${NXT_JAVA_BUILD_CP}:$NXT_BUILD_DIR/$NXT_JAR_FILE"
43977Smax.romanov@gmail.comNXT_JAVA_INSTALL_JARS="$NXT_JAVA_INSTALL_JARS $NXT_BUILD_DIR/$NXT_JAR_FILE"
44977Smax.romanov@gmail.comNXT_JAVA_UNINSTALL_JARS="$NXT_JAVA_UNINSTALL_JARS \$(DESTDIR)$NXT_JARS/$NXT_JAR_FILE"
45977Smax.romanov@gmail.com
46977Smax.romanov@gmail.com$echo "    \"$NXT_JAR_FILE\"," >> $NXT_JAVA_JARS
47