1
0
mirror of synced 2024-12-22 04:40:17 +01:00

sci-biology/fsl: patching to allow compilation with modern toolchains

https://github.com/gentoo/sci/issues/963

Package-Manager: Portage-3.0.0, Repoman-2.3.23
Signed-off-by: Horea Christian <chr@chymera.eu>
This commit is contained in:
Horea Christian 2020-08-08 05:51:40 -04:00
parent 7074d6af45
commit ba513a6532
No known key found for this signature in database
GPG Key ID: EAA9223EE3BB378A
15 changed files with 1140 additions and 0 deletions

11
sci-biology/fsl/ChangeLog Normal file
View File

@ -0,0 +1,11 @@
*fsl-6.0.2 (08 Aug 2020)
08 Aug 2020; <chymera@gentoo.org> +files/99fsl,
+files/fsl-5.0.11-fslsurface_parallel_make.patch,
+files/fsl-5.0.11-ifstream_use.patch, +files/fsl-5.0.11-niftiio_var_fix.patch,
+files/fsl-5.0.9-headers.patch, +files/fsl-6.0.2-fsldir_redux.patch,
+files/fsl-6.0.2-gcc10_include.patch, +files/fsl-6.0.2-no_xmlpp.patch,
+files/fsl-6.0.2-qstring_compat.patch, +files/fsl-6.0.2-setup.patch,
+files/fsl-6.0.2-template.patch, +fsl-6.0.2.ebuild, +metadata.xml:
sci-biology/fsl: patching to allow compilation with modern toolchains
https://github.com/gentoo/sci/issues/963

1
sci-biology/fsl/Manifest Normal file
View File

@ -0,0 +1 @@
DIST fsl-6.0.2.tar.gz 2505331864 SHA256 c118b351c6cedb441af7e1b9d194cf344505ff53b417063f697b86305a908afd SHA512 fe308393076c51c50b086f9bf7ff5ddebcf8b1284128e734b9d9e501019917ceba7c0ee5cd5aa1ed44452bcd042ad72653c1a8693f94eab9b83a80fe508a56ca WHIRLPOOL ecb62e9d09cc34ac926353e4a9a131be875428b729bcf2d6f1433d9ea1a7e2b9382d1a1b305651705449a48eb3c576899f09f82ae4254b149a6219096eb45d3d

View File

@ -0,0 +1,5 @@
FSLOUTPUTTYPE=NIFTI_GZ
FSLMULTIFILEQUIT=TRUE
FSLTCLSH=tclsh
FSLWISH=wish
FSLDIR=/usr/share/fsl

View File

@ -0,0 +1,14 @@
diff --git a/src/fslsurface/Makefile b/src/fslsurface/Makefile
index 37f459c..008f443 100644
--- a/src/fslsurface/Makefile
+++ b/src/fslsurface/Makefile
@@ -57,7 +57,7 @@ fslsurfacegl.a: fslsurfacegl.o fslsurface.a
${AR} -r libfslsurfacegl.a fslsurfacegl.o
fslsurface_backcompat.a: fslsurface_first.o fslsurface_dataconv.o fslsurface.a
${AR} -r libfslsurface_backcompat.a fslsurface_first.o fslsurface_dataconv.o
-fslsurfacemaths: fslsurface.a fslsurfacemaths.o
+fslsurfacemaths: fslsurface.a fslsurfacemaths.o fslsurfaceio.o fslsurfacefns.o fslsurface_first.o fslsurface.o
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ fslsurfacemaths.o fslsurfaceio.o fslsurfacefns.o fslsurface_first.o fslsurface.o ${LIBS} ${FMLIBS}
-marching_cubes: fslsurface.a marching_cubes.o
+marching_cubes: fslsurface.a marching_cubes.o fslsurfaceio.o fslsurfacefns.o
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ marching_cubes.o fslsurfaceio.o fslsurfacefns.o ${LIBS} ${FMLIBS}

View File

@ -0,0 +1,13 @@
diff --git a/src/melodic/meldata.cc b/src/melodic/meldata.cc
index f310dc7..03fe8bb 100644
--- a/src/melodic/meldata.cc
+++ b/src/melodic/meldata.cc
@@ -1015,7 +1015,7 @@ namespace Melodic{
Resels = 1.0;
in.open(logger.appendDir("smoothest").c_str(), ios::in);
- if(in>0){
+ if(in.is_open()){
for(int ctr=1; ctr<7; ctr++)
in >> str;
in.close();

View File

@ -0,0 +1,24 @@
diff --git a/src/fslio/dbh.h b/src/fslio/dbh.h
index eff0a50a..fbce1770 100644
--- a/src/fslio/dbh.h
+++ b/src/fslio/dbh.h
@@ -79,19 +79,6 @@ struct dsr /* dsr */
struct data_history hist; /* 148 + 200 */
}; /* total=348 */
-/* Acceptable values for hdr.dime.datatype */
-
-#define DT_NONE 0
-#define DT_UNKNOWN 0
-#define DT_BINARY 1
-#define DT_UNSIGNED_CHAR 2
-#define DT_SIGNED_SHORT 4
-#define DT_SIGNED_INT 8
-#define DT_FLOAT 16
-#define DT_COMPLEX 32
-#define DT_DOUBLE 64
-#define DT_RGB 128
-#define DT_ALL 255
typedef struct
{

View File

@ -0,0 +1,15 @@
# Include zlib header directly.
# From: Francois Bissey <frp.bissey@gmail.com>
# Signed-off-by: Horea Christian <horea.christ@gmail.com>
# Submitted upstream: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1709&L=FSL&F=&S=&X=95C10F0B7D62EAAE7A&P=169254
--- fsl/src/miscvis/writepng.c.orig 2013-10-19 00:18:32.415203592 +1300
+++ fsl/src/miscvis/writepng.c 2013-10-19 00:19:05.414255132 +1300
@@ -32,6 +32,7 @@
#include <stdlib.h> /* for exit() prototype */
+#include "zlib.h"
#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
#include "writepng.h" /* typedefs, common macros, public prototypes */

View File

@ -0,0 +1,495 @@
From 2bc4be1f55b27a733e1e624b34bc570187ba95e1 Mon Sep 17 00:00:00 2001
From: François Bissey <frp.bissey@gmail.com>
Date: Mon, 20 Jan 2020 11:40:53 +1300
Subject: [PATCH] Making sure fsl code and executable can find other executable
and data in standard location.
---
src/fast4/fast_two.cc | 8 ++++----
src/feat5/feat_model.cc | 8 +++-----
src/feat5/tsplot.cc | 7 +++----
src/first/first_utils.cc | 4 ++--
src/fnirt/fnirtfns.cpp | 11 ++++-------
src/fslsurface/fslsurface_first.cc | 6 ++----
src/fslsurface/fslsurfacemaths.cpp | 12 ------------
src/libvis/miscpic.h | 7 +------
src/melodic/meldata.cc | 4 ++--
src/melodic/meloptions.cc | 8 --------
src/melodic/meloptions.h | 1 -
src/melodic/melreport.cc | 12 ++++++------
src/melodic/melreport.h | 20 ++++++++++----------
src/mm/mixture_model.cc | 4 ++--
src/siena/siena_diff.cc | 28 +++++++++++++---------------
src/topup/topupfns.cpp | 3 +--
16 files changed, 53 insertions(+), 90 deletions(-)
diff --git a/src/fast4/fast_two.cc b/src/fast4/fast_two.cc
index 592b5df..b525444 100644
--- a/src/fast4/fast_two.cc
+++ b/src/fast4/fast_two.cc
@@ -166,7 +166,7 @@ int prior_registration(string inname, string main_prior_vol, NEWIMAGE::volume<fl
string csfPriorName, grayPriorName, whitePriorName;
if(alternatePriors.unset())
{
- string priorRootName=string(getenv("FSLDIR")) + "/data/standard/tissuepriors/avg152T1_";
+ string priorRootName="@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/tissuepriors/avg152T1_";
csfPriorName = priorRootName+"csf";
grayPriorName = priorRootName+"gray";
whitePriorName = priorRootName+"white";
@@ -215,15 +215,15 @@ string csfPriorName, grayPriorName, whitePriorName;
if(bapused>0)
{
char reg[1024];
- sprintf(reg, "%s/bin/flirt -ref %s -in %s -out %s -applyxfm -init %s", getenv("FSLDIR"), inname.c_str(), csfPriorName.c_str(), (main_prior_vol+"_csf_stdspace").c_str(), bapriori.value().c_str());
+ sprintf(reg, "flirt -ref %s -in %s -out %s -applyxfm -init %s", inname.c_str(), csfPriorName.c_str(), (main_prior_vol+"_csf_stdspace").c_str(), bapriori.value().c_str());
if(verbose.value())
cout<<reg<<endl;
system(reg);
- sprintf(reg, "%s/bin/flirt -ref %s -in %s -out %s -applyxfm -init %s", getenv("FSLDIR"), inname.c_str(), grayPriorName.c_str(), (main_prior_vol+"_gm_stdspace").c_str(), bapriori.value().c_str());
+ sprintf(reg, "flirt -ref %s -in %s -out %s -applyxfm -init %s", inname.c_str(), grayPriorName.c_str(), (main_prior_vol+"_gm_stdspace").c_str(), bapriori.value().c_str());
if(verbose.value())
cout<<reg<<endl;
system(reg);
- sprintf(reg, "%s/bin/flirt -ref %s -in %s -out %s -applyxfm -init %s", getenv("FSLDIR"), inname.c_str(), whitePriorName.c_str(), (main_prior_vol+"_wm_stdspace").c_str(), bapriori.value().c_str());
+ sprintf(reg, "flirt -ref %s -in %s -out %s -applyxfm -init %s", inname.c_str(), whitePriorName.c_str(), (main_prior_vol+"_wm_stdspace").c_str(), bapriori.value().c_str());
if(verbose.value())
cout << reg << endl;
system(reg);
diff --git a/src/feat5/feat_model.cc b/src/feat5/feat_model.cc
index 399a13e..e15e43c 100644
--- a/src/feat5/feat_model.cc
+++ b/src/feat5/feat_model.cc
@@ -744,7 +744,7 @@ int main(int argc, char **argv)
vector<int> G;
vector<string> titles;
float tr, mult, trmult, nltffwhm=0, maxconvwin=0;
- char fl[10000], *FSLDIR;
+ char fl[10000];
string fn, filename;
FONT_DATA *font_data = new FONT_DATA[1];
@@ -763,8 +763,6 @@ int main(int argc, char **argv)
if (argc==3)
motionparams=remmean(read_ascii_matrix(argv[2]));
- FSLDIR=getenv("FSLDIR");
-
fn = string(argv[1])+".fsf";
level = atoi(find_line(fn, "fmri(level)", fl));
@@ -1510,7 +1508,7 @@ int main(int argc, char **argv)
writeCovarianceImage(string(argv[1])+"_cov.ppm", contrasts, F, nftests, realDesign, level, evs.eigenvals, font_data, contrasts.RE);
writeImagePreview(string(argv[1])+".ppm", contrasts, F, nftests, realDesign, level, evs, font_data, titles, tr, nltffwhm, nTimepoints, G);
- filename=string(getenv("FSLDIR"))+"/bin/wpng -q -overwrite "+string(argv[1])+".ppm ";
+ filename="wpng -q -overwrite "+string(argv[1])+".ppm ";
system(filename.c_str());
return(0);
@@ -2161,6 +2159,6 @@ char the_string[10000];
fclose(outputfile);
- filename=string(getenv("FSLDIR")) + "/bin/wpng -q -overwrite " + filename;
+ filename="wpng -q -overwrite " + filename;
system(filename.c_str());
}
diff --git a/src/feat5/tsplot.cc b/src/feat5/tsplot.cc
index ae191fd..3a02b55 100644
--- a/src/feat5/tsplot.cc
+++ b/src/feat5/tsplot.cc
@@ -293,7 +293,7 @@ int main(int argc, char **argv)
ofstream outputFile;
int numEVs, npts, numContrasts=1, nftests=0, GRPHSIZE(600), PSSIZE(600);
vector<double> normalisedContrasts, model, triggers;
- string fmriFileName, fslPath, featdir, vType, indexText;
+ string fmriFileName, featdir, vType, indexText;
ColumnVector NewimageVoxCoord(4),NiftiVoxCoord(4);
bool outputText(true), useCoordinate(false), prewhiten(false), useTriggers(false), customMask(false), modelFree(false), isHigherLevel(false), outputDataOnly(false);
bool zWeightClusters(true);
@@ -307,7 +307,6 @@ volume<float> immask;
if (argc<2) usage("");
featdir=string(argv[1]);
fmriFileName=featdir+"/filtered_func_data";
- fslPath=string(getenv("FSLDIR"));
string outputName(featdir);
@@ -753,7 +752,7 @@ volume4D<float> acs;
cerr << "Can't open output report file " << outputName << endl;
exit(1);
}
- outputFile << "<HTML>\n<TITLE>"<< statType << num2str(i) <<"</TITLE>\n<BODY BACKGROUND=\"file:"<< fslPath <<"/doc/images/fsl-bg.jpg\">\n<hr><CENTER>\n<H1>FEAT Time Series Report - "<< statType << num2str(i) <<"</H1>\n</CENTER>\n<hr><b>Full plots</b><p>\n"<< graphText;
+ outputFile << "<HTML>\n<TITLE>"<< statType << num2str(i) <<"</TITLE>\n<BODY BACKGROUND=\"file:"<< "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/images/fsl-bg.jpg\">\n<hr><CENTER>\n<H1>FEAT Time Series Report - "<< statType << num2str(i) <<"</H1>\n</CENTER>\n<hr><b>Full plots</b><p>\n"<< graphText;
if (useTriggers) outputFile << "\n<hr><b>Peristimulus plots</b><p>\n"<< peristimulusText <<"\n<HR></BODY></HTML>\n\n";
else outputFile << "\n</BODY></HTML>\n\n";
outputFile.close();
@@ -768,7 +767,7 @@ volume4D<float> acs;
cerr << "Can't open output report file " << outputName << endl;
exit(1);
}
- outputFile << "<HTML>\n<TITLE>FEAT Time Series Report</TITLE>\n<BODY BACKGROUND=\"file:" << fslPath << "/doc/images/fsl-bg.jpg\">\n<hr><CENTER>\n<H1>FEAT Time Series Report</H1>\n</CENTER>\n<hr>" << indexText << "<HR></BODY></HTML>" << endl << endl;
+ outputFile << "<HTML>\n<TITLE>FEAT Time Series Report</TITLE>\n<BODY BACKGROUND=\"file:" << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/images/fsl-bg.jpg\">\n<hr><CENTER>\n<H1>FEAT Time Series Report</H1>\n</CENTER>\n<hr>" << indexText << "<HR></BODY></HTML>" << endl << endl;
outputFile.close();
/* now output same thing without start and end, for inclusion in feat report */
diff --git a/src/first/first_utils.cc b/src/first/first_utils.cc
index 68be44b..85960f4 100644
--- a/src/first/first_utils.cc
+++ b/src/first/first_utils.cc
@@ -1954,8 +1954,8 @@ void do_work_bvars(){
if (!surfaceVAout.value()) {
// do not output on the surface, instead do the new default of outputting a volume with the scalar normal dot product values (for use with randomise)
volume<float> refim;
- if (useReconMNI.value()) { read_volume(refim,string(getenv("FSLDIR")) + "/data/standard/MNI152_T1_1mm"); }
- else { read_volume(refim,string(getenv("FSLDIR")) + "/data/standard/MNI152_T1_1mm"); }
+ if (useReconMNI.value()) { read_volume(refim,"@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); }
+ else { read_volume(refim,"@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm"); }
volume<float> maskvol(refim);
maskvol=0.0f;
volume4D<float> volnormals;
diff --git a/src/fnirt/fnirtfns.cpp b/src/fnirt/fnirtfns.cpp
index 24e26fd..77899e7 100644
--- a/src/fnirt/fnirtfns.cpp
+++ b/src/fnirt/fnirtfns.cpp
@@ -1203,8 +1203,7 @@ string existing_ref_fname(const string& ref_fname)
return(string(ref_fname));
}
else {
- const char *fsldir_ptr = getenv("FSLDIR");
- string eref_fname = string(fsldir_ptr) + string("/data/standard/") + ref_fname;
+ string eref_fname = string("@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/") + ref_fname;
if (NEWIMAGE::FslFileExists(eref_fname)) return(eref_fname);
else return(string(""));
}
@@ -1230,9 +1229,8 @@ string existing_ref_fname(const string& ref_fname)
NEWIMAGE::read_volume_hdr_only(vref,ref_fname); // Throws if file dont exist
eref_fname = ref_fname;
}
- catch(...) { // Didn't exist in current directory, try in ${FSLDIR}/data/standard
- const char *fsldir_ptr = getenv("FSLDIR");
- eref_fname = string(fsldir_ptr) + string("/data/standard/") + ref_fname;
+ catch(...) { // Didn't exist in current directory, try in .../data/standard
+ eref_fname = string("@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/") + ref_fname;
try {
cout << "Could not find " << ref_fname << ", now checking " << eref_fname << endl;
NEWIMAGE::read_volume_hdr_only(vref,eref_fname); // Throws if file dont exist
@@ -1267,8 +1265,7 @@ string existing_conf_file(const string& cfname)
if (check_exist(ecfname)) return(ecfname);
}
if (!FNIRT::path(cfname).length()) { // If no path explicitly given
- const char *fsldir_ptr = getenv("FSLDIR");
- ecfname = string(fsldir_ptr) + string("/etc/flirtsch/") + cfname;
+ ecfname = string("@GENTOO_PORTAGE_EPREFIX@/etc/flirtsch/") + cfname;
if (check_exist(ecfname)) return(ecfname);
else if (!FNIRT::extension(ecfname).length()) { // If no path _and_ no extension given
ecfname += string(".cnf");
diff --git a/src/fslsurface/fslsurface_first.cc b/src/fslsurface/fslsurface_first.cc
index faec642..b2ef794 100644
--- a/src/fslsurface/fslsurface_first.cc
+++ b/src/fslsurface/fslsurface_first.cc
@@ -500,8 +500,7 @@ namespace fslsurface_name {
volume<float>* immni = new volume<float>();
- char* fsldir = getenv("FSLDIR");
- read_volume_hdr_only(*immni, string(fsldir) + "/data/standard/MNI152_T1_1mm");
+ read_volume_hdr_only(*immni, "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm");
//read_volume_hdr_only(*immni, template_name);
@@ -699,8 +698,7 @@ namespace fslsurface_name {
volume<float>* immni = new volume<float>();
- char* fsldir = getenv("FSLDIR");
- read_volume_hdr_only(*immni, string(fsldir) + "/data/standard/MNI152_T1_1mm");
+ read_volume_hdr_only(*immni, "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/data/standard/MNI152_T1_1mm");
//read_volume_hdr_only(*immni, template_name);
diff --git a/src/fslsurface/fslsurfacemaths.cpp b/src/fslsurface/fslsurfacemaths.cpp
index eaf55eb..3dc184d 100644
--- a/src/fslsurface/fslsurfacemaths.cpp
+++ b/src/fslsurface/fslsurfacemaths.cpp
@@ -598,12 +598,6 @@ int main (int argc, char * argv[])
}else if (command == "-reconFromBvars"){
cout<<"do recon "<<endl;
- char* fsldir = getenv("FSLDIR");
- if (fsldir == NULL)
- {
- cerr<<"FSLDIR has not been set. "<<endl;
- exit(EXIT_FAILURE);
- }
//file.bvars,mni_template.nii.gz
// string mni = string(fsldir)+"/data/standard/MNI152_T1_1mm";
reconSurface_from_bvars( surf, string(argv[i_arg+1]));
@@ -612,12 +606,6 @@ int main (int argc, char * argv[])
}else if (command == "-reconAllFromBvarsAndSave"){
cout<<"do recon+save "<<argc<<" "<<i_arg<<endl;
- char* fsldir = getenv("FSLDIR");
- if (fsldir == NULL)
- {
- cerr<<"FSLDIR has not been set. "<<endl;
- exit(EXIT_FAILURE);
- }
//file.bvars,mni_template.nii.gz
// string mni = string(fsldir)+"/data/standard/MNI152_T1_1mm";
cout<<"recon "<< string(argv[i_arg+1])<<endl;
diff --git a/src/libvis/miscpic.h b/src/libvis/miscpic.h
index a2f3855..5f440f2 100644
--- a/src/libvis/miscpic.h
+++ b/src/libvis/miscpic.h
@@ -90,12 +90,7 @@ namespace MISCPIC{
markRight=false;
trans= -10;
edgethresh = 0.0;
- if(getenv("FSLDIR")!=0){
- lutbase = string(getenv("FSLDIR")) + "/etc/luts/";
- }
- else{
- lutbase = string("/");
- }
+ lutbase = "@GENTOO_PORTAGE_EPREFIX@/etc/luts/";
title = string("");
cbartype = string("");
cbarptr = NULL;
diff --git a/src/melodic/meldata.cc b/src/melodic/meldata.cc
index 1749a45..c4ad234 100644
--- a/src/melodic/meldata.cc
+++ b/src/melodic/meldata.cc
@@ -992,7 +992,7 @@ namespace Melodic{
void MelodicData::est_smoothness()
{
if(Resels == 0){
- string SM_path = opts.binpath + "smoothest";
+ string SM_path = "smoothest";
string Mask_fname = logger.appendDir("mask");
if(opts.segment.value().length()>0){
@@ -1157,7 +1157,7 @@ namespace Melodic{
// set up all strings
string BET_outputfname = string(Mean_fname)+"_brain";
- string BET_path = opts.binpath + "bet";
+ string BET_path = "bet";
string BET_optarg = "-m -f 0.4"; // see man bet
string Mask_fname = BET_outputfname+"_mask";
diff --git a/src/melodic/meloptions.cc b/src/melodic/meloptions.cc
index 08170c7..252e72b 100644
--- a/src/melodic/meloptions.cc
+++ b/src/melodic/meloptions.cc
@@ -93,14 +93,6 @@ MelodicOptions* MelodicOptions::gopt = NULL;
explicitnums = false;
logfname = string("log.txt");
- // work out the path to the $FSLDIR/bin directory
- if(getenv("FSLDIR")!=0){
- binpath = (string) getenv("FSLDIR") + "/bin/";
- } else{
- binpath = argv[0];
- binpath = binpath.substr(0,binpath.length()-7);
- }
-
// parse once to establish log directory name
for(int a = options.parse_command_line(argc, argv); a < argc; a++);
diff --git a/src/melodic/meloptions.h b/src/melodic/meloptions.h
index f546125..b964b7d 100644
--- a/src/melodic/meloptions.h
+++ b/src/melodic/meloptions.h
@@ -93,7 +93,6 @@ class MelodicOptions {
~MelodicOptions() { delete gopt; }
string version;
- string binpath;
string logfname;
bool filtermode;
bool explicitnums;
diff --git a/src/melodic/melreport.cc b/src/melodic/melreport.cc
index 141b6c2..2625059 100644
--- a/src/melodic/melreport.cc
+++ b/src/melodic/melreport.cc
@@ -84,8 +84,8 @@ namespace Melodic{
IChtml.setDir(report.getDir(),mmodel.get_prefix()+".html");
{//start IC page
- IChtml << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:" +
- (string) getenv("FSLDIR") +"/doc/fsl.css>" << endl
+ IChtml << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>" << endl
<< "<style type=\"text/css\">OBJECT { width: 100% }</style>"
<< "<TITLE>FSL</TITLE></HEAD>" << endl
<< "<IFRAME height=" << int(melodat.get_numfiles()/30 + 1)*50
@@ -486,8 +486,8 @@ namespace Melodic{
{//start IC2 page
IChtml2.setDir(report.getDir(),mmodel.get_prefix()+"_MM.html");
- IChtml2 << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:" +
- (string) getenv("FSLDIR") +"/doc/fsl.css>" << endl
+ IChtml2 << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>" << endl
<< "<style type=\"text/css\">OBJECT { width: 100% }</style>"
<< "<TITLE>FSL</TITLE></HEAD>" << endl
<< "<IFRAME height="<< int(melodat.get_numfiles()/30 + 1)*50
@@ -665,8 +665,8 @@ namespace Melodic{
IChtml << "<HTML> " << endl
<< "<TITLE>MELODIC Component " << num2str(cnum)
<< "</TITLE>" << endl
- << "<BODY BACKGROUND=\"file:" << getenv("FSLDIR")
- << "/doc/images/fsl-bg.jpg\">" << endl
+ << "<BODY BACKGROUND=\"file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/images/fsl-bg.jpg\">" << endl
<< "<hr><CENTER><H1>MELODIC Component " << num2str(cnum)
<< "</H1>"<< endl;
diff --git a/src/melodic/melreport.h b/src/melodic/melreport.h
index 574fc4c..e444681 100644
--- a/src/melodic/melreport.h
+++ b/src/melodic/melreport.h
@@ -104,21 +104,21 @@ namespace Melodic{
const time_t tmptime = time(NULL);
system(("mkdir "+ logger.appendDir("report") + " 2>/dev/null").c_str());
report.setDir(logger.appendDir("report"),"00index.html",true,false,ios::out);
- report << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:" +
- (string) getenv("FSLDIR") +"/doc/fsl.css>"
+ report << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>"
<< "<TITLE>MELODIC report</TITLE></HEAD><BODY>"
<< endl <<endl;
loghtml.setDir(report.getDir(),"log.html");
- loghtml << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:" +
- (string) getenv("FSLDIR") +"/doc/fsl.css>"
+ loghtml << "<HTML><HEAD><link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>"
<< "<TITLE>MELODIC report</TITLE></HEAD><BODY>"
<< endl <<endl;
navigator.setDir(report.getDir(),"nav.html");
head.setDir(report.getDir(),"head.html");
- navigator << "<link REL=stylesheet TYPE=text/css href=file:"+
- (string) getenv("FSLDIR") +"/doc/fsl.css>" << endl;
- head << "<link REL=stylesheet TYPE=text/css href=file:"+
- (string) getenv("FSLDIR") +"/doc/fsl.css>" << endl;
+ navigator << "<link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>" << endl;
+ head << "<link REL=stylesheet TYPE=text/css href=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/fsl.css>" << endl;
head <<"<TABLE BORDER=0><TR>" << endl
<<" <TD ALIGN=CENTER WIDTH=100%>"<< endl
<<"<TABLE BORDER=0>"<< endl
@@ -130,8 +130,8 @@ namespace Melodic{
<< "</tr></table>" << endl
<< "<TD ALIGN=RIGHT>" << endl
<< "<a href=http://www.fmrib.ox.ac.uk/fsl target=_top>" << endl
- << "<IMG BORDER=0 SRC=file:"<< getenv("FSLDIR")
- << "/doc/images/fsl-logo-big.jpg WIDTH=165></a>" << endl
+ << "<IMG BORDER=0 SRC=file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/images/fsl-logo-big.jpg WIDTH=165></a>" << endl
<< "</TD>"<<endl<<"</TR></TABLE> <hr>"<<endl;
if(opts.guireport.value()==""){
report <<"<OBJECT data=head.html></OBJECT>" << endl;
diff --git a/src/mm/mixture_model.cc b/src/mm/mixture_model.cc
index b8e6167..5f00693 100644
--- a/src/mm/mixture_model.cc
+++ b/src/mm/mixture_model.cc
@@ -2224,8 +2224,8 @@ namespace Mm {
htmllog << "<HTML> " << endl
<< "<TITLE>Mixture Model fit for" << data_name << "</TITLE>" << endl
- << "<BODY BACKGROUND=\"file:" << getenv("FSLDIR")
- << "/doc/images/fsl-bg.jpg\">" << endl
+ << "<BODY BACKGROUND=\"file:"
+ << "@GENTOO_PORTAGE_EPREFIX@/usr/share/fsl/doc/images/fsl-bg.jpg\">" << endl
<< "<hr><CENTER><H1>Mixture Model fit for<br>" << data_name << " </H1>"<< endl;
htmllog << "<hr><p>" << endl;
diff --git a/src/siena/siena_diff.cc b/src/siena/siena_diff.cc
index e19193a..17d8701 100644
--- a/src/siena/siena_diff.cc
+++ b/src/siena/siena_diff.cc
@@ -107,7 +107,7 @@ int main(int argc,char *argv[])
{
// {{{ vars
-char thestring[10000], segoptions[10000], fsldir[10000];
+char thestring[10000], segoptions[10000];
int x_size, y_size, z_size, size, x, y, z, i, count,
seg2=0, ignore_z=0, ignore_top_slices=0, //erode_mask=0,
ignore_bottom_slices=0, debug=0, flow_output=1, edge_masking=0;
@@ -124,8 +124,6 @@ if (argc<3)
string argv1(argv[1]), argv2(argv[2]);
-sprintf(fsldir,"%s",getenv("FSLDIR"));
-
for (i = 3; i < argc; i++) {
if (!strcmp(argv[i], "-i"))
ignore_z=1;
@@ -209,26 +207,26 @@ for (i = 3; i < argc; i++) {
// }}}
// {{{ transform images and masks
-sprintf(thestring,"%s/bin/flirt -o %s_halfwayto_%s -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s",
- fsldir,argv[1],argv[2],argv[1],argv[2],argv[1],argv[1]);
+sprintf(thestring,"flirt -o %s_halfwayto_%s -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s",
+ argv[1],argv[2],argv[1],argv[2],argv[1],argv[1]);
printf("%s\n",thestring); system(thestring);
-sprintf(thestring,"%s/bin/flirt -o %s_halfwayto_%s -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s",
- fsldir,argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
+sprintf(thestring,"flirt -o %s_halfwayto_%s -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s",
+ argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
printf("%s\n",thestring); system(thestring);
-sprintf(thestring,"%s/bin/flirt -o %s_halfwayto_%s_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_brain_mask",
- fsldir,argv[1],argv[2],argv[1],argv[2],argv[1],argv[1]);
+sprintf(thestring,"flirt -o %s_halfwayto_%s_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_brain_mask",
+ argv[1],argv[2],argv[1],argv[2],argv[1],argv[1]);
printf("%s\n",thestring); system(thestring);
-sprintf(thestring,"%s/bin/flirt -o %s_halfwayto_%s_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_brain_mask",
- fsldir,argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
+sprintf(thestring,"flirt -o %s_halfwayto_%s_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_brain_mask",
+ argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
printf("%s\n",thestring); system(thestring);
if (edge_masking)
{
- sprintf(thestring,"%s/bin/flirt -o %s_halfwayto_%s_valid_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_valid_mask_with_%s",
- fsldir,argv[1],argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
+ sprintf(thestring,"flirt -o %s_halfwayto_%s_valid_mask -applyisoxfm 1 -paddingsize 0 -init %s_halfwayto_%s.mat -ref %s -in %s_valid_mask_with_%s",
+ argv[1],argv[2],argv[1],argv[2],argv[1],argv[1],argv[2]);
printf("%s\n",thestring); system(thestring);
}
@@ -287,8 +285,8 @@ if(1) // always done unless the above uncommented and used instead of this test
cout << "saving image 1 to disk prior to segmentation" << endl;
save_volume(in1,argv1+"_halfwayto_"+argv2+"_brain");
in1.destroy();
- sprintf(thestring,"%s/bin/fast %s %s %s_halfwayto_%s_brain > %s_halfwayto_%s_brain.vol 2>&1",
- fsldir,segtype,segoptions,argv[1],argv[2],argv[1],argv[2]);
+ sprintf(thestring,"fast %s %s %s_halfwayto_%s_brain > %s_halfwayto_%s_brain.vol 2>&1",
+ segtype,segoptions,argv[1],argv[2],argv[1],argv[2]);
cout << thestring << endl;
system(thestring);
}
diff --git a/src/topup/topupfns.cpp b/src/topup/topupfns.cpp
index 6873758..9e8b956 100644
--- a/src/topup/topupfns.cpp
+++ b/src/topup/topupfns.cpp
@@ -463,8 +463,7 @@ string existing_conf_file(const string& cfname)
if (TOPUP::check_exist(ecfname)) return(ecfname);
}
if (!TOPUP::path(cfname).length()) { // If no path explicitly given
- const char *fsldir_ptr = getenv("FSLDIR");
- ecfname = string(fsldir_ptr) + string("/etc/flirtsch/") + cfname;
+ ecfname = string("@GENTOO_PORTAGE_EPREFIX@/etc/flirtsch/") + cfname;
if (TOPUP::check_exist(ecfname)) return(ecfname);
else if (!TOPUP::extension(ecfname).length()) { // If no path _and_ no extension given
ecfname += string(".cnf");
--
2.24.1

View File

@ -0,0 +1,11 @@
--- a/src/newimage/newimageio.h 2020-06-18 06:05:51.287864975 -0400
+++ b/src/newimage/newimageio.h 2020-06-18 06:06:27.535129711 -0400
@@ -75,6 +75,8 @@
#include <iostream>
#include <fstream>
#include <sstream>
+#include <string>
+#include <stdexcept>
#include "NewNifti/NewNifti.h"
#include "newmatio.h"
#include "newimage.h"

View File

@ -0,0 +1,58 @@
From 9de29e5141afa43c06f347ca158b67168fbb0031 Mon Sep 17 00:00:00 2001
From: François Bissey <frp.bissey@gmail.com>
Date: Mon, 20 Jan 2020 11:46:52 +1300
Subject: [PATCH] Build without xmlpp since we use an external ciftilib that
doesnt require it. Replace it and other ciftilib flags with CIFTICFLAGS.
---
src/flameo/Makefile | 4 ++--
src/melodic/Makefile | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/flameo/Makefile b/src/flameo/Makefile
index d22eb965..e967e682 100644
--- a/src/flameo/Makefile
+++ b/src/flameo/Makefile
@@ -2,7 +2,7 @@ include ${FSLCONFDIR}/default.mk
PROJNAME = flame
-USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB} -DCIFTILIB_USE_XMLPP -I${FSLEXTINC} -I${INC_XML2} -I${INC_XML++} -I${INC_XML++CONF} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio
+USRINCFLAGS = -fPIC -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB} -I${FSLEXTINC} ${CIFTICFLAGS} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio
USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_ZLIB}
UNAME := $(shell uname)
@@ -10,7 +10,7 @@ ifeq (${UNAME},Darwin)
LIBS = -liconv
endif
-LIBS += -lutils -lnewimage -lmiscmaths -lm -lnewmat -lNewNifti -lcifti -lxml++-2.6 -lxml2 -lboost_filesystem -lboost_system -lznz -lprob -lz
+LIBS += -lutils -lnewimage -lmiscmaths -lm -lnewmat -lNewNifti ${CIFTILIBS} -lboost_filesystem -lboost_system -lznz -lprob -lz
XFILES = flameo
diff --git a/src/melodic/Makefile b/src/melodic/Makefile
index 50666517..0c356a2d 100644
--- a/src/melodic/Makefile
+++ b/src/melodic/Makefile
@@ -7,7 +7,7 @@ OPTFLAGS_alphaev6-dec-osf5.0-gcc2.95.2 = -O3 -mieee -mfp-trap-mode=sui
PROJNAME = melodic
-USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_GD} -I${INC_GDC} -I${INC_PNG} -I${INC_ZLIB} -DCIFTILIB_USE_XMLPP -I${FSLEXTINC} -I${INC_XML2} -I${INC_XML++} -I${INC_XML++CONF} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio
+USRINCFLAGS = -fPIC -I${INC_NEWMAT} -I${INC_PROB} -I${INC_GD} -I${INC_GDC} -I${INC_PNG} -I${INC_ZLIB} -I${FSLEXTINC} ${CIFTICFLAGS} -I${INC_BOOST} -I${FSLDIR}/include/ciftiio
USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_GD} -L${LIB_GDC} -L${LIB_PNG} -L${LIB_ZLIB}
UNAME := $(shell uname)
@@ -15,7 +15,7 @@ ifeq (${UNAME},Darwin)
LIBS = -liconv
endif
-LIBS += -lutils -lnewimage -lmiscplot -lmiscpic -lmiscmaths -lNewNifti -lcifti -lxml++-2.6 -lxml2 -lboost_filesystem -lboost_system -lznz -lnewmat -lprob -lm -lgdc -lgd -lpng -lz
+LIBS += -lutils -lnewimage -lmiscplot -lmiscpic -lmiscmaths -lNewNifti ${CIFTILIBS} -lboost_filesystem -lboost_system -lznz -lnewmat -lprob -lm -lgdc -lgd -lpng -lz
TEST_OBJS = test.o
--
2.24.1

View File

@ -0,0 +1,63 @@
From 5a5ab3c80eaaea1fe9a43659e2ea5b773b587bb0 Mon Sep 17 00:00:00 2001
From: François Bissey <frp.bissey@gmail.com>
Date: Mon, 20 Jan 2020 11:51:52 +1300
Subject: [PATCH] Because we use qstrings in ciftilib, calls to ciftilib file
function have to be made into compatible c strings.
---
src/flameo/gsa.cc | 4 ++--
src/melodic/meldata.cc | 2 +-
src/melodic/meldata.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/flameo/gsa.cc b/src/flameo/gsa.cc
index 70f8f385..16167abe 100644
--- a/src/flameo/gsa.cc
+++ b/src/flameo/gsa.cc
@@ -74,7 +74,7 @@ namespace GSA {
sourceType=mode;
if ( sourceType.compare("CIFTI") == 0 ) {
cifti::CiftiFile inputCifti;
- inputCifti.openFile(make_basename(filename)+".nii");
+ inputCifti.openFile((make_basename(filename)+".nii").c_str());
ciftiExemplar=inputCifti.getCiftiXML();
cerr << "ndim " << ciftiExemplar.getNumberOfDimensions() << endl;
cerr << "type1 " << ciftiExemplar.getMappingType(0) << endl;
@@ -194,7 +194,7 @@ namespace GSA {
scalarsMap.setLength(data.Nrows());
ciftiExemplar.setMap(0, scalarsMap);
CiftiFile outputFile;
- outputFile.setWritingFile(make_basename(filename)+extension+".nii");//sets up on-disk writing with default writing version
+ outputFile.setWritingFile((make_basename(filename)+extension+".nii").c_str());//sets up on-disk writing with default writing version
outputFile.setCiftiXML(ciftiExemplar,false);
vector<float> scratchRow(data.Nrows());//read/write a row at a time
for (int64_t row=0;row<data.Ncols();row++) {
diff --git a/src/melodic/meldata.cc b/src/melodic/meldata.cc
index c4ad2349..1515e702 100644
--- a/src/melodic/meldata.cc
+++ b/src/melodic/meldata.cc
@@ -118,7 +118,7 @@ namespace Melodic{
tmpData = RawData.matrix(Mask);
memmsg(" after reshape ");
} else { //Read in Cifti
- inputCifti.openFile(fname+".nii");
+ inputCifti.openFile((fname+".nii").c_str());
const vector<int64_t>& dims = inputCifti.getDimensions();
tmpData.ReSize(dims[0],dims[1]); //swapped compared to cifti
vector<float> scratchRow(dims[0]);//read/write a row at a time
diff --git a/src/melodic/meldata.h b/src/melodic/meldata.h
index 49774003..f5326bdd 100644
--- a/src/melodic/meldata.h
+++ b/src/melodic/meldata.h
@@ -109,7 +109,7 @@ namespace Melodic{
message(" " << logger.appendDir(fname) << endl);
} else { //Process CIFTI save ICs as float
cifti::CiftiFile outputFile;
- outputFile.setWritingFile(logger.appendDir(fname)+".nii");//sets up on-disk writing with default writing version
+ outputFile.setWritingFile((logger.appendDir(fname)+".nii").c_str());//sets up on-disk writing with default writing version
cifti::CiftiXML xml(inputCifti.getCiftiXML());
cifti::CiftiScalarsMap scalarsMap;
std::vector<char> foo = xml.writeXMLToVector();
--
2.24.1

View File

@ -0,0 +1,198 @@
From baae97cc3c8d0cadcabb7ed16559f4e4de26ddbe Mon Sep 17 00:00:00 2001
From: François Bissey <frp.bissey@gmail.com>
Date: Mon, 20 Jan 2020 11:54:37 +1300
Subject: [PATCH] Adjust the build system so it doesnt build packages
externally provided by portage. Make the compilation flags more generic and
easily adjustable. Make the build system stop at the first fault.
---
build | 6 +++---
config/buildSettings.mk | 20 ++++++++++----------
config/common/buildproj | 8 +++++---
config/common/vars.mk | 10 +++++-----
extras/build | 8 ++++----
src/mist-clean/Makefile | 2 +-
6 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/build b/build
index 05dac06c..d90e407b 100755
--- a/build
+++ b/build
@@ -3,7 +3,7 @@
if [ $# -ge 1 ] ; then
PROJECTS="$@";
else
- MASTERPROJECTS="CiftiLib-master utils znzlib NewNifti niftiio fslio giftiio miscmaths newimage libhfunc libvis first_lib \
+ MASTERPROJECTS="utils znzlib NewNifti niftiio fslio giftiio miscmaths newimage libhfunc libvis first_lib \
meshclass fslvtkio misc_tcl basisfield warpfns bint shapeModel MVdisc fslvtkconv fslsurface libmeshutils newmesh \
DiscreteOpt FastPDlib MSMRegLib misc_c dpm topup \
asl_mfree \
@@ -80,8 +80,8 @@ xtract";
done
fi
-echo "Building projects - see build.log file for progress..."
-./config/common/buildproj $PROJECTS > ./build.log 2>&1
+echo "Building projects"
+./config/common/buildproj $PROJECTS
finalStatus=$?
if [ $finalStatus -eq 0 ]; then
echo "Build completed successfully.";
diff --git a/config/buildSettings.mk b/config/buildSettings.mk
index b2e1f150..04532fc2 100644
--- a/config/buildSettings.mk
+++ b/config/buildSettings.mk
@@ -18,7 +18,7 @@ MV = /bin/mv
CHMOD = /bin/chmod
MKDIR = /bin/mkdir
INSTALL = install -p
-TCLSH = ${FSLDIR}/bin/fsltclsh
+TCLSH = tclsh
DEPENDFLAGS = -MM
MACHDBGFLAGS = -g
#####################################################################
@@ -124,19 +124,19 @@ endif # if Darwin
#####################################################################
ifeq ($(SYSTYPE), Linux)
############### System Vars #####################################
-CC = gcc
-CXX = c++
-CXX11 = c++
+CC = @@GENTOO_CC@@
+CXX = @@GENTOO_CXX@@
+CXX11 = @@GENTOO_CXX@@
CSTATICFLAGS = -static
CXXSTATICFLAGS = -static
-ARCHFLAGS = -m64
-ARCHLDFLAGS = -Wl,-rpath,'$$ORIGIN/../lib'
+ARCHFLAGS =
+ARCHLDFLAGS =
PARALLELFLAGS = -fopenmp
-OPTFLAGS = -g -O3 -fexpensive-optimizations ${ARCHFLAGS}
+OPTFLAGS =
GNU_ANSI_FLAGS = -Wall -ansi -pedantic -Wno-long-long
SGI_ANSI_FLAGS = -ansi -fullwarn
ANSI_FLAGS = ${GNU_ANSI_FLAGS}
-RANLIB = echo
+RANLIB = @@GENTOO_RANLIB@@
FSLML = ${FSLDIR}/bin/fslml
# CUDA development environment
CUDAVER := $(or $(CUDAVER),9.1)
@@ -148,8 +148,8 @@ INC_CUDA = ${CUDA_INSTALLATION}/include
NVCC = ${CUDA_INSTALLATION}/bin/nvcc
############### External Libs #####################################
# ZLIB library
-LIB_ZLIB = /lib64
-INC_ZLIB = /usr/include
+#LIB_ZLIB = /lib64
+#INC_ZLIB = /usr/include
# QT library
QTDIR = /usr/lib/qt3
LIB_QT = ${QTDIR}/lib
diff --git a/config/common/buildproj b/config/common/buildproj
index 2f0f2b8f..48624a1f 100755
--- a/config/common/buildproj
+++ b/config/common/buildproj
@@ -11,10 +11,10 @@ if [ X$1 = X-strict ] ; then
fi
PROJECTS="$@" ; export PROJECTS ;
-FSLDIR=`pwd`
+#FSLDIR=`pwd`
FSLDEVDIR=${FSLDIR}
FSLCONFDIR=${FSLDIR}/config
-FSLMACHTYPE=`${FSLDIR}/etc/fslconf/fslmachtype.sh`
+#FSLMACHTYPE=`${FSLDIR}/etc/fslconf/fslmachtype.sh`
FSLMASTERBUILD=1
export FSLDIR FSLDEVDIR FSLCONFDIR FSLMACHTYPE FSLMASTERBUILD
@@ -67,7 +67,7 @@ for projname in $PROJECTS; do
if [ -x ./fslconfig ] ; then
. ./fslconfig ;
fi
- if ${MAKE} -k ${MAKEOPTIONS} ; then
+ if ${MAKE} ${MAKEOPTIONS} ; then
if ${MAKE} ${MAKEOPTIONS} install ; then
installok=true;
# Clean up after ourselves
@@ -82,6 +82,7 @@ for projname in $PROJECTS; do
if [ $installok = false ] ; then
echo " "
echo "ERROR::Could not install $projname successfully" ;
+ exit 1
fi
else
echo " "
@@ -90,6 +91,7 @@ for projname in $PROJECTS; do
echo " "
echo " "
errorprojs="$errorprojs $projname" ; export errorprojs ;
+ exit 1
fi
fi
done
diff --git a/config/common/vars.mk b/config/common/vars.mk
index b027b010..aeeae67c 100755
--- a/config/common/vars.mk
+++ b/config/common/vars.mk
@@ -24,15 +24,15 @@ USRINCFLAGS =
USRCFLAGS =
USRCXXFLAGS =
-LDFLAGS = ${ARCHLDFLAGS} ${USRLDFLAGS} -L. -L${DEVLIBDIR} -L${LIBDIR}
+LDFLAGS = ${ARCHLDFLAGS} ${USRLDFLAGS} -L. -L${DEVLIBDIR} -L${LIBDIR} ${USERLDFLAGS}
-AccumulatedIncFlags = -I${INC_BOOST} ${USRINCFLAGS} -I. -I${DEVINCDIR} -I${INCDIR}
+AccumulatedIncFlags = ${USRINCFLAGS} -I. -I${DEVINCDIR} -I${INCDIR} ${CPPFLAGS}
CFLAGS = ${ANSI_FLAGS} ${ANSI_CFLAGS} ${DBGFLAGS} ${USEDCSTATICFLAGS} ${USRCFLAGS} ${ARCHFLAGS} ${OPTFLAGS} \
- ${AccumulatedIncFlags}
+ ${AccumulatedIncFlags} ${USERCFLAGS}
-CXXFLAGS = ${ANSI_FLAGS} ${ANSI_CXXFLAGS} ${DBGFLAGS} ${USEDCXXSTATICFLAGS} ${USRCXXFLAGS} ${ARCHFLAGS} ${OPTFLAGS} \
- ${AccumulatedIncFlags}
+CXXFLAGS = ${ANSI_CXXFLAGS} ${DBGFLAGS} ${USEDCXXSTATICFLAGS} ${USRCXXFLAGS} ${ARCHFLAGS} ${OPTFLAGS} \
+ ${AccumulatedIncFlags} ${USERCXXFLAGS}
HFILES = *.h
AFILES = *.a
diff --git a/extras/build b/extras/build
index 59e7a2ed..0d68232e 100755
--- a/extras/build
+++ b/extras/build
@@ -96,16 +96,16 @@ if [ X"${OS}" = "XDarwin" ]; then
BUILDICONV=1
fi
fi
-PROJECTS="tcl tk"
+#PROJECTS="tcl tk"
if [ ${BUILDZLIB} -eq 1 ]; then
PROJECTS="${PROJECTS} zlib"
fi
-PROJECTS="${PROJECTS} libpng"
+#PROJECTS="${PROJECTS} libpng"
if [ ${BUILDICONV} -eq 1 ]; then
PROJECTS="${PROJECTS} libiconv"
fi
-PROJECTS="${PROJECTS} libgd libgdc libprob libcprob newmat cprob newran fftw"
-PROJECTS="${PROJECTS} boost libxml2-2.9.2 libxmlpp libsqlite libnlopt ../include/armawrap/dummy_newmat"
+PROJECTS="${PROJECTS} libgdc libprob libcprob newmat cprob newran"
+PROJECTS="${PROJECTS} ../include/armawrap/dummy_newmat"
for projname in $PROJECTS; do
if [ -d $FSLESRCDIR/$projname ] ; then
buildIt $FSLESRCDIR $projname 1
diff --git a/src/mist-clean/Makefile b/src/mist-clean/Makefile
index 20402cca..6918bee4 100755
--- a/src/mist-clean/Makefile
+++ b/src/mist-clean/Makefile
@@ -52,6 +52,6 @@ installpython:
cp -r python/* ${DESTDIR}/python/mist
clean:
- rm -f ${OBJS} mist/mist.o mist/mist
+ rm -f ${OBJS} mist/mist.o mist/mist || echo "CLEAN could not locate some files scheduled for deletion."
.PHONY: all clean installdata
--
2.24.1

View File

@ -0,0 +1,55 @@
Subject: as discussed in https://github.com/gentoo/sci/issues/963
--- a/src/newimage/generalio.cc 2019-09-11 09:24:32.000000000 -0400
+++ b/src/newimage/generalio.cc §2020-08-07 20:30:20.037494201 -0400
@@ -308,6 +308,41 @@
return 0;
}
+template
+int readGeneralVolume<double>(volume<double>& target, const string& filename,
+ short& dtype, const bool swap2radiological,
+ int64_t x0, int64_t y0, int64_t z0, int64_t t0, int64_t d50, int64_t d60, int64_t d70,
+ int64_t x1, int64_t y1, int64_t z1, int64_t t1, int64_t d51, int64_t d61, int64_t d71,
+ const bool readAs4D);
+
+template
+int readGeneralVolume<float>(volume<float>& target, const string& filename,
+ short& dtype, const bool swap2radiological,
+ int64_t x0, int64_t y0, int64_t z0, int64_t t0, int64_t d50, int64_t d60, int64_t d70,
+ int64_t x1, int64_t y1, int64_t z1, int64_t t1, int64_t d51, int64_t d61, int64_t d71,
+ const bool readAs4D);
+
+template
+int readGeneralVolume<short>(volume<short>& target, const string& filename,
+ short& dtype, const bool swap2radiological,
+ int64_t x0, int64_t y0, int64_t z0, int64_t t0, int64_t d50, int64_t d60, int64_t d70,
+ int64_t x1, int64_t y1, int64_t z1, int64_t t1, int64_t d51, int64_t d61, int64_t d71,
+ const bool readAs4D);
+
+template
+int readGeneralVolume<char>(volume<char>& target, const string& filename,
+ short& dtype, const bool swap2radiological,
+ int64_t x0, int64_t y0, int64_t z0, int64_t t0, int64_t d50, int64_t d60, int64_t d70,
+ int64_t x1, int64_t y1, int64_t z1, int64_t t1, int64_t d51, int64_t d61, int64_t d71,
+ const bool readAs4D);
+
+template
+int readGeneralVolume<int>(volume<int>& target, const string& filename,
+ short& dtype, const bool swap2radiological,
+ int64_t x0, int64_t y0, int64_t z0, int64_t t0, int64_t d50, int64_t d60, int64_t d70,
+ int64_t x1, int64_t y1, int64_t z1, int64_t t1, int64_t d51, int64_t d61, int64_t d71,
+ const bool readAs4D);
+
template int read_volumeROI(volume<char>& target, const string& filename,
short& dtype,
int64_t x0, int64_t y0, int64_t z0, int64_t t0,
--- a/src/fslsurface/fslsurfaceio.cc 2019-09-11 09:23:11.000000000 -0400
+++ b/src/fslsurface/fslsurfaceio.cc 2020-08-08 04:17:55.917387550 -0400
@@ -1055,6 +1055,7 @@
return 0;
}
+ template int readGIFTI<float, unsigned int>( fslSurface<float, unsigned int> & surf, const string & filename);
template int writeGIFTI<float, unsigned int>( const fslSurface<float, unsigned int> & surf, const std::string & filename, int enc);

View File

@ -0,0 +1,166 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit flag-o-matic toolchain-funcs prefix
DESCRIPTION="Analysis of functional, structural, and diffusion MRI brain imaging data"
HOMEPAGE="http://www.fmrib.ox.ac.uk/fsl"
SRC_URI="https://fsl.fmrib.ox.ac.uk/fsldownloads/${P}-sources.tar.gz -> ${P}.tar.gz"
LICENSE="FSL BSD-2 newmat"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
DEPEND="
dev-libs/boost
dev-python/fslpy
media-gfx/graphviz
media-libs/gd
media-libs/glu
media-libs/libpng:0=
sci-libs/ciftilib
sci-libs/nlopt
sys-libs/zlib
dev-lang/tcl:0=
dev-lang/tk:0=
>=virtual/lapack-3.8
>=virtual/blas-3.8
"
RDEPEND="${DEPEND}"
S=${WORKDIR}/${PN}
UPSTREAM_FSLDIR="/usr/share/fsl"
PATCHES=(
"${FILESDIR}/${PN}"-6.0.2-gcc10_include.patch
"${FILESDIR}/${PN}"-6.0.2-setup.patch
"${FILESDIR}/${PN}"-6.0.2-template.patch
"${FILESDIR}/${PN}"-6.0.2-no_xmlpp.patch
"${FILESDIR}/${PN}"-5.0.11-niftiio_var_fix.patch
"${FILESDIR}/${PN}"-5.0.11-ifstream_use.patch
"${FILESDIR}/${PN}"-5.0.11-fslsurface_parallel_make.patch
"${FILESDIR}/${PN}"-6.0.2-qstring_compat.patch
"${FILESDIR}/${PN}"-5.0.9-headers.patch
"${FILESDIR}/${PN}"-6.0.2-fsldir_redux.patch
)
src_prepare(){
default
sed -i \
-e "s:@@GENTOO_RANLIB@@:$(tc-getRANLIB):" \
-e "s:@@GENTOO_CC@@:$(tc-getCC):" \
-e "s:@@GENTOO_CXX@@:$(tc-getCXX):" \
config/buildSettings.mk || die
eprefixify $(grep -rl GENTOO_PORTAGE_EPREFIX src/*) \
etc/js/label-div.html
# Disable mist-clean the hard way for now.
rm -rf src/mist-clean
makefilelist=$(find src/ -name Makefile)
sed -i \
-e "s:-I\${INC_BOOST}::" \
-e "s:-I\${INC_ZLIB}::" \
-e "s:-I\${INC_GD}::" \
-e "s:-I\${INC_PNG}::" \
-e "s:-L\${LIB_GD}::" \
-e "s:-L\${LIB_PNG}::" \
-e "s:-L\${LIB_ZLIB}::" \
${makefilelist} || die
sed -e "s:\${FSLDIR}/bin/::g" \
-e "s:\$FSLDIR/bin/::g" \
-i $(grep -rl "\${FSLDIR}/bin" src/*) \
-i $(grep -rl "\$FSLDIR/bin" src/*) \
$(grep -rl "\${FSLDIR}/bin" etc/matlab/*)\
$(grep -rl "\$FSLDIR/bin" etc/matlab/*) || die
sed -e "s:\$FSLDIR/data:${EPREFIX}/usr/share/fsl/data:g" \
-e "s:\${FSLDIR}/data:${EPREFIX}/usr/share/fsl/data:g" \
-i $(grep -rl "\$FSLDIR/data" src/*) \
$(grep -rl "\${FSLDIR}/data" src/*) || die
sed -e "s:\$FSLDIR/doc:${EPREFIX}/usr/share/fsl/doc:g" \
-e "s:\${FSLDIR}/doc:${EPREFIX}/usr/share/fsl/doc:g" \
-i $(grep -rl "\$FSLDIR/doc" src/*) \
$(grep -rl "\${FSLDIR}/doc" src/*) || die
sed -e "s:/usr/share/fsl/doc:${EPREFIX}/usr/share/fsl/doc:g" \
-i $(grep -rl "/usr/share/fsl/doc" src/*) || die
sed -e "s:\$FSLDIR/etc:${EPREFIX}/etc:g" \
-e "s:\${FSLDIR}/etc:${EPREFIX}/etc:g" \
-i $(grep -rlI "\$FSLDIR/etc" *) \
-i $(grep -rlI "\${FSLDIR}/etc" *) || die
# Use generic blas/lapack rather than openblas
sed -e "s:-lopenblas:-llapack -lblas:g" \
-i $(grep -rlI lopenblas *) || die
# script wanting to have access to flsversion at buildtime
sed -e "s:/etc/fslversion:${S}/etc/fslversion:g" \
-i ${makefilelist} || die
}
src_compile() {
export FSLDIR=${WORKDIR}/${PN}
export FSLCONDIR=${WORKDIR}/${PN}/config
export FSLMACHTYPE=generic
export USERLDFLAGS="${LDFLAGS}"
export USERCFLAGS="${CFLAGS}"
export USERCXXFLAGS="${CXXFLAGS}"
export CIFTICFLAGS="$($(tc-getPKG_CONFIG) --cflags CiftiLib)"
export CIFTILIBS="$($(tc-getPKG_CONFIG) --libs-only-l CiftiLib)"
./build || die
}
src_install() {
sed -i "s:\${FSLDIR}/tcl:/usr/libexec/fsl:g" \
$(grep -lI "\${FSLDIR}/tcl" bin/*) \
$(grep -l "\${FSLDIR}/tcl" tcl/*) || die
sed -i "s:\$FSLDIR/tcl:/usr/libexec/fsl:g" \
$(grep -l "\$FSLDIR/tcl" tcl/*) || die
dobin bin/*
insinto /usr/share/${PN}
doins -r data
dodoc -r doc/. refdoc
insinto /usr/libexec/fsl
doins -r tcl/*
insinto /etc/fslconf
doins etc/fslconf/fsl.sh
insinto /etc
doins etc/fslversion
doins -r etc/default_flobs.flobs etc/flirtsch etc/js etc/luts
#the following is needed for FSL and depending programs to be able
#to find its files, since FSL uses an uncommon installation path:
#https://github.com/gentoo-science/sci/pull/612#r60289295
dosym ../../../etc ${UPSTREAM_FSLDIR}/etc
dosym ../doc/${PF} ${UPSTREAM_FSLDIR}/doc
dosym ../../bin ${UPSTREAM_FSLDIR}/bin
doenvd "$(prefixify_ro "${FILESDIR}"/99fsl)"
mv "${ED}"/usr/bin/{,fsl_}cluster || die
}
pkg_postinst() {
echo
einfo "Please run the following commands if you"
einfo "intend to use fsl from an existing shell:"
einfo "env-update && source /etc/profile"
echo
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>sci-biology@gentoo.org</email>
<name>Gentoo Biology Project</name>
</maintainer>
<longdescription>
FSL is a comprehensive library of analysis tools for FMRI, MRI and DTI brain imaging data.
</longdescription>
</pkgmetadata>