Unbreak and make packageable.

This commit is contained in:
Thierry Thomas 2014-05-26 19:20:41 +00:00
parent 1c4d588772
commit 1c3ad3bd76
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355433
4 changed files with 119 additions and 24 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= aster
DISTVERSION= ${ASTER_DISTVERSION}
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= french cad
MAINTAINER= thierry@FreeBSD.org
@ -43,7 +43,6 @@ RUN_DEPENDS+= ${PYTHON_SITELIBDIR}/Gnuplot:${PORTSDIR}/math/py-gnuplot \
${SHELL_INSTALL_ASTER}:${PORTSDIR}/shells/${SHIADEP} \
${LOCALBASE}/aster/ASTK/ASTK_SERV:${PORTSDIR}/cad/astk-serveur
BROKEN= WIP - it builds and runs, but yet some rough edges
USES= bison fortran tk
USE_PYTHON= 2 # >2.5 and <3.0
HAS_CONFIGURE= yes
@ -67,10 +66,6 @@ INTERACTIVE_SCRIPTS= check_compilers.py setup.py
.include "${.CURDIR}/../../french/aster/bsd.aster.mk"
.include <bsd.port.pre.mk>
.if !exists(/compat/linux/proc/)
IGNORE= /compat/linux/proc/ must be mounted to build elements # Fixme
.endif
.if ${ARCH} == "i386"
FLAGARCH= -DP_LINUX -DLINUX
.else
@ -223,6 +218,7 @@ pre-configure:
${WRKSRC}/products.py
${REINPLACE_CMD} -e "s|'gfortran'|'${FC}'|g;s|'gcc'|'${CC}'|g" \
-e "s|'g++'|'${CXX}'|g" ${WRKSRC}/check_compilers.py
${REINPLACE_CMD} -e 's|%%FILESDIR%%|${FILESDIR}|' ${WRKSRC}/as_setup.py
.for sh in ${BASH2RC}
${REINPLACE_CMD} -e 's|/bin/bash|${SHELL_INSTALL_ASTER}|' ${WRKSRC}/${sh}
.endfor
@ -256,7 +252,7 @@ pre-configure:
${ECHO_CMD} "OPT_ENV = 'verbose=True'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "HOME_SCOTCH = '${LOCALBASE}'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "HOME_METIS = '${LOCALBASE}'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "INCLUDEDIR = ['${LOCALBASE}/include/metis', ]" \
${ECHO_CMD} "INCLUDEDIR = ['${LOCALBASE}/include', '${LOCALBASE}/include/metis', ]"\
>> ${WRKSRC}/setup.cfg
${ECHO_CMD} "HOME_MUMPS = '${LOCALBASE}'" >> ${WRKSRC}/setup.cfg
.if ${MUMPS_PORT} == "mumps-mpich"
@ -267,7 +263,8 @@ pre-configure:
${ECHO_CMD} "CXX='${CXX}'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "LD='${FC}'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "F90='${FC}'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "MATHLIB='${lib_math} ${LDFLAGS} -lgfortran -lm'" >> ${WRKSRC}/setup.cfg
${ECHO_CMD} "MATHLIB='${lib_math} ${LDFLAGS} -lgfortran -lm -lkvm'" \
>> ${WRKSRC}/setup.cfg
${ECHO_CMD} "OTHERLIB='-Xlinker -export-dynamic -lutil ${PTHREAD_LIBS} -lz'" \
>> ${WRKSRC}/setup.cfg
${ECHO_CMD} "SYSLIB='${PTHREAD_LIBS} -lz'" >> ${WRKSRC}/setup.cfg
@ -369,6 +366,8 @@ post-install:
-d ${PREFIX} -f ${inst_dir:S|${PREFIX}/||})
(cd ${STAGEDIR}${PREFIX} && ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \
-d ${PREFIX} -f ${inst_dir:S|${PREFIX}/||})
${CP} -p ${STAGEDIR}${inst_dir}/${VE}/bin/aster \
${STAGEDIR}${inst_dir}/${VE}/bin/asterd
${STRIP_CMD} ${STAGEDIR}${inst_dir}/${VE}/bin/aster
${SED} -e 's|%%VER%%|${VE}|' < ${FILESDIR}/astout.export \
> ${STAGEDIR}${inst_dir}/${VE}/astout.export
@ -378,6 +377,9 @@ post-install:
${LN} -fs ${LOCALBASE}/bin/${outil} ${STAGEDIR}${tools_dir}/${outil}
.endfor
.if !defined(WITHOUT_ASTK_CLI)
${MKDIR} ${STAGEDIR}${PREFIX}/aster/ASTK/ASTK_SERV/etc/codeaster/astkrc
${LN} -fs ${ASTKDIR}/etc/astkrc/* \
${STAGEDIR}${PREFIX}/aster/ASTK/ASTK_SERV/etc/codeaster/astkrc
. for outil in astk bsf
${LN} -fs ${ASTKDIR}/bin/${outil} ${STAGEDIR}${tools_dir}/${outil}
. endfor

View File

@ -0,0 +1,79 @@
--- bibc/utilitai/mempid.c.orig 2013-12-16 09:25:29.000000000 +0100
+++ bibc/utilitai/mempid.c 2014-05-20 22:28:25.000000000 +0200
@@ -19,7 +19,14 @@
#include "aster.h"
#ifdef _POSIX
-#include <fcntl.h>
+# ifdef __FreeBSD__
+# include <kvm.h>
+# include <sys/param.h>
+# include <sys/sysctl.h>
+# include <sys/user.h>
+# include <err.h>
+# endif
+# include <fcntl.h>
#endif
/*
@@ -40,9 +47,48 @@
pid_t numpro;
#ifdef _POSIX
pid_t getpid(void);
-
+
numpro = getpid();
+# ifdef __FreeBSD__
+/*
+** FreeBSD and some others without /proc ?
+*/
+
+
+#define B2K(x) ((x) >> 10) /* bytes to kbytes */
+#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */
+
+ char errbuf[_POSIX2_LINE_MAX];
+ struct kinfo_proc *kp;
+ kvm_t *kd;
+ int count;
+ kd = kvm_openfiles(NULL, "/dev/null", NULL, O_RDONLY, errbuf);
+ if (kd == NULL)
+ errx(1, "kvm_openfiles: %s", errbuf);
+
+ kp = kvm_getprocs(kd, KERN_PROC_PID, numpro, &count);
+ if (kp == NULL) {
+ (void)fprintf(stderr, "kvm_getprocs: %s", kvm_geterr(kd));
+ kvm_close(kd);
+ return -1;
+ }
+
+ kvm_close(kd);
+
+ /* VmData */
+ val[0] = P2K((uintmax_t)kp->ki_dsize);
+ /* VmSize */
+ val[1] = B2K((uintmax_t)kp->ki_size);
+ /* VmPeak - not defined in /compat/linux/proc/pid/status */
+ val[2] = -1;
+ /* VmRSS */
+ val[3] = P2K((uintmax_t)kp->ki_rssize);
+ /* VmStk */
+ lmem = P2K((uintmax_t)kp->ki_ssize);
+
+# else /* Linux */
+
sprintf(filename, "/proc/%ld/status", (long)numpro);
fd = open(filename, O_RDONLY, 0);
if (fd==-1) return -1;
@@ -68,7 +114,10 @@
S=strstr(sbuf,"VmStk:")+7;
lmem = atoi(S);
+# endif
+
return lmem ;
+
#else
/*
** Pour retourner des valeurs sous Windows

View File

@ -1,5 +1,5 @@
--- as_setup.py.orig 2014-03-05 09:41:19.000000000 +0100
+++ as_setup.py 2014-05-12 19:32:12.000000000 +0200
+++ as_setup.py 2014-05-24 15:16:48.000000000 +0200
@@ -45,6 +45,8 @@
import compileall
import imp
@ -9,7 +9,15 @@
import distutils.sysconfig as SC
from subprocess import Popen, PIPE
@@ -516,6 +518,46 @@
@@ -408,6 +410,7 @@
archive filename !),
extract_as : rename content.
"""
+ from as_setup import (SYSTEM)
self._print(self._fmt_title % _('Extraction'))
if kargs.get('external')<>None:
self._call_external(**kargs)
@@ -516,6 +519,47 @@
if iextr_as:
self.Clean(to_delete=path)
@ -22,6 +30,18 @@
+ if nl > 0:
+ ligne =ligne.replace("self.check_cc", "# self.check_cc")
+ sys.stdout.write(ligne)
+ file2patch = os.path.join(self.workdir, self.content, 'waftools/scotch.py')
+ self._print('FreeBSD patch: int64_t missing => modify ' + file2patch)
+ for ligne in fileinput.input(file2patch, inplace=1):
+ nl = 0
+ nl = string.find(ligne, 'include "scotch.h"')
+ if nl > 0:
+ sys.stdout.write("#include <sys/types.h>\n")
+ nl = 0
+ nl = string.find(ligne, "stdio.h stdlib.h scotch.h")
+ if nl > 0:
+ ligne =ligne.replace("stdlib.h", "stdlib.h sys/types.h")
+ sys.stdout.write(ligne)
+ file2patch = os.path.join(self.workdir, self.content, 'bibc/utilitai/hpalloc.c')
+ self._print('FreeBSD patch: stdlib + no mallopt => modify ' + file2patch)
+ for ligne in fileinput.input(file2patch, inplace=1):
@ -35,22 +55,11 @@
+ if nl > 0:
+ ligne =ligne.replace("malloc.h", "stdlib.h")
+ sys.stdout.write(ligne)
+ file2patch = os.path.join(self.workdir, self.content, 'bibfor/wscript')
+ self._print('FreeBSD patch: -O2 (GCC Bug 51267) => modify ' + file2patch)
+ for ligne in fileinput.input(file2patch, inplace=1):
+ nl = 0
+ nl = string.find(ligne, "-O2")
+ if nl > 0:
+ ligne =ligne.replace("-O2", "-O0")
+ sys.stdout.write(ligne)
+ file2patch = os.path.join(self.workdir, self.content, 'bibc/utilitai/mempid.c')
+ self._print('FreeBSD patch: VmData VmSize and VmPeak in /proc/%pid%/status ' + file2patch)
+ for ligne in fileinput.input(file2patch, inplace=1):
+ nl = 0
+ nl = string.find(ligne, "/proc")
+ if nl > 0:
+ ligne =ligne.replace("/proc", "/compat/linux/proc")
+ sys.stdout.write(ligne)
+ system=SYSTEM({ 'verbose' : True, 'debug' : False },
+ **{'maxcmdlen' : 2**31, 'log' : self})
+ iret, out = system.local_shell('cd ' + os.path.join(self.workdir, self.content) + '&& /usr/bin/patch -p0 < ' + '%%FILESDIR%%' + '/bibc_utilitai_mempid.c.diff')
+ # End of FreeBSD patches
+
#-------------------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
aster/%%VE%%/bin/aster
aster/%%VE%%/bin/asterd
aster/%%VE%%/include/aster/aster.h
aster/%%VE%%/include/aster/aster_core.h
aster/%%VE%%/include/aster/aster_depend.h
@ -11648,6 +11649,10 @@ aster/asrun/utils.pyo
aster/bin/as_run
aster/bin/auto_update.cron
aster/bin/parallel_cp
%%ASTK_CLIENT%%aster/ASTK/ASTK_SERV/etc/codeaster/astkrc/ASTKRC_INFO.txt
%%ASTK_CLIENT%%aster/ASTK/ASTK_SERV/etc/codeaster/astkrc/config_serveurs
%%ASTK_CLIENT%%aster/ASTK/ASTK_SERV/etc/codeaster/astkrc/outils
%%ASTK_CLIENT%%aster/ASTK/ASTK_SERV/etc/codeaster/astkrc/prefs
%%ASTK_CLIENT%%aster/outils/astk
%%ASTK_CLIENT%%aster/outils/bsf
%%EFICAS%%aster/outils/eficas