# ------------------------------------------------------------------------------
# Packaging for the PostgreSQL Extension Network (PGXN), http://pgxn.org
# ------------------------------------------------------------------------------

set(MADLIB_PGXN_RELEASE_NUMBER 1)
set(MADLIB_PGXN_VERSION_STR
    "${MADLIB_VERSION_STRING}release${MADLIB_PGXN_RELEASE_NUMBER}")
set(MADLIB_PGXN_NAME "madlib-pgxn-${MADLIB_PGXN_VERSION_STR}")

configure_file(META.json.in META.json)
configure_file(generate_package.sh.in generate_package.sh @ONLY)
configure_file(zipignore.in zipignore)
add_custom_command(
    OUTPUT madlib.zip
    COMMAND "${CMAKE_COMMAND}" -E create_symlink
        "${CMAKE_CURRENT_BINARY_DIR}/META.json"
        "${CMAKE_SOURCE_DIR}/META.json"
    COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_package.sh"
    COMMAND "${CMAKE_COMMAND}" -E remove
        "${CMAKE_SOURCE_DIR}/META.json"
    COMMENT "Creating PGXN zip file."
    VERBATIM
)
add_custom_target(pgxn DEPENDS madlib.zip)

# ------------------------------------------------------------------------------
# Packaging for the PostgreSQL Extension Network (PGXN), http://pgxn.org
# ------------------------------------------------------------------------------

set(MADLIB_PGXN_RELEASE_NUMBER 1)
set(MADLIB_PGXN_VERSION_STR
    "${MADLIB_VERSION_MAJOR}.${MADLIB_VERSION_MINOR}.${MADLIB_VERSION_PATCH}release${MADLIB_PGXN_RELEASE_NUMBER}")
set(MADLIB_PGXN_NAME "madlib-pgxn-${MADLIB_PGXN_VERSION_STR}")

configure_file(META.json.in META.json)
configure_file(generate_package.sh.in generate_package.sh @ONLY)
configure_file(zipignore.in zipignore)
add_custom_command(
    OUTPUT madlib.zip
    COMMAND "${CMAKE_COMMAND}" -E create_symlink
        "${CMAKE_CURRENT_BINARY_DIR}/META.json"
        "${CMAKE_SOURCE_DIR}/META.json"
    COMMAND "${CMAKE_CURRENT_BINARY_DIR}/generate_package.sh"
    COMMAND "${CMAKE_COMMAND}" -E remove
        "${CMAKE_SOURCE_DIR}/META.json"
    COMMENT "Creating PGXN zip file."
    VERBATIM
)
add_custom_target(pgxn DEPENDS madlib.zip)

Build System: Change malformed PGXN version string.
Build System: Change malformed PGXN version string.

Jira: MADLIB-761

It turned out PGXN version string should be x.y.z{modifier} and we missed
z.  This might be applied to v0.5 branch, but we keep it only in master
for now.
