Blame docker-builder-data/build/script/packet/synfigstudio-nsis.sh

a8518c
DEPS="synfigstudio-master"
a8518c
a8518c
pkfunc_register_file() {
a8518c
    local FILE=$1
a8518c
    local WIN_FILE=$(echo "$FILE" | sed "s|\/|\\\\|g")
a8518c
    ! [ -L "$FILE" ] || return 0
a8518c
a8518c
    if [[ "$FILE" != ./* ]]; then
a8518c
        foreachfile $FILE pkfunc_register_file
a8518c
    elif [ "${FILE:0:8}" = "./files-" ]; then
a8518c
        true # skip
a8518c
    else
a8518c
        local TARGET_INSTALL="files-install.nsh"
a8518c
        local TARGET_UNINSTALL="files-uninstall.nsh"
a8518c
        if [ "$FILE" = "./bin/ffmpeg.exe" ]; then
a8518c
            TARGET_INSTALL="files-ffmpeg-install.nsh"
a8518c
        elif [[ "$FILE" = "./examples/"* ]]; then
a8518c
            TARGET_INSTALL="files-examples-install.nsh"
a8518c
        fi
a8518c
a8518c
        if [ -d "$FILE" ]; then
a8518c
            echo "CreateDirectory \"\$INSTDIR\\${WIN_FILE:2}\""     >> "$TARGET_INSTALL"
a8518c
            foreachfile "$FILE" pkfunc_register_file
a8518c
            echo "RMDir \"\$INSTDIR\\${WIN_FILE:2}\""               >> "$TARGET_UNINSTALL" 
a8518c
        else
a8518c
            echo "File \"/oname=${WIN_FILE:2}\" \"${WIN_FILE:2}\""  >> "$TARGET_INSTALL"
a8518c
            echo "Delete \"\$INSTDIR\\${WIN_FILE:2}\""              >> "$TARGET_UNINSTALL" 
a8518c
        fi
a8518c
    fi
a8518c
}
a8518c
a8518c
pkinstall_release() {
a8518c
    local LOCAL_INSTALLER_DIR="$INSTALL_RELEASE_PACKET_DIR/installer"
a8518c
    local LOCAL_CACHE_DIR="$INSTALL_RELEASE_PACKET_DIR/cache"
a8518c
        
a8518c
    # create temporary dir
a8518c
    rm -rf "$LOCAL_INSTALLER_DIR"
a8518c
    mkdir -p "$LOCAL_INSTALLER_DIR"
a8518c
    cd "$LOCAL_INSTALLER_DIR" || return 1
a8518c
a8518c
    # copy files
a8518c
    copy "$ENVDEPS_RELEASE_PACKET_DIR" "./" || return 1
a8518c
a8518c
    # move examples
a8518c
    mv "./share/synfig/examples" "./"
a8518c
a8518c
    # download portable python
a8518c
    mkdir -p "$LOCAL_CACHE_DIR"
a8518c
    cd "$LOCAL_CACHE_DIR" || return 1
a8518c
    wget -c --no-check-certificate \
a8518c
        "https://download.tuxfamily.org/synfig/packages/sources/portable-python-3.2.5.1.zip" \
a8518c
        -O "portable-python-3.2.5.1.zip" || return 1
a8518c
    rm -rf "python"
a8518c
    unzip "portable-python-3.2.5.1.zip" || return 1
a8518c
    mv "python" "$LOCAL_INSTALLER_DIR/" || return 1
a8518c
    cd "$LOCAL_INSTALLER_DIR" || return 1
a8518c
a8518c
    # get version
a8518c
    local LOCAL_VERSION_FULL=$(cat $ENVDEPS_RELEASE_PACKET_DIR/version-synfigstudio-*)
a8518c
    local LOCAL_VERSION=$(echo "$LOCAL_VERSION_FULL" | cut -d - -f 1)
a8518c
    local LOCAL_VERSION2=$(echo "$LOCAL_VERSION" | cut -d . -f -2)
a8518c
    local LOCAL_COMMIT=$(echo "$LOCAL_VERSION_FULL" | cut -d - -f 2)
a8518c
a8518c
    # create file lists
a8518c
    echo "create file lists"
a8518c
    touch files-install.nsh
a8518c
    touch files-ffmpeg-install.nsh
a8518c
    touch files-examples-install.nsh
a8518c
    touch files-uninstall.nsh
a8518c
    pkfunc_register_file .
a8518c
    echo "created"
a8518c
a8518c
    # copy NSIS configuration
a8518c
    cp "$FILES_PACKET_DIR/synfigstudio.nsi" "./" || return 1
a8518c
a8518c
    # create config.nsh (see opentoons.nsi)
a8518c
    cat > config.nsh << EOF
a8518c
!define PK_NAME         "synfigstudio" 
a8518c
!define PK_NAME_FULL    "Synfig Studio"
a8518c
!define PK_ARCH         "$ARCH"
a8518c
!define PK_VERSION      "${LOCAL_VERSION2}"
a8518c
!define PK_VERSION_FULL "${LOCAL_VERSION}-${LOCAL_COMMIT:0:5}" 
a8518c
!define PK_EXECUTABLE   "bin\\synfigstudio.exe" 
a8518c
EOF
a8518c
a8518c
    # let's go
a8518c
    makensis synfigstudio.nsi || return 1
a8518c
a8518c
    # remove temporary dir
a8518c
    cd "$INSTALL_RELEASE_PACKET_DIR" || return 1
a8518c
    mv "$LOCAL_INSTALLER_DIR"/*.exe ./ || return 1
a8518c
    rm -rf "$LOCAL_INSTALLER_DIR"
a8518c
}