Home | History | Annotate | Download | only in scripts
      1 #!/bin/sh
      2 
      3 downloads="$HOME/software/downloads"
      4 
      5 if [ ! -e /usr/include/tiffio.h ]; then
      6   echo "Error: could not find file tiffio.h. Please install libtiff4-dev."
      7   exit 1
      8 fi
      9 
     10 export LC_ALL=C
     11 
     12 mkdir -p "${downloads}"
     13 
     14 cd "$(dirname $0)/.."
     15 
     16 if [ -e splash2 ]; then
     17   echo "Error: a directory with the name splash2 already exists. Please"
     18   echo "remove it before running this script, or run this script in another"
     19   echo "directory."
     20   exit 1
     21 fi
     22 
     23 (
     24   cd "$downloads"
     25   if [ ! -e splash2.tar.gz ]; then
     26     wget -q http://www-flash.stanford.edu/apps/SPLASH/splash2.tar.gz
     27   fi
     28   if [ ! -e splash2-modified.patch.gz ]; then
     29     wget -q http://www.capsl.udel.edu/splash/splash2-modified.patch.gz
     30   fi
     31 )
     32 
     33 tar zxf $downloads/splash2.tar.gz
     34 cd splash2
     35 gzip -cd < "$downloads/splash2-modified.patch.gz" | patch -p1 -s
     36 patch -p1 -s <<'EOF'
     37 diff -ru orig/splash2/codes/apps/radiosity/display.C splash2/codes/apps/radiosity/display.C
     38 --- orig/splash2/codes/apps/radiosity/display.C	2008-05-25 10:38:52.000000000 +0200
     39 +++ splash2/codes/apps/radiosity/display.C	2008-05-25 10:37:51.000000000 +0200
     40 @@ -14,6 +14,7 @@
     41  /*                                                                       */
     42  /*************************************************************************/
     43  
     44 +#include <math.h>
     45  #include <stdio.h>
     46  
     47  EXTERN_ENV;
     48 --- orig/splash2/codes/apps/radiosity/Makefile	2008-05-25 10:38:52.000000000 +0200
     49 +++ splash2/codes/apps/radiosity/Makefile	2008-05-25 13:05:36.000000000 +0200
     50 @@ -15,7 +15,7 @@
     51  
     52  LOADLIBES = glibdumb/glib.a glibps/glibps.a
     53  
     54 -$(TARGET): $(OBJS)
     55 +$(TARGET): $(OBJS) $(LOADLIBES)
     56  	$(CC) $(OBJS) $(CFLAGS) $(LOADLIBES) -o $(TARGET) $(LDFLAGS)
     57  
     58  radiosity.h: patch.h model.h parallel.h task.h
     59 @@ -29,3 +29,7 @@
     60  visible.c: visible.C $(HS)
     61  rad_tools.c: rad_tools.C $(HS)
     62  room_model.c: room_model.C $(HS)
     63 +glibdumb/glib.a:
     64 +	make -C glibdumb glib.a
     65 +glibps/glibps.a:
     66 +	make -C glibps glibps.a
     67 diff -ru orig/splash2/codes/apps/raytrace/rltotiff/Makefile splash2/codes/apps/raytrace/rltotiff/Makefile
     68 --- orig/splash2/codes/apps/raytrace/rltotiff/Makefile	2008-05-25 10:38:52.000000000 +0200
     69 +++ splash2/codes/apps/raytrace/rltotiff/Makefile	2008-05-25 10:31:57.000000000 +0200
     70 @@ -4,6 +4,3 @@
     71  include ../../../Makefile.config
     72  
     73  LDFLAGS := $(LDFLAGS) -ltiff
     74 -
     75 -clean:
     76 -	rm -rf $(OBJS) $(TARGET)
     77 EOF
     78 
     79 
     80 patch -p1 -s <<EOF
     81 diff -ru orig/splash2/codes/Makefile.config splash2/codes/Makefile.config
     82 --- orig/splash2/codes/Makefile.config	2008-05-25 10:38:52.000000000 +0200
     83 +++ splash2/codes/Makefile.config	2008-05-25 10:14:25.000000000 +0200
     84 @@ -1,5 +1,5 @@
     85 -CC := gcc
     86 +CC := @CC@
     87 -CFLAGS := -O3 -pthread -D_POSIX_C_SOURCE=200112
     88 +CFLAGS := -g3 -m32 -O3 -pthread -D_POSIX_C_SOURCE=200112
     89  #CFLAGS := -g3 -pthread -D_POSIX_C_SOURCE=200112
     90  CFLAGS := \$(CFLAGS) -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wdisabled-optimization
     91  CFLAGS := \$(CFLAGS) -Wpadded -Winline -Wpointer-arith -Wsign-compare -Wendif-labels
     92 @@ -5,8 +5,8 @@
     93  CFLAGS := \$(CFLAGS) -Wpadded -Winline -Wpointer-arith -Wsign-compare -Wendif-labels
     94  LDFLAGS := -lm
     95  
     96 -BASEDIR := \$(HOME)/splash2/codes
     97 -MACROS := \$(BASEDIR)/null_macros/c.m4.null
     98 +BASEDIR := ${PWD}/codes
     99 +MACROS := \$(BASEDIR)/null_macros/c.m4.null.POSIX_BARRIER
    100  M4 := m4 -s -Ulen -Uindex
    101  
    102  x = *
    103 --- orig/splash2/codes/apps/radiosity/elemman.C	2008-07-13 20:24:35.000000000 +0200
    104 +++ splash2/codes/apps/radiosity/elemman.C	2008-07-13 20:45:15.000000000 +0200
    105 @@ -24,6 +24,7 @@
    106  
    107  
    108  #include <stdio.h>
    109 +#include "drd.h"
    110  
    111  EXTERN_ENV;
    112  
    113 @@ -707,6 +708,12 @@ void process_rays(Element *e, long proce
    114      e->n_interactions = 0 ;
    115      UNLOCK(e->elem_lock->lock);
    116  
    117 +    {
    118 +      Interaction* p;
    119 +      for (p = i_list; p; p = p->next)
    120 +	DRD_IGNORE_VAR(*p);
    121 +    }
    122 +
    123      /* For each interaction, do BF-error-analysis */
    124      bf_error_analysis_list( e, i_list, process_id ) ;
    125  
    126 --- orig/splash2/codes/apps/radiosity/rad_main.C	2008-07-13 20:24:35.000000000 +0200
    127 +++ splash2/codes/apps/radiosity/rad_main.C	2008-07-13 20:50:01.000000000 +0200
    128 @@ -30,6 +30,7 @@
    129  #include <panel.h>
    130  #endif
    131  #endif
    132 +#include "drd.h"
    133  
    134  /* ANL macro initialization */
    135  
    136 @@ -1084,6 +1085,18 @@ void init_global(long process_id)
    137      /* Initialize statistical info */
    138      init_stat_info(process_id) ;
    139  
    140 +    {
    141 +      int i;
    142 +
    143 +      DRD_IGNORE_VAR(global->pbar_count);
    144 +      for (i = 0;
    145 +	   i < sizeof(global->task_queue) / sizeof(global->task_queue[0]);
    146 +	   i++)
    147 +	{
    148 +	  DRD_IGNORE_VAR(global->task_queue[i].n_tasks);
    149 +	}
    150 +      DRD_IGNORE_VAR(global->element_buf);
    151 +    }
    152  }
    153  
    154  
    155 --- orig/splash2/codes/apps/radiosity/Makefile	2008-07-13 20:24:35.000000000 +0200
    156 +++ splash2/codes/apps/radiosity/Makefile	2008-07-13 20:09:27.000000000 +0200
    157 @@ -6,7 +6,7 @@ HS = model.h parallel.h patch.h radiosit
    158  
    159  include ../../Makefile.config
    160  
    161 -CFLAGS := \$(CFLAGS) -I./glibdumb -I./glibps
    162 +CFLAGS := \$(CFLAGS) -I./glibdumb -I./glibps -I../../../../../drd -I../../../../../include
    163  
    164  #CCOPTS = -I -float -I/usr/include \$(CFLAGS)
    165  #LDFLAGS = -lm -lpthread
    166 EOF
    167 
    168 for m in $(find codes -name Makefile)
    169 do
    170   echo "==== $m ===="
    171   make -s -C $(dirname $m)
    172 done
    173