commit:     1c4f022505e83357adc3fbab929ea55396aee27d
Author:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 18 10:47:25 2021 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sun Jul 18 10:47:25 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=1c4f0225

sci-biology/fsl: add version 6.0.4

Closes: https://github.com/gentoo/sci/pull/1074
Co-authored-by: Paul Polak <paul.polak <AT> med-image.info>
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>

 .../fsl/files/fsl-6.0.4-cuda_buildsettings.patch   |  12 +
 sci-biology/fsl/files/fsl-6.0.4-eddy_cuda.patch    |  21 ++
 sci-biology/fsl/files/fsl-6.0.4-fdt_cuda.patch     |  14 +
 sci-biology/fsl/files/fsl-6.0.4-flameo_std.patch   |  11 +
 .../fsl/files/fsl-6.0.4-fsldir_redux-p1.patch      | 240 ++++++++++++++
 .../fsl/files/fsl-6.0.4-fsldir_redux-p2.patch      | 254 +++++++++++++++
 .../fsl/files/fsl-6.0.4-gcc10_include.patch        |  11 +
 sci-biology/fsl/files/fsl-6.0.4-melodic_std.patch  |  11 +
 .../fsl-6.0.4-remove_fslpy_collisions-p1.patch     | 303 ++++++++++++++++++
 .../fsl-6.0.4-remove_fslpy_collisions-p2.patch     | 348 +++++++++++++++++++++
 sci-biology/fsl/files/fsl-6.0.4-setup.patch        | 174 +++++++++++
 sci-biology/fsl/fsl-6.0.2-r1.ebuild                |   4 +-
 sci-biology/fsl/fsl-6.0.2.ebuild                   |   6 +-
 .../fsl/{fsl-6.0.2-r1.ebuild => fsl-6.0.4.ebuild}  |  36 ++-
 14 files changed, 1429 insertions(+), 16 deletions(-)

diff --git a/sci-biology/fsl/files/fsl-6.0.4-cuda_buildsettings.patch 
b/sci-biology/fsl/files/fsl-6.0.4-cuda_buildsettings.patch
new file mode 100644
index 000000000..749e80623
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-cuda_buildsettings.patch
@@ -0,0 +1,12 @@
+diff -Naur fsl.orig/config/buildSettings.mk fsl/config/buildSettings.mk
+--- fsl.orig/config/buildSettings.mk   2020-12-02 16:22:57.999912865 -0500
++++ fsl/config/buildSettings.mk        2020-12-02 16:24:15.332915270 -0500
+@@ -144,7 +144,7 @@
+ # CUDA development environment
+ CUDAVER := $(or $(CUDAVER),9.1)
+ #$(info $$CUDAVER is [${CUDAVER}])
+-CUDA_INSTALLATION = /opt/cuda-${CUDAVER}
++CUDA_INSTALLATION = /opt/cuda
+ ifdef SINGULARITY_NAME
+ CUDA_INSTALLATION = /usr/local/cuda-${CUDAVER}
+ endif

diff --git a/sci-biology/fsl/files/fsl-6.0.4-eddy_cuda.patch 
b/sci-biology/fsl/files/fsl-6.0.4-eddy_cuda.patch
new file mode 100644
index 000000000..ad118c39a
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-eddy_cuda.patch
@@ -0,0 +1,21 @@
+diff -Naur fsl.orig/src/eddy/Makefile fsl/src/eddy/Makefile
+--- fsl.orig/src/eddy/Makefile 2020-12-02 16:07:47.327884548 -0500
++++ fsl/src/eddy/Makefile      2020-12-02 16:11:21.149891196 -0500
+@@ -29,6 +29,8 @@
+ TMPCXXFLAGS_2=
+ TMPNAME_1=
+ TMPNAME_2=
++cuda=1
++cpu=1
+ TOPUP_DIR=../topup
+ 
+ ifndef cuda
+@@ -74,7 +75,7 @@
+ ifdef NVCC11
+       NVCC=${NVCC11}
+ endif
+-NVCCFLAGS=-c -DCOMPILE_GPU -O3 -m 64 -std=c++11
++NVCCFLAGS=-c -DCOMPILE_GPU -O3 -m 64 -std=c++11 @@GENTOO_NVCC_FLAGS@@
+ ifeq ($(CLOBBER_CLANG),1)
+    NVCCFLAGS+= -DCLOBBER_CLANG
+ endif

diff --git a/sci-biology/fsl/files/fsl-6.0.4-fdt_cuda.patch 
b/sci-biology/fsl/files/fsl-6.0.4-fdt_cuda.patch
new file mode 100644
index 000000000..7f322027b
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-fdt_cuda.patch
@@ -0,0 +1,14 @@
+diff -Naur fsl.orig/src/fdt/Makefile fsl/src/fdt/Makefile
+--- fsl.orig/src/fdt/Makefile  2020-12-02 19:06:55.826218772 -0500
++++ fsl/src/fdt/Makefile       2020-12-02 19:08:02.883220858 -0500
+@@ -6,7 +6,9 @@
+      $(eval $($(PROJNAME)_MASTERBUILD))
+ endif
+ 
+-ifeq ($(COMPILE_GPU), 1)
++# disable CUDA support for fdt
++#ifeq ($(COMPILE_GPU), 1)
++ifeq (0, 1)
+       COMPILE_WITH_GPU=libbedpostx_cuda.so merge_parts_gpu xfibres_gpu 
CUDA/split_parts_gpu
+       SCRIPTS_GPU=CUDA/bedpostx_gpu CUDA/bedpostx_postproc_gpu.sh
+ endif

diff --git a/sci-biology/fsl/files/fsl-6.0.4-flameo_std.patch 
b/sci-biology/fsl/files/fsl-6.0.4-flameo_std.patch
new file mode 100644
index 000000000..a991f1ed3
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-flameo_std.patch
@@ -0,0 +1,11 @@
+diff -Naur fsl.orig/src/flameo/Makefile fsl/src/flameo/Makefile
+--- fsl.orig/src/flameo/Makefile       2021-01-06 14:04:35.728274475 -0500
++++ fsl/src/flameo/Makefile    2021-01-06 14:08:18.204269285 -0500
+@@ -4,6 +4,7 @@
+ 
+ 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
+ USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_ZLIB}
++USRCXXFLAGS = -std=c++11
+ 
+ UNAME := $(shell uname)
+ ifeq (${UNAME},Darwin)

diff --git a/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p1.patch 
b/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p1.patch
new file mode 100644
index 000000000..ca3945442
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p1.patch
@@ -0,0 +1,240 @@
+From 2bc4be1f55b27a733e1e624b34bc570187ba95e1 Mon Sep 17 00:00:00 2001
+From: François Bissey <[email protected]>
+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/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p2.patch 
b/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p2.patch
new file mode 100644
index 000000000..af498b400
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-fsldir_redux-p2.patch
@@ -0,0 +1,254 @@
+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 -Naur fsl.orig/src/siena/siena_diff.cc fsl/src/siena/siena_diff.cc
+--- fsl.orig/src/siena/siena_diff.cc   2020-12-02 15:52:50.359856656 -0500
++++ fsl/src/siena/siena_diff.cc        2020-12-02 16:03:25.699876412 -0500
+@@ -107,7 +107,7 @@
+ {
+   // {{{  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 @@
+ 
+ string argv1(argv[1]), argv2(argv[2]);
+ 
+-sprintf(fsldir,"%s",getenv("FSLDIR"));
+-
+ for (i = 3; i < argc; i++)
+   {
+     if (!strcmp(argv[i], "-i"))
+@@ -206,26 +204,26 @@
+ // }}}
+   // {{{  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);
+ }
+ 
+@@ -284,8 +282,8 @@
+     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
+

diff --git a/sci-biology/fsl/files/fsl-6.0.4-gcc10_include.patch 
b/sci-biology/fsl/files/fsl-6.0.4-gcc10_include.patch
new file mode 100644
index 000000000..ae836c065
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-gcc10_include.patch
@@ -0,0 +1,11 @@
+diff -Naur fsl.orig/src/newimage/newimageio.h fsl/src/newimage/newimageio.h
+--- fsl.orig/src/newimage/newimageio.h 2020-12-02 15:15:27.012786899 -0500
++++ fsl/src/newimage/newimageio.h      2020-12-02 15:19:51.046795110 -0500
+@@ -75,6 +75,7 @@
+ #include <iostream>
+ #include <fstream>
+ #include <sstream>
++#include <stdexcept>
+ #include "NewNifti/NewNifti.h"
+ #include "newmatio.h"
+ #include "newimage.h"

diff --git a/sci-biology/fsl/files/fsl-6.0.4-melodic_std.patch 
b/sci-biology/fsl/files/fsl-6.0.4-melodic_std.patch
new file mode 100644
index 000000000..83b5b9932
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-melodic_std.patch
@@ -0,0 +1,11 @@
+diff -Naur fsl.orig/src/melodic/Makefile fsl/src/melodic/Makefile
+--- fsl.orig/src/melodic/Makefile      2021-01-06 14:04:35.743274475 -0500
++++ fsl/src/melodic/Makefile   2021-01-06 14:11:27.924264859 -0500
+@@ -9,6 +9,7 @@
+ 
+ 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
+ USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_GD} -L${LIB_GDC} 
-L${LIB_PNG} -L${LIB_ZLIB}
++USRCXXFLAGS = -std=c++11
+ 
+ UNAME := $(shell uname)
+ ifeq (${UNAME},Darwin)

diff --git a/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p1.patch 
b/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p1.patch
new file mode 100644
index 000000000..434dc9cf6
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p1.patch
@@ -0,0 +1,303 @@
+diff -Naur fsl.orig/src/fslio/imln fsl/src/fslio/imln
+--- fsl.orig/src/fslio/imln    2021-02-01 15:29:34.842752994 -0500
++++ fsl/src/fslio/imln 1969-12-31 19:00:00.000000000 -0500
+@@ -1,90 +0,0 @@
+-#!/bin/sh
+-
+-#   imln - make symbolic link(s) to image file(s)
+-#
+-#   Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
+-#
+-#   Copyright (C) 1999-2004 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-
+-if [ $# -lt 2 ] ; then
+-  echo "Usage: $0 <file1> <file2>"
+-  echo "  Makes a link (called file2) to file1"
+-  echo "  NB: filenames can be basenames or include an extension"
+-  exit 1;
+-fi
+-
+-f1=`${FSLDIR}/bin/remove_ext $1`;
+-f2=`${FSLDIR}/bin/remove_ext $2`;
+-
+-if [ -f ${f1}.hdr ] ; then ln -fs ${f1}.hdr ${f2}.hdr ; fi
+-if [ -f ${f1}.hdr.gz ] ; then ln -fs ${f1}.hdr.gz ${f2}.hdr.gz ; fi 
+-if [ -f ${f1}.img ] ; then ln -fs ${f1}.img ${f2}.img ; fi 
+-if [ -f ${f1}.img.gz ] ; then ln -fs ${f1}.img.gz ${f2}.img.gz ; fi 
+-if [ -f ${f1}.nii ] ; then ln -fs ${f1}.nii ${f2}.nii ; fi 
+-if [ -f ${f1}.nii.gz ] ; then ln -fs ${f1}.nii.gz ${f2}.nii.gz ; fi 
+-if [ -f ${f1}.mnc ] ; then ln -fs ${f1}.mnc ${f2}.mnc ; fi 
+-if [ -f ${f1}.mnc.gz ] ; then ln -fs ${f1}.mnc.gz ${f2}.mnc.gz ; fi 
+-
+diff -Naur fsl.orig/src/fslio/imrm fsl/src/fslio/imrm
+--- fsl.orig/src/fslio/imrm    2021-02-01 15:29:34.842752994 -0500
++++ fsl/src/fslio/imrm 1969-12-31 19:00:00.000000000 -0500
+@@ -1,83 +0,0 @@
+-#!/bin/sh
+-
+-#   imrm - remove image files
+-#
+-#   Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
+-#
+-#   Copyright (C) 1999-2004 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-
+-if [ $# -lt 1 ] ; then
+-  echo "Usage: $0 <list of image names to remove>"
+-  echo "NB: filenames can be basenames or not"
+-  exit 1;
+-fi
+-
+-for f in $@ ; do
+-  fn=`${FSLDIR}/bin/remove_ext $f`;
+-  # do the rm silently
+-  /bin/rm -f ${fn}.img ${fn}.hdr ${fn}.hdr.gz ${fn}.img.gz ${fn}.nii 
${fn}.nii.gz ${fn}.mnc ${fn}.mnc.gz
+-done
+-
+diff -Naur fsl.orig/src/fslio/imtest fsl/src/fslio/imtest
+--- fsl.orig/src/fslio/imtest  2021-02-01 15:29:34.842752994 -0500
++++ fsl/src/fslio/imtest       1969-12-31 19:00:00.000000000 -0500
+@@ -1,118 +0,0 @@
+-#!/bin/sh
+-
+-#   imtest - test to see if a valid image file exists with this name (root)
+-#
+-#   Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
+-#
+-#   Copyright (C) 1999-2004 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-
+-# return 0 if no image exists or 1 if the image exists
+-
+-if [ $# -lt 1 ] ; then
+- echo "0";
+- exit;
+-fi
+-
+-inputfile=$1
+-
+-
+-
+-for i in 1 2 3 4 5 6 7 8 9 10 11 12
+-do
+-if [ -h $inputfile ] ; then 
+-inputfile=`readlink $inputfile`;
+-fi
+-done
+-
+-filename=`${FSLDIR}/bin/remove_ext $inputfile`;
+-
+-if [ -r ${filename}.nii ] || [ -r ${filename}.nii.gz ] ; then
+-  echo "1";
+-  exit;
+-fi
+-
+-if [ -r ${filename}.mnc ] || [ -r ${filename}.mnc.gz ] ; then
+-  echo "1";
+-  exit;
+-fi
+-
+-if [ ! -r ${filename}.hdr ] && [ ! -r ${filename}.hdr.gz ] ; then
+-  # return 0 here as no header exists and no single image means no image!
+-  echo "0";
+-  exit;
+-fi
+-
+-if [ ! -r ${filename}.img ] && [ ! -r ${filename}.img.gz ] ; then
+-  # return 0 here as no img file exists and no single image means no image!
+-  echo "0";
+-  exit;
+-fi
+-
+-# only gets to here if there was a hdr and an img file
+-
+-echo "1";
+-exit;
+-

diff --git a/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p2.patch 
b/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p2.patch
new file mode 100644
index 000000000..ddb7cfb67
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-remove_fslpy_collisions-p2.patch
@@ -0,0 +1,348 @@
+diff -Naur fsl.orig/src/fslio/Makefile fsl/src/fslio/Makefile
+--- fsl.orig/src/fslio/Makefile        2021-02-01 15:29:34.842752994 -0500
++++ fsl/src/fslio/Makefile     2021-02-01 15:32:19.723761859 -0500
+@@ -6,7 +6,7 @@
+ 
+ OBJS=fslio.o
+ 
+-SCRIPTS = remove_ext fsloutputtype imtest imglob imcp imln imrm immv
++SCRIPTS = fsloutputtype imglob imcp immv
+ 
+ all: 
+ 
+diff -Naur fsl.orig/src/fslio/remove_ext fsl/src/fslio/remove_ext
+--- fsl.orig/src/fslio/remove_ext      2021-02-01 15:29:34.842752994 -0500
++++ fsl/src/fslio/remove_ext   1969-12-31 19:00:00.000000000 -0500
+@@ -1,87 +0,0 @@
+-#!/bin/sh
+-
+-#   remove_ext - remove extension from image filename
+-#
+-#   Stephen Smith and Mark Jenkinson, FMRIB Image Analysis Group
+-#
+-#   Copyright (C) 1999-2004 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-
+-
+-if [ $# -lt 1 ] ; then
+-  exit 1
+-fi
+-
+-lst="";
+-for fn in $@ ; do
+-    # for the ones at the end of the line
+-  f=`echo "$fn" | sed 's/\.hdr\.gz$//' | sed 's/\.img\.gz$//' | sed 
's/\.hdr$//' | sed 's/\.img$//' | sed 's/\.nii.gz$//' | sed 's/\.nii$//' | sed 
's/\.mnc.gz$//' | sed 's/\.mnc$//' | sed 's/\.$//'`;
+-    # for the ones in the middle of the line
+-  f=`echo "$f" | sed 's/\.hdr\.gz[    ]/ /g' | sed 's/\.img\.gz[      ]/ /g' 
| sed 's/\.hdr[  ]/ /g' | sed 's/\.img[  ]/ /g' | sed 's/\.nii\.gz[      ]/ /g' 
| sed 's/\.nii[  ]/ /g' | sed 's/\.mnc\.gz[      ]/ /g' | sed 's/\.mnc[  ]/ /g' 
|sed 's/\.[      ]/ /g'`;
+-  lst="$lst $f";
+-done
+-echo $lst;
+-
+-
+diff -Naur fsl.orig/src/misc_scripts/fsl_abspath 
fsl/src/misc_scripts/fsl_abspath
+--- fsl.orig/src/misc_scripts/fsl_abspath      2021-02-01 15:29:34.828752994 
-0500
++++ fsl/src/misc_scripts/fsl_abspath   1969-12-31 19:00:00.000000000 -0500
+@@ -1,71 +0,0 @@
+-#!/usr/bin/env fslpython
+-#   fsl_abspath - return true file path
+-#   Matthew Webster FMRIB Image Analysis Group
+-#   Copyright (C) 2009 University of Oxford 
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-from __future__ import print_function
+-import sys
+-import os
+-
+-print (os.path.realpath(sys.argv[1]))
+-sys.exit(0)
+diff -Naur fsl.orig/src/misc_scripts/Makefile fsl/src/misc_scripts/Makefile
+--- fsl.orig/src/misc_scripts/Makefile 2021-02-01 15:29:34.828752994 -0500
++++ fsl/src/misc_scripts/Makefile      2021-02-01 15:32:56.027763811 -0500
+@@ -2,6 +2,6 @@
+ 
+ PROJNAME = misc_scripts
+ 
+-SCRIPTS = fslecho regscript remove_vols replace_and_average_fmrib linkbedpost 
ocmr_preproc correct_and_average eddy_correct Text2Vest Vest2Text 
AnatomicalAverage fsl_abspath fsl_anat fslFixText
++SCRIPTS = fslecho regscript remove_vols replace_and_average_fmrib linkbedpost 
ocmr_preproc correct_and_average eddy_correct AnatomicalAverage fsl_anat 
fslFixText
+ 
+ all:
+diff -Naur fsl.orig/src/misc_scripts/Text2Vest fsl/src/misc_scripts/Text2Vest
+--- fsl.orig/src/misc_scripts/Text2Vest        2021-02-01 15:29:34.828752994 
-0500
++++ fsl/src/misc_scripts/Text2Vest     1969-12-31 19:00:00.000000000 -0500
+@@ -1,80 +0,0 @@
+-#!/bin/sh
+-#   Copyright (C) 2012 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-if [ $# -lt 2 ] ; then 
+-  echo "`basename $0` <text file> <vest file>"
+-  exit 0
+-fi
+-
+-NumPoints=`grep -cve '^\s*$' $1`
+-NumWaves=`wc $1 | awk '{ print $2 }'`
+-NumWaves=`expr $NumWaves / $NumPoints`
+-
+-echo /NumWaves $NumWaves    > $2
+-echo /NumPoints $NumPoints >> $2
+-echo /Matrix               >> $2
+-
+-cat $1 >> $2
+-
+diff -Naur fsl.orig/src/misc_scripts/Vest2Text fsl/src/misc_scripts/Vest2Text
+--- fsl.orig/src/misc_scripts/Vest2Text        2021-02-01 15:29:34.828752994 
-0500
++++ fsl/src/misc_scripts/Vest2Text     1969-12-31 19:00:00.000000000 -0500
+@@ -1,71 +0,0 @@
+-#!/bin/sh
+-#   Copyright (C) 2012 University of Oxford
+-#
+-#   Part of FSL - FMRIB's Software Library
+-#   http://www.fmrib.ox.ac.uk/fsl
+-#   [email protected]
+-#
+-#   Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
+-#   Imaging of the Brain), Department of Clinical Neurology, Oxford
+-#   University, Oxford, UK
+-#
+-#
+-#   LICENCE
+-#
+-#   FMRIB Software Library, Release 6.0 (c) 2018, The University of
+-#   Oxford (the "Software")
+-#
+-#   The Software remains the property of the Oxford University Innovation
+-#   ("the University").
+-#
+-#   The Software is distributed "AS IS" under this Licence solely for
+-#   non-commercial use in the hope that it will be useful, but in order
+-#   that the University as a charitable foundation protects its assets for
+-#   the benefit of its educational and research purposes, the University
+-#   makes clear that no condition is made or to be implied, nor is any
+-#   warranty given or to be implied, as to the accuracy of the Software,
+-#   or that it will be suitable for any particular purpose or for use
+-#   under any specific conditions. Furthermore, the University disclaims
+-#   all responsibility for the use which is made of the Software. It
+-#   further disclaims any liability for the outcomes arising from using
+-#   the Software.
+-#
+-#   The Licensee agrees to indemnify the University and hold the
+-#   University harmless from and against any and all claims, damages and
+-#   liabilities asserted by third parties (including claims for
+-#   negligence) which arise directly or indirectly from the use of the
+-#   Software or the sale of any products based on the Software.
+-#
+-#   No part of the Software may be reproduced, modified, transmitted or
+-#   transferred in any form or by any means, electronic or mechanical,
+-#   without the express permission of the University. The permission of
+-#   the University is not required if the said reproduction, modification,
+-#   transmission or transference is done without financial return, the
+-#   conditions of this Licence are imposed upon the receiver of the
+-#   product, and all original and amended source code is included in any
+-#   transmitted product. You may be held legally responsible for any
+-#   copyright infringement that is caused or encouraged by your failure to
+-#   abide by these terms and conditions.
+-#
+-#   You are not permitted under this Licence to use this Software
+-#   commercially. Use for which any financial return is received shall be
+-#   defined as commercial use, and includes (1) integration of all or part
+-#   of the source code or the Software into a product for sale or license
+-#   by or on behalf of Licensee to third parties or (2) use of the
+-#   Software or any derivative of it for research with the final aim of
+-#   developing software products for sale or license to a third party or
+-#   (3) use of the Software or any derivative of it for research with the
+-#   final aim of developing non-software products for sale or license to a
+-#   third party, or (4) use of the Software to provide any service to an
+-#   external organisation for which payment is received. If you are
+-#   interested in using the Software commercially, please contact Oxford
+-#   University Innovation ("OUI"), the technology transfer company of the
+-#   University, to negotiate a licence. Contact details are:
+-#   [email protected] quoting Reference Project 9564, FSL.
+-export LC_ALL=C
+-if [ $# -lt 2 ] ; then 
+-  echo "`basename $0` <vest file> <text file>"
+-  exit 0
+-fi
+-sed -e "/\//d" $1 | sed '/^$/d' > $2
+-

diff --git a/sci-biology/fsl/files/fsl-6.0.4-setup.patch 
b/sci-biology/fsl/files/fsl-6.0.4-setup.patch
new file mode 100644
index 000000000..061e1a22a
--- /dev/null
+++ b/sci-biology/fsl/files/fsl-6.0.4-setup.patch
@@ -0,0 +1,174 @@
+diff -Naur fsl.orig/build fsl/build
+--- fsl.orig/build     2020-12-02 15:29:12.180812558 -0500
++++ fsl/build  2020-12-02 15:34:03.854821628 -0500
+@@ -28,7 +28,6 @@
+     # The build order for MASTERLIBS is very important, and should not be 
modified unless you know what
+     # you are doing. 
+     MASTERLIBS="
+-    CiftiLib-master \
+     utils \
+     znzlib \
+     NewNifti \
+@@ -157,8 +156,8 @@
+     done #project (MASTERPROJECTS)
+ fi #full build
+ 
+-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 -Naur fsl.orig/config/buildSettings.mk fsl/config/buildSettings.mk
+--- fsl.orig/config/buildSettings.mk   2020-12-02 15:29:11.993812552 -0500
++++ fsl/config/buildSettings.mk        2020-12-02 15:39:37.269831995 -0500
+@@ -18,7 +18,7 @@
+ CHMOD = /bin/chmod
+ MKDIR = /bin/mkdir
+ INSTALL = install -p
+-TCLSH = ${FSLDIR}/bin/fsltclsh
++TCLSH = tclsh
+ DEPENDFLAGS = -MM
+ MACHDBGFLAGS = -g
+ #####################################################################
+@@ -127,19 +127,19 @@
+ #####################################################################
+ 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)
+@@ -158,8 +158,8 @@
+ NVCC = ${CUDA_INSTALLATION}/bin/nvcc
+ ###############   External Libs   #####################################
+ # ZLIB library
+-LIB_ZLIB = ${FSLEXTLIB}
+-INC_ZLIB = ${FSLEXTINC}
++#LIB_ZLIB = ${FSLEXTLIB}
++#INC_ZLIB = ${FSLEXTINC}
+ # QT library
+ QTDIR = /usr/lib/qt3
+ LIB_QT = ${QTDIR}/lib
+diff -Naur fsl.orig/config/common/buildproj fsl/config/common/buildproj
+--- fsl.orig/config/common/buildproj   2020-12-02 15:29:11.993812552 -0500
++++ fsl/config/common/buildproj        2020-12-02 15:41:25.579835363 -0500
+@@ -11,10 +11,10 @@
+ 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 @@
+         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 @@
+           if [ $installok = false ]  ; then
+             echo " "
+             echo "ERROR::Could not install $projname successfully" ;
++          exit 1
+           fi
+         else
+           echo " "
+@@ -90,6 +91,7 @@
+           echo " "
+           echo " "
+           errorprojs="$errorprojs $projname" ; export errorprojs ;
++        exit 1
+         fi
+     fi
+ done
+diff -Naur fsl.orig/config/common/vars.mk fsl/config/common/vars.mk
+--- fsl.orig/config/common/vars.mk     2020-12-02 15:29:11.993812552 -0500
++++ fsl/config/common/vars.mk  2020-12-02 15:43:00.602838318 -0500
+@@ -24,15 +24,15 @@
+ 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 -Naur fsl.orig/extras/build fsl/extras/build
+--- fsl.orig/extras/build      2020-12-02 15:29:12.404812565 -0500
++++ fsl/extras/build   2020-12-02 15:44:06.906840380 -0500
+@@ -96,16 +96,16 @@
+       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 -Naur fsl.orig/src/mist/Makefile fsl/src/mist/Makefile
+--- fsl.orig/src/mist/Makefile 2020-12-02 15:29:12.875812580 -0500
++++ fsl/src/mist/Makefile      2020-12-02 15:45:09.805842335 -0500
+@@ -52,6 +52,8 @@
+               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

diff --git a/sci-biology/fsl/fsl-6.0.2-r1.ebuild 
b/sci-biology/fsl/fsl-6.0.2-r1.ebuild
index 71314a8f8..ae12098ec 100644
--- a/sci-biology/fsl/fsl-6.0.2-r1.ebuild
+++ b/sci-biology/fsl/fsl-6.0.2-r1.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 inherit cuda 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";
+HOMEPAGE="https://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"
@@ -16,7 +16,7 @@ IUSE="cuda"
 
 DEPEND="
        dev-libs/boost
-       dev-python/fslpy
+       <dev-python/fslpy-3
        media-gfx/graphviz
        media-libs/gd
        media-libs/glu

diff --git a/sci-biology/fsl/fsl-6.0.2.ebuild b/sci-biology/fsl/fsl-6.0.2.ebuild
index 8a7e0eebb..f490b6e7c 100644
--- a/sci-biology/fsl/fsl-6.0.2.ebuild
+++ b/sci-biology/fsl/fsl-6.0.2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -6,7 +6,7 @@ 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";
+HOMEPAGE="https://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"
@@ -16,7 +16,7 @@ IUSE=""
 
 DEPEND="
        dev-libs/boost
-       dev-python/fslpy
+       <dev-python/fslpy-3
        media-gfx/graphviz
        media-libs/gd
        media-libs/glu

diff --git a/sci-biology/fsl/fsl-6.0.2-r1.ebuild 
b/sci-biology/fsl/fsl-6.0.4.ebuild
similarity index 83%
copy from sci-biology/fsl/fsl-6.0.2-r1.ebuild
copy to sci-biology/fsl/fsl-6.0.4.ebuild
index 71314a8f8..e0feb82d9 100644
--- a/sci-biology/fsl/fsl-6.0.2-r1.ebuild
+++ b/sci-biology/fsl/fsl-6.0.4.ebuild
@@ -6,7 +6,7 @@ EAPI=7
 inherit cuda 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";
+HOMEPAGE="https://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"
@@ -16,7 +16,7 @@ IUSE="cuda"
 
 DEPEND="
        dev-libs/boost
-       dev-python/fslpy
+       >=dev-python/fslpy-3
        media-gfx/graphviz
        media-libs/gd
        media-libs/glu
@@ -42,8 +42,8 @@ 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}/${P}"-gcc10_include.patch
+       "${FILESDIR}/${P}"-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
@@ -51,8 +51,13 @@ PATCHES=(
        "${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-p1.patch
-       "${FILESDIR}/${PN}"-6.0.2-fsldir_redux-p2.patch
+       "${FILESDIR}/${P}"-fsldir_redux-p1.patch
+       "${FILESDIR}/${P}"-fsldir_redux-p2.patch
+       "${FILESDIR}/${P}"-flameo_std.patch
+       "${FILESDIR}/${P}"-melodic_std.patch
+       "${FILESDIR}/${P}"-remove_fslpy_collisions-p1.patch
+       "${FILESDIR}/${P}"-remove_fslpy_collisions-p2.patch
+       "${FILESDIR}/${P}"-fdt_cuda.patch
 )
 
 src_prepare() {
@@ -67,8 +72,11 @@ src_prepare() {
        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
+       # Disable mist the hard way for now.
+       rm -r src/mist || die
+
+       # Disable ptx2 for now
+       rm -r src/ptx2 || die
 
        makefilelist=$(find src/ -name Makefile)
 
@@ -111,7 +119,7 @@ src_prepare() {
        sed -e "s:-lopenblas:-llapack -lblas:g" \
                -i $(grep -rlI lopenblas *) || die
 
-       # script wanting to have access to flsversion at buildtime
+       # script wanting to have access to fslversion at buildtime
        sed -e "s:/etc/fslversion:${S}/etc/fslversion:g" \
                -i ${makefilelist} || die
 
@@ -129,8 +137,8 @@ src_prepare() {
                CUDA_INSTALLATION="/opt/cuda"
                CUDAVER=`cuda_toolkit_version`
 
-               eapply "${FILESDIR}/${PN}-6.0.2-eddy_cuda.patch"
-               eapply "${FILESDIR}/${PN}-6.0.2-cuda_buildsettings.patch"
+               eapply "${FILESDIR}/${P}-eddy_cuda.patch"
+               eapply "${FILESDIR}/${P}-cuda_buildsettings.patch"
 
                sed -i \
                        -e "s:@@GENTOO_NVCC_FLAGS@@:${cuda_NVCC_flags}:" \
@@ -145,8 +153,14 @@ src_compile() {
        export FSLCONDIR=${WORKDIR}/${PN}/config
        export FSLMACHTYPE=generic
 
+       # define the default build system to match upstream official standard
+       #  -> individual projects may overwrite the '-std=' flag
+       export ANSI_CFLAGS="-std=c99"
+       export ANSI_CXXFLAGS="-std=c++98"
+
        export USERLDFLAGS="${LDFLAGS}"
        export USERCFLAGS="${CFLAGS}"
+       export USERCPPFLAGS="${CPPFLAGS}"
        export USERCXXFLAGS="${CXXFLAGS}"
 
        export CIFTICFLAGS="$($(tc-getPKG_CONFIG) --cflags CiftiLib)"

Reply via email to