git: 04cfaff8c84d - main - textproc/libkolabxml: Update to 1.2.1

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Sat, 23 Sep 2023 02:10:31 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=04cfaff8c84d18d6ce14583ae6a24c0e5b2f0e88

commit 04cfaff8c84d18d6ce14583ae6a24c0e5b2f0e88
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2023-09-23 01:53:59 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2023-09-23 02:10:25 +0000

    textproc/libkolabxml: Update to 1.2.1
    
    Upstream doesn't seem to put out pre-made releases anymore and the
    distfiles are gone for the previous version as it is, so we're
    rolling our own now from the official git repository. Add script
    and 'create-distfile' target to make future updates easier.
    
    Update WWW and LICENSE
---
 textproc/libkolabxml/Makefile                      | 18 +++++---
 textproc/libkolabxml/distinfo                      |  6 +--
 .../files/create_libkolabxml_release.sh            | 49 ++++++++++++++++++++++
 3 files changed, 64 insertions(+), 9 deletions(-)

diff --git a/textproc/libkolabxml/Makefile b/textproc/libkolabxml/Makefile
index 4d77de9e5ccc..8cdd4a7e1546 100644
--- a/textproc/libkolabxml/Makefile
+++ b/textproc/libkolabxml/Makefile
@@ -1,17 +1,17 @@
 PORTNAME=	libkolabxml
-PORTVERSION=	1.1.6
-PORTREVISION=	16
+DISTVERSION=	1.2.1
 CATEGORIES=	textproc
-MASTER_SITES=	http://mirror.kolabsys.com/pub/releases/
+MASTER_SITES=	LOCAL/kde/${PORTNAME}
+DIST_SUBDIR=	${PORTNAME}
 
 MAINTAINER=	kde@FreeBSD.org
 COMMENT=	Kolab XML Format Schema Definitions Library
-WWW=		http://www.kolab.org/about/libkolabxml
+WWW=		https://kolab.org/
 
 # The XSD schemas in schemas/ are APACHE20-licensed, and some files
 # are in public domain. The library itself and the installed headers
 # are considered LGPL3-licensed, though.
-LICENSE=	LGPL3
+LICENSE=	LGPL3+
 
 BUILD_DEPENDS=	xsdcxx:devel/xsd
 LIB_DEPENDS=	libboost_system.so:devel/boost-libs \
@@ -26,10 +26,16 @@ CMAKE_OFF=	BUILD_TESTS \
 		JAVA_BINDINGS \
 		PHP_BINDINGS \
 		PYTHON_BINDINGS
-USES=		cmake
+USES=		cmake tar:xz
 USE_CXXSTD=	c++11
 USE_LDCONFIG=	yes
 
 PLIST_SUB=	SHLIB_VER=${PORTVERSION}
 
+create-distfile:
+	${MKDIR} ${DISTDIR}/${DIST_SUBDIR}
+	${SH} ${FILESDIR}/create_libkolabxml_release.sh \
+		${DISTDIR}/${DIST_SUBDIR} \
+		${DISTVERSION}
+
 .include <bsd.port.mk>
diff --git a/textproc/libkolabxml/distinfo b/textproc/libkolabxml/distinfo
index 0d91cdfad521..2be902837021 100644
--- a/textproc/libkolabxml/distinfo
+++ b/textproc/libkolabxml/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1473183297
-SHA256 (libkolabxml-1.1.6.tar.gz) = e48d7f5de1860a381da27981f6c70de1c9f38c4cd536bc6558b6529ce95f0677
-SIZE (libkolabxml-1.1.6.tar.gz) = 128843
+TIMESTAMP = 1695429252
+SHA256 (libkolabxml/libkolabxml-1.2.1.tar.xz) = b3f0fd0aeb4977d36b273a087c502bfa9c52f262e3b2e3e31f17ae5d43832f51
+SIZE (libkolabxml/libkolabxml-1.2.1.tar.xz) = 105900
diff --git a/textproc/libkolabxml/files/create_libkolabxml_release.sh b/textproc/libkolabxml/files/create_libkolabxml_release.sh
new file mode 100644
index 000000000000..97aa044ded9e
--- /dev/null
+++ b/textproc/libkolabxml/files/create_libkolabxml_release.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Creates and updates a git checkout in ${BASE_DIRECTORY} for libkolabxml.
+# After that, a new distfile for the ports tree is created.
+
+PROJECT=libkolabxml
+BASE_DIRECTORY="$1"
+VERSION="$2"
+
+# Remote libkolabxml git repository
+REPO="https://git.kolab.org/diffusion/LKX/${PROJECT}.git"
+# Local checkout
+CHECKOUT="${BASE_DIRECTORY}/${PROJECT}"
+# Use the default branch
+BRANCH=master
+
+# Make sure we can use ${BASE_DIRECTORY}
+if [ ! -d "${BASE_DIRECTORY}" ] || [ ! -w "${BASE_DIRECTORY}" ] ; then
+	echo "Directory '${BASE_DIRECTORY}' does not exist"
+	exit 1
+fi
+
+# Init a new git checkout if it is missing
+if [ ! -d "${CHECKOUT}" ] ; then
+	git -C "${BASE_DIRECTORY}" clone "${REPO}"
+fi
+
+# Update the checkout of the required branch
+git -C "${CHECKOUT}" checkout "${BRANCH}" && \
+git -C "${CHECKOUT}" pull --ff-only --rebase --autostash && \
+git -C "${CHECKOUT}" fetch --tags
+if [ $? -ne 0 ] ; then
+	echo "Failed to update ${CHECKOUT}"
+	exit 1
+fi
+
+# Set up information for the distfile
+DISTNAME="${PROJECT}-${VERSION}"
+DISTFILE="${BASE_DIRECTORY}/${DISTNAME}.tar.xz"
+
+# Tar and compress distfile
+git -C ${CHECKOUT} archive --format=tar --prefix="${DISTNAME}/" "${DISTNAME}" | xz > "${DISTFILE}"
+if [ $? -ne 0 ] ; then
+	echo "Failed to create tarball ${DISTFILE}"
+	exit 1
+fi
+
+# Print out distfile information
+echo -e "Distfile:\t${DISTFILE}"