[singular] 07/14: Use spkg-install script from Sage for build.

Tobias Hansen thansen at moszumanska.debian.org
Fri Jul 8 00:45:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master3-sage
in repository singular.

commit 32567856a9cb093010804a211ac1d35a1d43fc46
Author: Tobias Hansen <thansen at debian.org>
Date:   Thu Jul 7 21:47:53 2016 +0000

    Use spkg-install script from Sage for build.
---
 debian/rules        | 276 ++------------------------------------------
 debian/spkg-install | 326 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 336 insertions(+), 266 deletions(-)

diff --git a/debian/rules b/debian/rules
index 88cae38..a0de8df 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,276 +1,20 @@
 #!/usr/bin/make -f
 
-# DH_VERBOSE=1
-
-# soname-suffix of the library and part of directory name.
-# make sure to change the libsingular-* package name when changing this:
-VERSION=3-1-6
-
 CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
 CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
 CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
 LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)
 
-DOC_TRUE=
-DOC_FALSE=
-ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
-	DOC_TRUE=\#
-else
-	ENABLE_DOC=--enable-doc
-	DOCDIR=doc
-	DOC_FALSE=\#
-endif
-
-WITH_PYTHON = --with-python
-
-CFLAGS += -Wall
-CXXFLAGS += -Wall
-
-DEB_CONFIGURE_EXTRA_FLAGS += --prefix=$(CURDIR)/debian/tmp \
-                             --exec-prefix=$(CURDIR)/debian/tmp \
-                             --bindir=$(CURDIR)/debian/tmp/bin \
-                             --libdir=$(CURDIR)/debian/tmp/lib \
-                             --with-apint=gmp \
-                             --with-factory=$(CURDIR)/factory \
-                             --with-gmp=/usr/lib \
-                             --with-libfac=$(CURDIR)/libfac \
-                             --with-malloc=system \
-                             --with-NTL \
-                             $(WITH_PYTHON) \
-                             --without-bison \
-                             --without-Boost \
-                             --without-flint \
-                             --without-lex \
-                             --without-MP \
-                             $(ENABLE_DOC) \
-                             --enable-factory \
-                             --enable-gmp=/usr/lib \
-                             --enable-IntegerProgramming \
-                             --enable-libfac \
-                             --enable-Singular
-
-# BUG (see singular/spkg-install)
-# singular apparently doesnt work without debug
-DEB_CONFIGURE_EXTRA_FLAGS += --with-debug
-
-clean:
-	if [ -f doc/Makefile ] ; then $(MAKE) -C doc clean ; fi
-	if [ -f Makefile ] ; then $(MAKE) distclean ; fi
-	rm -f *-stamp
-	dh_clean
-	rm -f VERSION
-
-	find Singular -name "p_*.so" -delete
-	find doc \( -name "T*.txt" -o -name "*.dot" -o -name "*.ssi" \
-		-o -name "temp_*" -o -name "exmpl.tex" \
-		-o -name "*.jpg" -o -name "*.gif" -o -name "*.xbm" \
-		-o -name "QEPCAD*" -o -name "qepcadfilter.pl" \
-		-o -name "s-plulibs.tex" \) -delete
-	#sanity checks
-	find . \( -name "*.o" -o -name "*.dl_o" -o -name "*.og" \
-		  -o -name "*.so" -o -name "*.sog" -o -name "*.a" \
-		  -o -name "*.o_ndebug" -o -name "*.sog" -o -name "*.op" \) \
-		-printf 'clean failed: %p\n' -delete
-	# remove some leftovers:
-	rm -f Singular/libparse.cc.lmp doc/uname.texi doc/version.texi kernel/prCopy.inc
-	find . \( -name "config.guess" -o -name "config.sub" \
-		  -o -name "config.log" -o -name "config.status" \
-		  -o -name "stamp-h" -o -name "config.h" \
-		  -o -name "Makefile" -a -not -wholename "./calldummy/Makefile" \) \
-		-delete
-	rm -f factory/gen_cf_gmp.sh
-	rm -f libfac/factor/version.h
-	rm -f Singular/conftest.s1
-	rm -f Singular/conftest.subs
-	rm -f Singular/mpsr_Tok.xx
-	rm -f ntl/src/cfileout
-	rm -f ntl/src/makefile
-	rm -f ntl/src/mfileout
-	rm -f emacs/lib-temp
-
-binary: binary-arch binary-indep
-binary-indep:
-build-indep:
-
-binary-arch: install
-	dh_testdir
-	dh_testroot
-	dh_installdirs
-	dh_install
-	rm debian/libsingular-$(VERSION)/usr/lib/singular-$(VERSION)/*Singular*
-	ln -sf ../lib/singular-$(VERSION)/Singular debian/singular/usr/bin/
-	ln -sf ../lib/singular-$(VERSION)/TSingular debian/singular/usr/bin/
-	ln -sf ../lib/singular-$(VERSION)/ESingular debian/singular/usr/bin/
-	for dir in info html $(DOCDIR) examples emacs ; do \
-		mkdir -p debian/libsingular-$(VERSION)/usr/share/singular-$(VERSION)/$$dir ; \
-		ln -sf /usr/share/singular-$(VERSION)/$$dir \
-			debian/libsingular-$(VERSION)/usr/lib/singular-$(VERSION)/$$dir ; \
-	done
-	dh_installchangelogs
-	dh_installexamples
-	dh_installdocs
-	dh_installman
-	dh_installmenu
-	dh_link
-	dh_strip
-	# add a hardlink to place found by ld.so:
-	ln debian/libsingular-$(VERSION)/usr/lib/singular-$(VERSION)/libsingular.so \
-		debian/libsingular-$(VERSION)/usr/lib/libsingular-$(VERSION).so
-	# development symlink
-	ln -sf libsingular-$(VERSION).so debian/libsingular-dev/usr/lib/libsingular.so
-	dh_makeshlibs
-	dh_shlibdeps
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-ENABLE_DEBUGOUTPUT=--disable-debugoutput
-WITH_DEBUG=--without-debug
-
-configure-stamp:
-	cp -f /usr/share/misc/config.guess config.guess
-	cp -f /usr/share/misc/config.sub config.sub
-	export CFLAGS="$(CFLAGS) -fPIC" \
-	CXXFLAGS="$(CXXFLAGS) -fPIC" \
-	CPPFLAGS="$(CPPFLAGS) -DMAKE_DISTRIBUTION -I../omalloc -I$(CURDIR)/factory" \
-	LDFLAGS="$(LDFLAGS) -L$(CURDIR)/factory -L$(CURDIR)/libfac -L$(CURDIR)/omalloc"; \
-	./configure $(DEB_CONFIGURE_EXTRA_FLAGS); \
-	cd factory; ./configure \
-	            --prefix=/usr \
-	            --includedir=/usr/include/factory \
-	            --with-Singular=yes \
-	            --with-NTL=/usr \
-	            --without-flint \
-	            --with-gmp=/usr \
-	            --exec-prefix=/usr \
-	            --bindir=/usr/bin \
-	            --libdir=/usr/lib \
-	            --enable-gmp \
-	            --enable-NTL \
-	            $(ENABLE_DEBUGOUTPUT); \
-	cd $(CURDIR)/libfac; ./configure \
-	            --prefix=/usr \
-	            --exec-prefix=/usr \
-	            --bindir=/usr/bin \
-	            --libdir=/usr/lib \
-	            $(WITH_DEBUG)
-
-	# don't look in system directories first:
-	sed -e 's#-I/usr/lib/singular-[0-9.-]*\>#-I'"$(CURDIR)"'#g' \
-	    -e 's#-I/usr/\(local/\)\?include\( \|$$\)##g' \
-	    -e 's#-I$${prefix}\( \|$$\)#-I'"$(CURDIR)"' #g' \
-	    -e 's#-L/usr/local/lib\( \|$$\)##g' \
-	    -e 's#-L/usr/lib\( \|$$\)##g' \
-	    -e 's#-L$${libdir}\( \|$$\)##g' \
-	    -i Makefile omalloc/Makefile kernel/Makefile Singular/Makefile \
-	       libfac/Makefile factory/GNUmakefile IntegerProgramming/Makefile
-	sed -e 's#-I$$(includedir) ##' -i factory/GNUmakefile
-	# ncurses or termcap is only needed for the internal readline not available with glibc:
-	sed	-e 's# *-lncurses##' -e 's# *-ltermcap##' \
-		-i Singular/Makefile
-	# only called by the library, no need to link binaries against
-	sed	-e '/^LIBS\>/s# *-lnsl##' \
-		-e '/^LIBS\>/s# *-ldl##' \
-		-i Singular/Makefile
-	# disable building some things twice:
-	sed -e '/^all:/s# *libsingfac_g.a##' -i libfac/Makefile
-	sed -e '/^cf:/s# *libsingcf_g.a##' -i factory/GNUmakefile
-	sed -e '/^\(all\|installbin\):/s# *libkernel_g.a##' -i kernel/Makefile
-	sed -e 's#SINGULAR *=.*$$#SINGULAR=../Singular/Singular#' -i doc/Makefile
-	sed -e 's#LIBPARSE *=.*$$#LIBPARSE=../Singular/libparse#' -i doc/Makefile
-	sed -e 's#^Makefile:#Makefile.orig:#' -i doc/Makefile
-	touch $@
-
-build build-arch: build-stamp
-
-EXAMPLE_EXCLUDE=-exclude MP -exclude gfan -exclude normaliz -exclude sing4ti2 -exclude memory -exclude dynlib
-PYTHON_INCLUDE=-I/usr/include/python2.7
-
-build-stamp: configure-stamp
-	$(MAKE) LD='$(CXX) $(CXXFLAGS) -fPIC $(LDFLAGS)' \
-	           LIBSINGULAR_FLAGS='-shared -Wl,-soname,libsingular-$(VERSION).so $(CXXFLAGS) -fPIC $(LDFLAGS) -L../omalloc' \
-	           LD_DYN_FLAGS2='' DL_LIBSG='' GLIBC_DYN_FIX="-lc"
-	# the above command failed to build libsingular.so. let's try again
-	$(MAKE) -C Singular LD='$(CXX) $(CXXFLAGS) -fPIC $(LDFLAGS)' \
-	           LIBSINGULAR_FLAGS='-shared -Wl,-soname,libsingular-$(VERSION).so $(CXXFLAGS) -fPIC $(LDFLAGS) -L../omalloc' \
-	           LD_DYN_FLAGS2='' DL_LIBSG='' GLIBC_DYN_FIX="-lc" libsingular.so
-	# libparse is needed for doc-building ESingular and TSingular not built by "all".
-	# and the makefile here uses the wrong flags (only CPPFLAGS, not CXXFLAGS)
-	$(MAKE) -C Singular CPPFLAGS='-I. -I.. $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PYTHON_INCLUDE)' libparse ESingular TSingular Singular
-	touch $@
-
-emacs-stamp: doc-stamp
-	cd Singular && ln -sf ../kernel/p_*.so .
-	mkdir -p debian/lddir && ln -sf ../../Singular/libsingular.so debian/lddir/libsingular-$(VERSION).so
-	SINGULAR_BIN_DIR=$(CURDIR)/Singular \
-	 LD_LIBRARY_PATH='$(CURDIR)/debian/lddir'"$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}}" \
-	 $(MAKE) \
-		prefix="$(CURDIR)" \
-		examplesdir="$(CURDIR)/doc/examples" \
-		SINGULAR='$(CURDIR)/Singular/Singular' \
-		-C emacs \
-		all
-	rm -r debian/lddir
-	touch $@
+SAGE_LOCAL := `pwd`/debian/tmp
+MAKE := make -j5
+CP := cp
+CXX := c++
 
-doc-stamp: build-stamp
-	[ -x Singular/libparse ]
-	touch Singular/libparse
-	mkdir -p debian/doclddir && ln -sf ../../Singular/libsingular.so debian/doclddir/libsingular-$(VERSION).so
-	$(DOC_TRUE)cd Singular && ln -sf ../kernel/p_*.so .
-	$(DOC_TRUE)cd debian/doclddir; ln -sf ../../kernel/p_*.so .
-	$(DOC_TRUE)export SINGULAR_BIN_DIR=$(CURDIR)/Singular \
-	$(DOC_TRUE)       SINGULAR_ROOT_DIR=$(CURDIR)/Singular \
-	$(DOC_TRUE)       LD_LIBRARY_PATH='$(CURDIR)/debian/doclddir'"$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}}" \
-	$(DOC_TRUE)       PATH="$(CURDIR)/Singular:$(CURDIR)/kernel:$(CURDIR)/IntegerProgramming:$$PATH" \
-	$(DOC_TRUE)       PBORI_NOSAGE=YES; \
-	$(DOC_TRUE)$(MAKE) \
-	$(DOC_TRUE)	DOC2TEX_EXAMPLE_EXCLUSIONS="$(EXAMPLE_EXCLUDE)" \
-	$(DOC_TRUE)	bindir="$(CURDIR)/Singular" \
-	$(DOC_TRUE)	SINGULAR='$(CURDIR)/Singular/Singular' \
-	$(DOC_TRUE)	-C doc \
-	$(DOC_TRUE)	standalone-txt standalone-html html singular.idx singular.hlp
-	$(DOC_TRUE)rm -r debian/doclddir
-	$(DOC_FALSE)touch doc/singular.hlp
-	$(DOC_FALSE)-mkdir doc/examples
-	touch $@
+%:
+	dh $@ --parallel
 
-install: build-stamp doc-stamp emacs-stamp
-	dh_testdir
-	dh_testroot
-	dh_prep
-	$(MAKE) DL_LIBSG='' install-libsingular
-	$(MAKE) -C Singular DL_LIBSG='' install
-	$(DOC_TRUE)$(MAKE) -C doc \
-	$(DOC_TRUE)	bindir="$(CURDIR)/Singular" \
-	$(DOC_TRUE)	SINGULAR='$(CURDIR)/Singular/Singular' \
-	$(DOC_TRUE)	install_prefix=$(CURDIR)/debian/tmp/usr/share/singular-$(VERSION) \
-	$(DOC_TRUE)	install-sharedist
-	$(DOC_FALSE)mkdir -p $(CURDIR)/debian/tmp/usr/share/singular-$(VERSION)/info
-	$(DOC_FALSE)mkdir -p $(CURDIR)/debian/tmp/usr/share/singular-$(VERSION)/examples
-	$(DOC_FALSE)mkdir -p $(CURDIR)/debian/tmp/usr/share/singular-$(VERSION)/html
-	$(DOC_FALSE)mkdir -p $(CURDIR)/debian/tmp/usr/share/singular-$(VERSION)/doc
-	$(DOC_FALSE)mkdir -p $(CURDIR)/debian/tmp/usr/share/singular-$(VERSION)/emacs
-	$(DOC_TRUE)$(MAKE) -C emacs \
-	$(DOC_TRUE)	prefix="$(CURDIR)" \
-	$(DOC_TRUE)	examplesdir="$(CURDIR)/doc/examples" \
-	$(DOC_TRUE)	SINGULAR='$(CURDIR)/Singular/Singular' \
-	$(DOC_TRUE)	install_prefix=$(CURDIR)/debian/tmp/usr/share/singular-$(VERSION) \
-	$(DOC_TRUE)	install-sharedist
-	# surfex is not included due to missing sources, so do not install wrappers, either:
-	rm -f debian/tmp/usr/lib/singular-$(VERSION)/LIB/surfex.lib
-	rm -f debian/tmp/usr/lib/singular-$(VERSION)/surfex
-	# move as installed to libdir but searched in bindir:
-	install debian/tmp/usr/lib/dbmsr.so debian/tmp/usr/lib/singular-$(VERSION)/
-	# get rid of AIX specific headers
-	rm -f debian/tmp/usr/include/*limits.h
-	#don't use them
-	sed -e 's#mylimits\.h#limits.h#' -i debian/tmp/usr/include/singular/*.h
-	# remove executeable bits from .gif files:
-	find debian/tmp -name "*.gif" -exec chmod a-x {} \;
-	dh_lintian
+override_dh_auto_configure:
+override_dh_install:
+override_dh_auto_build:
+	debian/spkg-install
 
-.PHONY: build-arch build-indep build install binary-arch binary-indep binary clean
diff --git a/debian/spkg-install b/debian/spkg-install
new file mode 100755
index 0000000..05183ce
--- /dev/null
+++ b/debian/spkg-install
@@ -0,0 +1,326 @@
+#!/usr/bin/env bash
+
+###########################################
+## Singular
+###########################################
+
+SRC=`pwd`
+SHARED=`pwd`/src/shared
+PATCHES=`pwd`/patches
+
+if [ "$SAGE_LOCAL" = "" ]; then
+    echo >&2 "SAGE_LOCAL undefined ... exiting";
+    echo >&2 "Maybe run 'sage -sh'?"
+    exit 1
+fi
+
+# disable the dynamic kernel, except on Linux
+if [ "$UNAME" != "Linux" ]; then
+    SINGULAR_CONFIGURE="--without-dynamic-kernel $SINGULAR_CONFIGURE"
+fi
+
+if [ "$UNAME" = "Darwin" ]; then
+    # Singular needs $LD set to "libtool", not "ld" on Darwin.
+    # If we unset it, Singular will figure it out correctly.
+    unset LD
+fi
+
+# On SPARC, we need 8-byte alignment for 64-bit integers
+if uname -p | grep sparc >/dev/null; then
+    SINGULAR_CONFIGURE="--with-align=8 $SINGULAR_CONFIGURE"
+fi
+
+
+if [ "x$SAGE_DEBUG" = "xyes" ]; then
+    WITH_DEBUG="--with-debug"
+    ENABLE_DEBUGOUTPUT="--enable-debugoutput"
+
+    CFLAGS="-O0 -g $CFLAGS"
+    CXXFLAGS="-O0 -g $CXXFLAGS"
+else
+    WITH_DEBUG="--without-debug"
+    ENABLE_DEBUGOUTPUT="--disable-debugoutput"
+
+    # By default, parts of Singular are compiled with -O2 and parts
+    # with -O3.  If we do set any CFLAGS, this always overrides the
+    # default CFLAGS set by upstream.  In order to be compatible, we
+    # set the optimization to -O2.
+    # Increasing the optimization level to -O3 has caused various
+    # problems in the past either with specific compilers or on specific
+    # platforms.
+    OPTIMIZATION_FLAGS="-O2"
+
+    CFLAGS="$OPTIMIZATION_FLAGS -g $CFLAGS"
+    CXXFLAGS="$OPTIMIZATION_FLAGS -g $CXXFLAGS"
+fi
+
+if [ "x$SAGE64" = xyes ]; then
+    echo "Building a 64-bit version of Singular"
+    CFLAGS="$CFLAGS -m64 "
+    CXXFLAGS="$CXXFLAGS -m64"
+    CPPFLAGS="$CPPFLAGS -m64"
+    LDFLAGS="$LDFLAGS -m64 "; export LDFLAGS
+    if [ "x`uname`" = xSunOS ] ; then
+        export CC="$CC -m64"
+        export CXX="$CXX -m64"
+    fi
+fi
+
+export CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"
+
+# we are building everything fPIC, this might impose a slight
+# performance hit, need to evaluate:
+export CXXFLAGS="$CXXFLAGS -fPIC"
+export CFLAGS="$CFLAGS -fPIC"
+
+# Singular does not respect LDFLAGS; Ugly hack:
+# Used on Linux and Darwin (see singular-3.1.7-use_cxx_for_linking.patch)
+export CXX="$CXX $LDFLAGS"
+
+# The Sun assembler has problems with -pipe, so disable it.
+# This only affects compile time, not the compiled programs/libraries.
+if [ "$UNAME" = "SunOS" ]; then
+    MAKE="$MAKE PIPE="
+fi
+
+
+# There is a race condition in the Singular Makefiles, building in
+# parallel sometimes fails (Trac #17774)
+export MAKE="$MAKE -j1"
+
+
+choose_patches()
+{
+    cd "$PATCHES" || return $?
+
+    if [ "x$SAGE_DEBUG" = "xyes" ]; then
+        mv conditional/sage_debug.patch . || return $?
+        # Remove old omalloc files, except for configure
+        mv "$SRC/omalloc/configure" configure_omalloc
+        rm -r "$SRC/omalloc"/*
+        mv configure_omalloc "$SRC/omalloc/configure"
+        mv conditional/singular_xalloc.patch . || return $?
+        mv conditional/cygwin64_debug.patch ./cygwin64.patch || return $?
+    fi
+}
+
+apply_patches()
+{
+    # Apply all patches
+    for patch in "$PATCHES"/*.patch; do
+        [ -r "$patch" ] || continue  # Skip non-existing or non-readable patches
+        echo "Applying $patch"
+        patch -p1 <"$patch"
+        if [ $? -ne 0 ]; then
+            echo >&2 "Error applying '$patch'"
+            return 1
+        fi
+    done
+}
+
+remove_old_version()
+{
+    rm -f "$SAGE_LOCAL"/bin/Singular*
+    rm -f "$SAGE_LOCAL/include/factory.h"
+    rm -f "$SAGE_LOCAL/include/factoryconf.h"
+    rm -rf "$SAGE_LOCAL/include/singular"
+}
+
+config()
+{
+    # configure notes:
+    # 1) We really need to add --exec-prefix and --bindir as Singular
+    #    uses some wierd defaults.
+    # 2) configure calls other configure scripts (for example
+    #    omalloc/configure).  Not all of these configure scripts
+    #    support all options given here, leading to warnings which
+    #    may be ignored.
+    # 3) --without-debug doesn't work:
+    #    http://www.singular.uni-kl.de:8002/trac/ticket/438
+    #    Replace --with-debug by $WITH_DEBUG if this is fixed.
+    ./configure --prefix="$SAGE_LOCAL" \
+                --exec-prefix="$SAGE_LOCAL" \
+                --bindir="$SAGE_LOCAL"/bin \
+                --libdir="$SAGE_LOCAL"/lib \
+                --with-apint=gmp \
+                --with-malloc=system \
+                --with-NTL \
+                --with-flint="$SAGE_LOCAL" \
+                --without-MP \
+                --without-lex \
+                --without-Boost \
+                --enable-Singular \
+                --enable-factory \
+                --enable-libfac \
+                --enable-IntegerProgramming \
+                --disable-doc \
+                $SINGULAR_CONFIGURE \
+                --with-debug
+
+    if [ $? -ne 0 ]; then
+        echo >&2 "Unable to configure Singular."
+        return 1
+    fi
+}
+
+
+build_singular()
+{
+    # Singular doesn't have separate build and install steps. So we
+    # directly need to install. The "-nolns" means that we will really
+    # copy files, not symlink them (for some crazy reason, Singular's
+    # default is the create symlinks when installing).
+    $MAKE install-nolns
+    if [ $? -ne 0 ]; then
+        echo >&2 "Unable to build and install Singular"
+        return 1
+    fi
+
+}
+
+
+create_singular_script()
+{
+    cd "$SAGE_LOCAL/bin" || return $?
+
+    # The Singular build annoyingly puts an absolute symlink to the
+    # Singular executable in $SAGE_LOCAL/bin/.  So we delete it and
+    # replace it by a relative symlink.
+    rm -f Singular singular
+
+    singular_executable=`ls Singular-* | tail -1`
+    if [ -z "$singular_executable" ]; then
+        echo >&2 "The Singular executable was not installed in $SAGE_LOCAL/bin/ as it should have been."
+        return 1
+    fi
+
+    ln -s "$singular_executable" Singular || return $?
+
+    # Lower case version is convenient (this can fail on
+    # case-insensitive systems, we ignore the error).
+    ln -s "$singular_executable" singular 2>/dev/null
+
+    return 0
+}
+
+build_libsingular()
+{
+    # we really need DLIBSINGULAR, so we have to rebuild
+    OLD_CFLAGS=$CFLAGS
+    export CFLAGS="$CFLAGS -DLIBSINGULAR"
+    OLD_CXXFLAGS=$CXXFLAGS
+    export CXXFLAGS="$CXXFLAGS -DLIBSINGULAR"
+
+    if [ "$UNAME" = "Darwin" ]; then
+        # on darwin we need to adjust the install name of the library
+	export LIBSINGULAR_LDFLAGS="-install_name ${SAGE_LOCAL}/lib/libsingular.dylib"
+    fi
+
+    config || return $?
+
+    $MAKE clean
+    $MAKE install-libsingular
+
+    if [ $? -ne 0 ]; then
+        echo >&2 "Unable to build and install libsingular."
+        return 1
+    fi
+
+    # singular does not install this header
+    cp Singular/sing_dbm.h $SAGE_LOCAL/include/singular/
+
+    export CFLAGS="$OLD_CFLAGS"
+    export CXXFLAGS="$OLD_CXXFLAGS"
+}
+
+build_factory()
+{
+    cd factory || return $?
+
+    $MAKE distclean
+
+    ./configure --prefix="$SAGE_LOCAL" \
+                --includedir="$SAGE_LOCAL/include/factory" \
+                --exec-prefix="$SAGE_LOCAL" \
+                --bindir="$SAGE_LOCAL"/bin \
+                --libdir="$SAGE_LOCAL"/lib \
+                --enable-gmp \
+                --with-gmp="$SAGE_LOCAL" \
+                --enable-NTL \
+                --with-NTL="$SAGE_LOCAL" \
+                --with-flint="$SAGE_LOCAL" \
+                --with-gmp="$SAGE_LOCAL" \
+                $ENABLE_DEBUGOUTPUT
+
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error configuring the standalone factory."
+        return 1
+    fi
+
+    $MAKE all
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error building the standalone factory."
+        return 1
+    fi
+
+    $MAKE install
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error installing the standalone factory."
+        return 1
+    fi
+
+    $CP -p factoryconf.h "$SAGE_LOCAL"/include/
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error copying factory/factoryconf.h to include directory."
+        return 1
+    fi
+}
+
+build_libfac()
+{
+    cd libfac || return $?
+
+    $MAKE distclean
+
+    ./configure --prefix="$SAGE_LOCAL" \
+                --exec-prefix="$SAGE_LOCAL" \
+                --bindir="$SAGE_LOCAL"/bin \
+                --libdir="$SAGE_LOCAL"/lib \
+                $WITH_DEBUG
+
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error configuring libfac."
+        return 1
+    fi
+
+    $MAKE all
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error building libfac."
+        return 1
+    fi
+
+    $MAKE install
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error installing libfac."
+        return 1
+    fi
+}
+
+install_docs()
+{
+    cd "$SHARED" || return $?
+    cp -p singular.hlp singular.idx "$SAGE_LOCAL/share/singular/"
+}
+
+
+# Actually run all the functions defined above
+for i in config \
+  build_singular build_libsingular build_factory build_libfac \
+  create_singular_script; do
+    echo "### Singular spkg-install: $i ###"
+    cd "$SRC" && $i
+    if [ $? -ne 0 ]; then
+        echo >&2 "Error building Singular (error in $i)."
+        exit 1
+    fi
+done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/singular.git



More information about the debian-science-commits mailing list