Blame env-builder-data/build/script/packet/opentoonz-nsis.sh

f0ec65
DEPS="opentoonz-master"
18e95a
DEPS_NATIVE="nsis-2.50"
192cd8
192cd8
pkfunc_register_file() {
192cd8
    local FILE=$1
192cd8
    local WIN_FILE=$(echo "$FILE" | sed "s|\/|\\\\|g")
192cd8
    ! [ -L "$FILE" ] || return 0
192cd8
192cd8
    if [ "${FILE:0:8}" = "./files-" ]; then
192cd8
        true # skip
192cd8
    elif [ "${FILE:0:24}" = "./share/opentoonz/stuff/" ]; then
192cd8
        if [ -d "$FILE" ]; then
192cd8
            echo "CreateDirectory \"\$STUFFDIR\\${WIN_FILE:24}\""   >> "files-stuff-install.nsh"
823a31
            foreachfile "$FILE" pkfunc_register_file
192cd8
            echo "RMDir \"\$STUFFDIR\\${WIN_FILE:24}\""             >> "files-stuff-uninstall.nsh"
192cd8
        else
192cd8
            echo "File \"/oname=${WIN_FILE:24}\" \"${WIN_FILE:2}\"" >> "files-stuff-install.nsh"
192cd8
            echo "Delete \"\$STUFFDIR\\${WIN_FILE:24}\""            >> "files-stuff-uninstall.nsh"
192cd8
        fi
192cd8
    elif [ "${FILE:0:2}" = "./" ]; then
192cd8
        if [ -d "$FILE" ]; then
192cd8
            echo "CreateDirectory \"\$INSTDIR\\${WIN_FILE:2}\""     >> "files-install.nsh"
823a31
            foreachfile "$FILE" pkfunc_register_file
192cd8
            echo "RMDir \"\$INSTDIR\\${WIN_FILE:2}\""               >> "files-uninstall.nsh" 
192cd8
        else
192cd8
            echo "File \"/oname=${WIN_FILE:2}\" \"${WIN_FILE:2}\""  >> "files-install.nsh"
192cd8
            echo "Delete \"\$INSTDIR\\${WIN_FILE:2}\""              >> "files-uninstall.nsh" 
192cd8
        fi
192cd8
    else
192cd8
        foreachfile $FILE pkfunc_register_file
192cd8
    fi
192cd8
}
192cd8
192cd8
pkinstall_release() {
192cd8
    # create temporary dir
192cd8
    rm -rf "$INSTALL_RELEASE_PACKET_DIR/installer"
192cd8
    mkdir -p "$INSTALL_RELEASE_PACKET_DIR/installer"
192cd8
    cd "$INSTALL_RELEASE_PACKET_DIR/installer" || return 1
192cd8
192cd8
    # copy files
192cd8
    copy "$ENVDEPS_RELEASE_PACKET_DIR" "./" || return 1
3a63fb
192cd8
    # get version
4208a4
    local LOCAL_VERSION_FULL=$(cat $ENVDEPS_RELEASE_PACKET_DIR/version-opentoonz-*)
c5015b
    local LOCAL_VERSION=$(echo "$LOCAL_VERSION_FULL" | cut -d - -f 1)
c5015b
    local LOCAL_VERSION2=$(echo "$LOCAL_VERSION" | cut -d . -f -2)
c5015b
    local LOCAL_COMMIT=$(echo "$LOCAL_VERSION_FULL" | cut -d - -f 2)
192cd8
192cd8
    # create file lists
192cd8
    echo "create file lists"
192cd8
    pkfunc_register_file .
192cd8
    echo "created"
192cd8
192cd8
    # copy NSIS configuration
192cd8
    cp "$FILES_PACKET_DIR/opentoonz.nsi" "./" || return 1
3a63fb
192cd8
    # create config.nsh (see opentoons.nsi)
192cd8
    cat > config.nsh << EOF
192cd8
!define PK_NAME         "OpenToonz" 
aefcfb
!define PK_NAME_FULL    "OpenToonz Morevna Edition (${ARCH}bit)"
1f2234
!define PK_ARCH         "${ARCH}"
c5015b
!define PK_VERSION      "${LOCAL_VERSION2}"
c5015b
!define PK_VERSION_FULL "${LOCAL_VERSION}-${LOCAL_COMMIT:0:5}" 
5ebfdb
!define PK_EXECUTABLE   "bin\\\${PK_NAME}.exe"
f23bb2
!define PK_ICON         "bin\\toonz.ico" 
192cd8
EOF
192cd8
192cd8
    # let's go
3a63fb
    makensis opentoonz.nsi || return 1
192cd8
192cd8
    # remove temporary dir
192cd8
    cd "$INSTALL_RELEASE_PACKET_DIR" || return 1
192cd8
    mv installer/*.exe ./ || return 1
192cd8
    rm -rf "installer"
192cd8
}