git: 806d375480d8 - main - www/moodle42: Add new port, copied from www/moodle41

From: Wen Heping <wen_at_FreeBSD.org>
Date: Sun, 23 Apr 2023 12:15:02 UTC
The branch main has been updated by wen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=806d375480d8916603d2ad7f5bf5eb64f56cce6f

commit 806d375480d8916603d2ad7f5bf5eb64f56cce6f
Author:     Wen Heping <wen@FreeBSD.org>
AuthorDate: 2023-04-23 12:08:28 +0000
Commit:     Wen Heping <wen@FreeBSD.org>
CommitDate: 2023-04-23 12:14:34 +0000

    www/moodle42: Add new port, copied from www/moodle41
---
 www/moodle42/Makefile             | 62 +++++++++++++++++++++++++++++++++++++++
 www/moodle42/distinfo             |  3 ++
 www/moodle42/files/pkg-message.in | 59 +++++++++++++++++++++++++++++++++++++
 www/moodle42/pkg-descr            |  5 ++++
 4 files changed, 129 insertions(+)

diff --git a/www/moodle42/Makefile b/www/moodle42/Makefile
new file mode 100644
index 000000000000..78ab79f6560c
--- /dev/null
+++ b/www/moodle42/Makefile
@@ -0,0 +1,62 @@
+PORTNAME=	moodle
+PORTVERSION=	4.2
+CATEGORIES=	www education
+MASTER_SITES=	SF/moodle/Moodle/stable402/
+PKGNAMESUFFIX=	${PKGORIGIN:T:S/moodle//}${PHP_PKGNAMESUFFIX}
+
+MAINTAINER=	wen@FreeBSD.org
+COMMENT=	Course management system based on social constructionism
+WWW=		https://www.moodle.org/
+
+LICENSE=	GPLv3
+
+CONFLICTS=	moodle39-3.9.[0-9]* moodle311-3.11.[0-9]* moodle40-4.0.[0-9]* \
+		moodle41-4.1.[0-9]*
+
+USES=		cpe php:flavors tar:tgz
+USE_PHP=	ctype curl dom exif fileinfo filter gd \
+		iconv intl mbstring opcache \
+		session simplexml soap sodium tokenizer \
+		xml xmlreader xmlrpc zip zlib
+IGNORE_WITH_PHP=	82
+
+WRKSRC=		${WRKDIR}/moodle
+
+OPTIONS_SINGLE=		BACKEND
+OPTIONS_SINGLE_BACKEND=	MYSQL PGSQL
+OPTIONS_DEFINE=		LDAP
+OPTIONS_DEFAULT=	MYSQL
+
+MYSQL_USES=	mysql
+MYSQL_USE=	php=mysqli
+PGSQL_USE=	php=pgsql
+LDAP_USE=	php=ldap
+
+NO_BUILD=	yes
+PLIST=		${WRKDIR}/plist
+SUB_FILES=	pkg-message
+SUB_LIST=	MOODLEDIR=${MOODLEDIR} \
+		MOODLEDATADIR=${MOODLEDATADIR}
+
+MOODLEDIR?=	www/moodle
+MOODLEDATADIR?=	moodledata
+
+pre-install:
+	@${ECHO_CMD} "@owner ${WWWOWN}" >> ${PLIST}
+	@${ECHO_CMD} "@group ${WWWGRP}" >> ${PLIST}
+	@${ECHO_CMD} "@mode 755" >> ${PLIST}
+	@${ECHO} @dir ${MOODLEDATADIR} >> ${PLIST}
+	@${ECHO_CMD} "@mode" >> ${PLIST}
+	@${ECHO_CMD} "@group" >> ${PLIST}
+	@${ECHO_CMD} "@owner" >> ${PLIST}
+
+#  Here for safety I do not set moodle diretory 0755 permission
+#  It require user write config.php manually then.
+	@${FIND} -s -d ${WRKSRC} -type f | ${SED} "s?${WRKSRC}?${MOODLEDIR}?g" >>${PLIST}
+	@${FIND} -s -d ${WRKSRC} -type d  | ${SED} "s?${WRKSRC}?@dir ${MOODLEDIR}?g" >> ${PLIST}
+
+do-install:
+	@cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/${MOODLEDIR}
+	@${INSTALL} -d ${STAGEDIR}${PREFIX}/${MOODLEDATADIR}
+
+.include <bsd.port.mk>
diff --git a/www/moodle42/distinfo b/www/moodle42/distinfo
new file mode 100644
index 000000000000..706188d462e8
--- /dev/null
+++ b/www/moodle42/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1682247650
+SHA256 (moodle-4.2.tgz) = c805bd0edbda1e4dbb3a1a94db7526fa74b2bd2d0625e739f2130bda4aca1e35
+SIZE (moodle-4.2.tgz) = 65222713
diff --git a/www/moodle42/files/pkg-message.in b/www/moodle42/files/pkg-message.in
new file mode 100644
index 000000000000..5282847317fb
--- /dev/null
+++ b/www/moodle42/files/pkg-message.in
@@ -0,0 +1,59 @@
+[
+{ type: install
+  message: <<EOM
+1) Create a user and a database for Moodle to store all
+   its tables in (or choose an existing database).
+   It doesn't matter what the database or user names are,
+   as this will be configured in a later step.
+   NOTE: this package assumes that either the phpX-pgsql,
+   phpX-mysql, or phpX-mssql packages are installed.
+
+2) Add the following to your Apache configuration file
+   httpd.conf, and restart the server:
+
+   Alias /moodle %%PREFIX%%/%%MOODLEDIR%%/
+   AcceptPathInfo On
+   <Directory %%PREFIX%%/%%MOODLEDIR%%/>
+      AllowOverride None
+      Require all granted
+   </Directory>
+
+3) Visit your Moodle site with a browser (i.e.,
+   http://your.server.com/moodle/), and you should
+   be taken to the install.php script, which will lead
+   you through creating a config.php file and then
+   setting up Moodle, creating an admin account, etc.
+
+   At one step, you will get a message saying that the
+   installer script was not able to automatically create
+   the config.php file. Just download it and copy it to
+   %%PREFIX%%/%%MOODLEDIR%%/config.php. Beware that it
+   will contain the database password in cleartext, so
+   set up whatever file permissions you deem more adequate.
+   For instance, user=root, group=www, mask=640.
+
+4) Set up a cron task to invoke the file admin/cron.php
+   every five minutes or so. For instance:
+   */5 * * * * fetch http://your.server.com/moodle/admin/cron.php
+
+For more information, see the INSTALL DOCUMENTATION:
+
+   http://docs.moodle.org/en/Installing_Moodle
+
+It may be worth reading the installation docs even if Moodle seems
+to be working at first, to ensure your PHP settings and database
+configuration will allow Moodle to operate properly.
+EOM
+}
+{ type: upgrade
+  message: <<EOM
+If you are upgrading from an earlier version of Moodle, check out
+possible additional steps at:
+
+   https://docs.moodle.org/400/en/Upgrading
+
+If you have real trouble, please visit the Moodle course
+"Using Moodle" on moodle.org.
+EOM
+}
+]
diff --git a/www/moodle42/pkg-descr b/www/moodle42/pkg-descr
new file mode 100644
index 000000000000..8d24b9357db9
--- /dev/null
+++ b/www/moodle42/pkg-descr
@@ -0,0 +1,5 @@
+Moodle is a course management system (CMS) - a free, Open Source software
+package designed using sound pedagogical principles, to help educators
+create effective online learning communities. You can use it on any
+computer you have handy (including webhosts), yet it can scale from a
+single-teacher site to a 40,000-student University.