c++/jvm-jni-starter/nbproject/Package-Release.bash
author František Kučera <franta-hg@frantovo.cz>
Fri, 08 May 2020 00:02:05 +0200
changeset 57 1b21c78d8706
parent 55 2fbf53cf0782
permissions -rw-r--r--
SQLite: demo modul – rozšíření přidávající pár funkcí do SQL
Vzniklo v rámci práce na článku: https://blog.frantovo.cz/c/383/Komplexita%3A%20%C5%99e%C5%A1en%C3%AD%20a%C2%A0prevence
franta-hg@55
     1
#!/bin/bash -x
franta-hg@55
     2
franta-hg@55
     3
#
franta-hg@55
     4
# Generated - do not edit!
franta-hg@55
     5
#
franta-hg@55
     6
franta-hg@55
     7
# Macros
franta-hg@55
     8
TOP=`pwd`
franta-hg@55
     9
CND_PLATFORM=GNU-Linux
franta-hg@55
    10
CND_CONF=Release
franta-hg@55
    11
CND_DISTDIR=dist
franta-hg@55
    12
CND_BUILDDIR=build
franta-hg@55
    13
CND_DLIB_EXT=so
franta-hg@55
    14
NBTMPDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM}/tmp-packaging
franta-hg@55
    15
TMPDIRNAME=tmp-packaging
franta-hg@55
    16
OUTPUT_PATH=${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/jvm-jni-starter
franta-hg@55
    17
OUTPUT_BASENAME=jvm-jni-starter
franta-hg@55
    18
PACKAGE_TOP_DIR=jvm-jni-starter/
franta-hg@55
    19
franta-hg@55
    20
# Functions
franta-hg@55
    21
function checkReturnCode
franta-hg@55
    22
{
franta-hg@55
    23
    rc=$?
franta-hg@55
    24
    if [ $rc != 0 ]
franta-hg@55
    25
    then
franta-hg@55
    26
        exit $rc
franta-hg@55
    27
    fi
franta-hg@55
    28
}
franta-hg@55
    29
function makeDirectory
franta-hg@55
    30
# $1 directory path
franta-hg@55
    31
# $2 permission (optional)
franta-hg@55
    32
{
franta-hg@55
    33
    mkdir -p "$1"
franta-hg@55
    34
    checkReturnCode
franta-hg@55
    35
    if [ "$2" != "" ]
franta-hg@55
    36
    then
franta-hg@55
    37
      chmod $2 "$1"
franta-hg@55
    38
      checkReturnCode
franta-hg@55
    39
    fi
franta-hg@55
    40
}
franta-hg@55
    41
function copyFileToTmpDir
franta-hg@55
    42
# $1 from-file path
franta-hg@55
    43
# $2 to-file path
franta-hg@55
    44
# $3 permission
franta-hg@55
    45
{
franta-hg@55
    46
    cp "$1" "$2"
franta-hg@55
    47
    checkReturnCode
franta-hg@55
    48
    if [ "$3" != "" ]
franta-hg@55
    49
    then
franta-hg@55
    50
        chmod $3 "$2"
franta-hg@55
    51
        checkReturnCode
franta-hg@55
    52
    fi
franta-hg@55
    53
}
franta-hg@55
    54
franta-hg@55
    55
# Setup
franta-hg@55
    56
cd "${TOP}"
franta-hg@55
    57
mkdir -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package
franta-hg@55
    58
rm -rf ${NBTMPDIR}
franta-hg@55
    59
mkdir -p ${NBTMPDIR}
franta-hg@55
    60
franta-hg@55
    61
# Copy files and create directories and links
franta-hg@55
    62
cd "${TOP}"
franta-hg@55
    63
makeDirectory "${NBTMPDIR}/jvm-jni-starter/bin"
franta-hg@55
    64
copyFileToTmpDir "${OUTPUT_PATH}" "${NBTMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
franta-hg@55
    65
franta-hg@55
    66
franta-hg@55
    67
# Generate tar file
franta-hg@55
    68
cd "${TOP}"
franta-hg@55
    69
rm -f ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/jvm-jni-starter.tar
franta-hg@55
    70
cd ${NBTMPDIR}
franta-hg@55
    71
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/package/jvm-jni-starter.tar *
franta-hg@55
    72
checkReturnCode
franta-hg@55
    73
franta-hg@55
    74
# Cleanup
franta-hg@55
    75
cd "${TOP}"
franta-hg@55
    76
rm -rf ${NBTMPDIR}