You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

333 lines
11 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/sh
# Generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST
# Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015 Eric Hameleers, Eindhoven, Netherlands
# Copyright 2015-2017 Thorn Inurcide
# Copyright 2015-2017 tde-slackbuilds project on GitHub
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
PRGNAM=tdeedu
VERSION=$TDEVERSION
BUILD=${BUILD:-1}
TAG=${TAG:-_tde}
[[ $(cat $TMPVARS/PRE_DOWNLOAD) != yes ]] && {
# ### Kalzium Chemical Equation Solver - start
## Needs OCaml and facile
ocaml_installed_fn () { [[ -s /usr/local/lib$LIBDIRSUFFIX/ocaml/libnums.a ]] && \
[[ -s /usr/local/lib$LIBDIRSUFFIX/ocaml/facile/facile.a ]] ;}
## If they are already installed, go to OCAML="ON"
ocaml_installed_fn || {
## otherwise, if the source archives are in 'src' ..
[[ -s $BUILD_TDE_ROOT/src/4.05.0.tar.gz ]] && \
[[ -s $BUILD_TDE_ROOT/src/facile-1.1.3.tar.gz ]] && {
## .. build, package, and install them
(
## ocaml:
echo -e "\n building ocaml \n"
cd /$TMP_BUILD
rm -rf *ocaml*
tar xf $BUILD_TDE_ROOT/src/4.05.0.tar.gz
cd ocaml-4.05.0/
## patch for error caused by glibc-2.34:
## signals_asm.c:197:13: error: variably modified sig_alt_stack at file scope
## Refs: https://github.com/ocaml/ocaml/{issues/10250,pull/10266}
## https://github.com/dra27/ocaml/[pull/56]
## └ 0d2c1fd77b4715c70d0ffc4348f1bc2d3eaacbf7 refs/remotes/origin/alt-signal-stack-4.05
## └ commit 50c2d1275e537906ea144bd557fde31e0bf16e5f
echo -e "\033[39;1m"
patch -p0 << EOF
--- asmrun/fail.c
+++ asmrun/fail.c
@@ -33,0 +34,2 @@
+extern void caml_terminate_signals(void);
+
@@ -63 +65,4 @@
- if (caml_exception_pointer == NULL) caml_fatal_uncaught_exception(v);
+ if (caml_exception_pointer == NULL) {
+ caml_terminate_signals();
+ caml_fatal_uncaught_exception(v);
+ }
--- asmrun/signals_asm.c
+++ asmrun/signals_asm.c
@@ -197 +196,0 @@
-static char sig_alt_stack[SIGSTKSZ];
@@ -298,8 +297,18 @@
- stk.ss_sp = sig_alt_stack;
- stk.ss_size = SIGSTKSZ;
- stk.ss_flags = 0;
- SET_SIGACT(act, segv_handler);
- act.sa_flags |= SA_ONSTACK | SA_NODEFER;
- sigemptyset(&act.sa_mask);
- system_stack_top = (char *) &act;
- if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); }
+ /* Allocate and select an alternate stack for handling signals,
+ especially SIGSEGV signals.
+ The alternate stack used to be statically-allocated for the main thread,
+ but this is incompatible with Glibc 2.34 and newer, where SIGSTKSZ
+ may not be a compile-time constant. */
+ stk.ss_sp = malloc(SIGSTKSZ);
+ if (stk.ss_sp != NULL) {
+ stk.ss_size = SIGSTKSZ;
+ stk.ss_flags = 0;
+ SET_SIGACT(act, segv_handler);
+ act.sa_flags |= SA_ONSTACK | SA_NODEFER;
+ sigemptyset(&act.sa_mask);
+ system_stack_top = (char *) &act;
+ if (sigaltstack(&stk, NULL) == 0)
+ sigaction(SIGSEGV, &act, NULL);
+ else
+ free(stk.ss_sp);
+ }
@@ -309,0 +319,42 @@
+#endif
+}
+
+/* Termination of signal stuff */
+
+#if defined(TARGET_power) || defined(TARGET_s390x) \\
+ || defined(TARGET_sparc) && defined(SYS_solaris) \\
+ || defined(HAS_STACK_OVERFLOW_DETECTION)
+static void set_signal_default(int signum)
+{
+ struct sigaction act;
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = SIG_DFL;
+ act.sa_flags = 0;
+ sigaction(signum, &act, NULL);
+}
+#endif
+
+void caml_terminate_signals(void)
+{
+#if defined(TARGET_sparc) && defined(SYS_solaris)
+ set_signal_default(SIGILL);
+#endif
+
+#if defined(TARGET_power)
+ set_signal_default(SIGTRAP);
+#endif
+
+#if defined(TARGET_s390x)
+ set_signal_default(SIGFPE);
+#endif
+
+#ifdef HAS_STACK_OVERFLOW_DETECTION
+ set_signal_default(SIGSEGV);
+ stack_t oldstk, stk;
+ stk.ss_flags = SS_DISABLE;
+ if (sigaltstack(&stk, &oldstk) == 0) {
+ /* If caml_init_signals failed, we are not using an alternate signal stack.
+ SS_DISABLE will be set in oldstk, and there is nothing to free in this
+ case. */
+ if (! (oldstk.ss_flags & SS_DISABLE)) free(oldstk.ss_sp);
+ }
--- asmrun/startup.c
+++ asmrun/startup.c
@@ -94,0 +95 @@
+extern void caml_terminate_signals(void);
@@ -105,0 +107 @@
+ value res;
@@ -140,0 +143 @@
+ caml_terminate_signals();
@@ -144 +147,3 @@
- return caml_start_program();
+ res = caml_start_program();
+ caml_terminate_signals();
+ return res;
--- byterun/sys.c
+++ byterun/sys.c
@@ -113,0 +114,2 @@
+extern void caml_terminate_signals(void);
+
@@ -146,0 +149,3 @@
+#ifdef NATIVE_CODE
+ caml_terminate_signals();
+#endif
EOF
## clang build errors:
#amd64.S:728:9: error: changed section flags for .rodata.cst8, expected: 0x12
#amd64.S:728:9: error: changed section entsize for .rodata.cst8, expected: 8
## backport from ocaml commit 8a46d76bf9359b5cc505b3f2f9c81eb624c631fa
patch -p0 << EOF
--- asmcomp/amd64/emit.mlp
+++ asmcomp/amd64/emit.mlp
@@ -993,1 +993,1 @@
- | _ -> D.section [".rodata.cst8"] (Some "a") ["@progbits"]
+ | _ -> D.section [".rodata.cst16"] (Some "aM") ["@progbits";"16"]
@@ -1053,2 +1053,3 @@
- | _ -> D.section [".rodata.cst8"] (Some "a") ["@progbits"]
+ | _ -> D.section [".rodata.cst8"] (Some "aM") ["@progbits";"8"]
end;
+ D.align 8;
--- asmrun/amd64.S
+++ asmrun/amd64.S
@@ -728,1 +728,1 @@
- .section .rodata.cst8,"a",@progbits
+ .section .rodata.cst16,"aM",@progbits,16
EOF
echo -e "\033[0m"
## config.guess uses uname to identify the system so incorrectly identifies
## a 32 bit system using a 64 bit kernel as 64 bit
## Could use --build=, but this way configure gets to choose the triple
[[ $(getconf LONG_BIT) == 32 && $(uname -m) == *64 ]] && \
sed -i 's|^UNAME_MACHINE=.*$|UNAME_MACHINE=i586|' config/gnu/config.guess
## force "gcc -fcommon" for gcc10 build - see https://github.com/ocaml/ocaml/issues/9622
./configure -cc "$COMPILER -fcommon" -libdir /usr/local/lib$LIBDIRSUFFIX/ocaml
## finish build with -j1 if there are race condition errors
make ${NUMJOBS:-} world.opt || make world.opt
DESTDIR=$TMP_BUILD/package-ocaml make install
cd $TMP_BUILD/package-ocaml
makepkg -l y -c n $OUTPUT/ocaml-4.05.0-$ARCH-$BUILD.txz
installpkg $OUTPUT/ocaml-4.05.0-$ARCH-$BUILD.txz
## facile:
echo -e "\n building facile \n"
cd /$TMP_BUILD
rm -rf *facile*
tar xf $BUILD_TDE_ROOT/src/facile-1.1.3.tar.gz
cd facile-1.1.3/
sed -i 's|mkdir|& -p|' Makefile
## uses ocaml compiler
./configure
make
make FACILEDIR=$TMP_BUILD/package-facile/usr/local/lib$LIBDIRSUFFIX/ocaml/facile install
cd $TMP_BUILD/package-facile
makepkg -l y -c n $OUTPUT/facile-1.1.3-$ARCH-$BUILD.txz
installpkg $OUTPUT/facile-1.1.3-$ARCH-$BUILD.txz
)
echo -e "\n now building tdeedu \n"
ocaml_installed_fn || { echo -e " installation of ocaml/facile failed \n" ; exit 1 ; }
}
} && \
OCAML="ON"
# ### Kalzium Chemical Equation Solver - end
}
source ../../get-source.sh
getsource_fn
untar_fn
## patch for kig python scripting error:
## kig: /usr/include/boost/python/object_core.hpp:422: boost::python::api::object_base::~object_base(): Assertion `Py_REFCNT(m_ptr) > 0' failed.
## Re: https://bugs.kde.org/show_bug.cgi?id=401512#c5
sed -i 's| PyTuple_SetItem| Py_XINCREF((objectvect.begin() +i)->ptr());\n&|' kig/scripting/python_scripter.cpp
## add some files to html docs
sed -i 's|*.png|& *.svgz README|' cmake/modules/TDEMacros.cmake
## User set paper size or as per locale ..
[[ ! ${PS:-} ]] && {
[[ $(locale LC_PAPER) == 297* ]] && PS=a4 || PS=letter
}
sed -i "s|^PAPER_TYPE.*$|PAPER_TYPE = $PS|" doc/kig/scripting-api/Doxyfile.scripting-api.in
sed -i "s|^PAPER_TYPE.*$|PAPER_TYPE = $PS|" admin/Doxyfile.global
listdocs_fn
chown_fn
cd_builddir_fn
## kig python scripting support
[[ $(ls -1 /usr/lib$LIBDIRSUFFIX/libboost_python*.so) ]] && KIG_PS="ON"
cmake ${G_NINJA:-} -C $TMPVARS/CMAKE_CACHE ${CMAKE_OPTS:-} \
-DWITH_ARTS="ON" \
-DWITH_KIG_PYTHON_SCRIPTING=${KIG_PS:-"OFF"} \
-DWITH_LIBUSB="ON" \
-DWITH_OCAML_SOLVER=${OCAML:-"OFF"} \
-DWITH_V4L="ON" \
-DBUILD_BLINKEN="ON" \
-DBUILD_KALZIUM="ON" \
-DBUILD_KANAGRAM="ON" \
-DBUILD_KBRUCH="ON" \
-DBUILD_KEDUCA="ON" \
-DBUILD_KGEOGRAPHY="ON" \
-DBUILD_KHANGMAN="ON" \
-DBUILD_KIG="ON" \
-DBUILD_KITEN="ON" \
-DBUILD_KLATIN="ON" \
-DBUILD_KLETTRES="ON" \
-DBUILD_KMPLOT="ON" \
-DBUILD_KPERCENTAGE="ON" \
-DBUILD_KSTARS="ON" \
-DBUILD_KTOUCH="ON" \
-DBUILD_KTURTLE="ON" \
-DBUILD_KVERBOS="ON" \
-DBUILD_KVOCTRAIN="ON" \
-DBUILD_KWORDQUIZ="ON"
## remove obsolete tags
doxygen -u doc/kig/scripting-api/Doxyfile.scripting-api
make_fn
installdocs_fn
strip_fn
mkdir_install_fn
doinst_sh_fn
echo "
# HOW TO EDIT THIS FILE:
# The 'handy ruler' below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: tdeedu (TDE educational software)
$PRGNAM:
$PRGNAM: * blinken: the KDE version of the well-known game Simon Says
$PRGNAM: * kalzium: periodic table of elements
$PRGNAM: * kanagram: an anagram game
$PRGNAM: * kbruch: fraction excercise trainer
$PRGNAM: * keduca: creation and revision of form-based tests and exams.
$PRGNAM: * kgeography: geography learning program
$PRGNAM: * khangman: hangman game.
$PRGNAM: * kig: interactive geometry
$PRGNAM: * kiten: japanese reference tool
$PRGNAM: * klatin: aims to help revise or learn Latin
$PRGNAM: * klettres: helps to learn the alphabet and to read some syllables
$PRGNAM: * kmplot: mathematical function plotter
$PRGNAM: * kpercentage: improve skills in calculating percentages
$PRGNAM: * kstars: desktop planetarium
$PRGNAM: * ktouch: program for learning touch typing
$PRGNAM: * kturtle: programming environment using the Logo programming language
$PRGNAM: * kverbos: study Spanish verb forms
$PRGNAM: * kvoctrain: vocabulary trainer
$PRGNAM: * kwordquiz: a powerful way to master new vocabularies
" > $PKG/install/slack-desc
makepkg_fn