summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrnmst/Franco Masotti2016-10-06 15:17:32 +0200
committerfrnmst/Franco Masotti2016-10-06 15:17:32 +0200
commit31e0f4e41c7e398cee86cebc02462b19f549702d (patch)
tree9375e41a4acf8699d322a568b005a79568587011
downloadaur-31e0f4e41c7e398cee86cebc02462b19f549702d.tar.gz
First commit.
-rw-r--r--.INSTALL15
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD51
-rwxr-xr-xinstall_web_iface_deps.pl39
-rwxr-xr-xremove_web_iface_deps.pl39
-rw-r--r--run.pl43
-rwxr-xr-xrun.sh51
-rw-r--r--swish-cplint.service14
8 files changed, 271 insertions, 0 deletions
diff --git a/.INSTALL b/.INSTALL
new file mode 100644
index 000000000000..dabda07c412f
--- /dev/null
+++ b/.INSTALL
@@ -0,0 +1,15 @@
+startdir=
+
+post_install() {
+ ${startdir}/install_web_iface_deps.pl
+ echo ""
+ echo ""
+ echo "Please install the matrix package \
+separately within swipl (run as root): pack_install(matrix)."
+ echo ""
+ echo "Start and enable swish-cplint.service"
+}
+
+pre_remove() {
+ ${startdir}/remove_web_iface_deps.pl
+}
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..15cbee751219
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+pkgbase = swish-cplint
+ pkgdesc = SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite
+ pkgver = r8.13b29c6
+ pkgrel = 1
+ url = git://github.com/friguzzi/swish
+ install = .INSTALL
+ arch = x86_64
+ license = BSD
+ makedepends = git
+ makedepends = bower
+ makedepends = sed
+ depends = swi-prolog-devel
+ depends = r
+ conflicts = swish
+ source = git://github.com/friguzzi/swish#branch=master
+ md5sums = SKIP
+
+pkgname = swish-cplint
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..8c63612ea4c7
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,51 @@
+# Maintainer: Franco Masotti <franco dot masotti at student dot unife dot it>
+pkgname=swish-cplint
+pkgver=r8.13b29c6
+pkgrel=1
+pkgdesc="SWI-Prolog for SHaring: a SWI-Prolog web IDE integrated with the cplint suite"
+arch=('x86_64')
+url="git://github.com/friguzzi/swish"
+license=('BSD')
+depends=('swi-prolog-devel'
+ 'r')
+makedepends=('git'
+ 'bower'
+ 'sed')
+conflicts=('swish')
+install=.INSTALL
+source=('git://github.com/friguzzi/swish#branch=master')
+md5sums=('SKIP')
+
+prepare() {
+ # Edit the .INSTALL script.
+ sed \
+ -e "s@startdir=.*@startdir="${startdir}"@" \
+ -i ${startdir}/.INSTALL
+}
+
+build() {
+ cd ${srcdir}/swish
+ bower --allow-root install
+ make src
+ # Patch
+ cp ${startdir}/run.pl .
+ cp ${startdir}/run.sh .
+}
+
+pkgver () {
+ cd ${srcdir}/swish
+ ( set -o pipefail
+ git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+ )
+}
+
+package() {
+ cd ${srcdir}
+ install -d ${pkgdir}/usr/share/${pkgname}
+ install -d ${pkgdir}/usr/bin
+ cp -r swish/* ${pkgdir}/usr/share/${pkgname}
+ install -D -m644 swish/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ install -D -m644 ${startdir}/${pkgname}.service "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+ ln -s /usr/share/${pkgname}/run.sh ${pkgdir}/usr/bin/${pkgname}
+}
diff --git a/install_web_iface_deps.pl b/install_web_iface_deps.pl
new file mode 100755
index 000000000000..713df418d0fc
--- /dev/null
+++ b/install_web_iface_deps.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/env swipl
+
+/*
+ *
+ * install_web_iface_deps.pl
+ *
+ * Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
+ *
+ * This file is part of cplint-installer.
+ *
+ * cplint-installer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * cplint-installer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with cplint-installer. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+:- initialization main.
+
+/* Solve problem with the matrix package. */
+install:-
+ pack_install(aleph, [interactive(false)]),
+ pack_install(auc, [interactive(false)]),
+ pack_install(real, [interactive(false)]),
+ pack_install(cplint, [interactive(false)]).
+
+main:-
+ catch(install, E, (print_message(error, E), fail)),
+ halt.
+main:-
+ halt(1).
diff --git a/remove_web_iface_deps.pl b/remove_web_iface_deps.pl
new file mode 100755
index 000000000000..e3ee6c95e5cb
--- /dev/null
+++ b/remove_web_iface_deps.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/env swipl
+
+/*
+ *
+ * remove_web_iface_deps.pl
+ *
+ * Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
+ *
+ * This file is part of cplint-installer.
+ *
+ * cplint-installer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * cplint-installer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with cplint-installer. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+:- initialization main.
+
+remove:-
+ pack_remove(aleph),
+ pack_remove(auc),
+ pack_remove(real),
+ pack_remove(matrix),
+ pack_remove(cplint).
+
+main:-
+ catch(remove, E, (print_message(error, E), fail)),
+ halt.
+main:-
+ halt(1).
diff --git a/run.pl b/run.pl
new file mode 100644
index 000000000000..0c1263b0d5d8
--- /dev/null
+++ b/run.pl
@@ -0,0 +1,43 @@
+/*
+ *
+ * run.pl
+ *
+ * Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
+ *
+ * This file is part of cplint-installer.
+ *
+ * cplint-installer is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * cplint-installer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with cplint-installer. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/* Patch to run the server in backround. This file should replace the one
+ * provided in the repository.
+ */
+
+:- use_module(server).
+
+% Using `localhost:3050`, we only bind to localhost interface!
+% Use plain `3050` (or any port number you like) to make the server
+% accessible from all network interfaces.
+
+%:- initialization server(localhost:3050).
+:- initialization main.
+
+main:-
+ server(3050),
+ wait.
+
+wait:-
+ thread_get_message(_),
+ halt.
diff --git a/run.sh b/run.sh
new file mode 100755
index 000000000000..385f5e2caddb
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env sh
+
+#
+# run.sh
+#
+# Copyright (C) 2016 frnmst (Franco Masotti) <franco.masotti@student.unife.it>
+#
+# This file is part of cplint-installer.
+#
+# cplint-installer is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# cplint-installer is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with cplint-installer. If not, see <http://www.gnu.org/licenses/>.
+#
+#
+
+# This is the file called from the /usr/bin/swish-cplint symlink
+
+# Since it's a dameon, it should be able to :
+# start
+# stop
+# (restart)
+
+pid_file="/run/swish-cplint.pid"
+
+if [ "$UID" -eq 0 ]; then
+ {
+ (exec swipl --quiet -f /usr/share/swish-cplint/run.pl) &
+ pid="$!"
+ } 1>/dev/null 2>/dev/null
+
+ if [ -n "$pid" ]; then
+ printf "Server running with pid $pid\n"
+ printf "$pid\n" > "$pid_file"
+ else
+ printf "Server error\n"
+ exit 1
+ fi
+
+else
+ printf "User must be root\n"
+ exit 1
+fi
diff --git a/swish-cplint.service b/swish-cplint.service
new file mode 100644
index 000000000000..03e2cd19ab19
--- /dev/null
+++ b/swish-cplint.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Cplint on SWISH
+Documentation=http://github.com/friguzzi/cplint
+
+[Service]
+ExecStart=/usr/bin/swish-cplint
+Type=forking
+PIDFile=/run/swish-cplint.pid
+User=root
+Group=root
+
+[Install]
+WantedBy=default.target
+