aboutsummaryrefslogtreecommitdiff
path: root/pkg/ecl/mkdist
blob: 9abbe37584e7ff7f11db62b682b2404800c385e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/csh -f
#
# Build the ECL self-installer distribution
#
###############################################################################


if ((! $?iraf) || (! $?IRAFARCH)) then
    echo -n "ERROR: "
    echo    "Must define 'iraf' and 'IRAFARCH' before building!!"
    echo    "Quitting."
    exit 1
endif


# Process command line arguments.
set	exec	= yes
set src_only	= no

while ("$1" != "")
    switch ("$1")
    case -n:                            # no execute
        set exec = no
        breaksw
    case -src:                          # source-only distribution
        set src_only = yes
        breaksw
    default:
	echo "mkdist: unknown argument $1"
	breaksw
    endsw

    if ("$2" == "") then
        break
    else
        shift
    endif
end


# Do it.
echo "Removing old binaries ...."
  if ($exec == "yes" && $src_only == "no") then
    rmbin .
  endif 
	
echo "Rebuilding ECL ...."
  if ($exec == "yes" && $src_only == "no") then
    mkpkg relink
  endif 

	
echo "Creating ECL distribution...."
  if ($exec == "yes") then

    # Exclude other distribution files and platform-specific libs 
    # tarball.
    if ($src_only == "yes") then
        /bin/ls -1 ecl_install_* *.[aeo] */*.[aeo]    > /tmp/_ex$$
    else
        /bin/ls -1 ecl_install_* lib*.a */*.[aeo]     > /tmp/_ex$$
    endif

    # Create a tar of the source and binary
    if ($IRAFARCH == "ssun" || $IRAFARCH == "sparc") then
        tar -cfX - /tmp/_ex$$ . | gzip > /tmp/_tar$$
    else
        tar -cf - -X /tmp/_ex$$ . | gzip > /tmp/_tar$$
    endif

    # Encode the tarball and build the installer itself.
    uuencode /tmp/_tar$$ ecl_tar.gz > /tmp/_uu$$
    if ($src_only == "yes") then
        cat ecl_install.csh /tmp/_uu$$ | sed -e 's/VERSION_DATE/`date`/' \
	    > ecl_install_src.csh
        chmod 777 ecl_install_src.csh
    else
        cat ecl_install.csh /tmp/_uu$$ | sed -e 's/VERSION_DATE/`date`/' \
	    > ecl_install_${IRAFARCH}.csh
        chmod 777 ecl_install_${IRAFARCH}.csh
    endif

    # Clean up.
    /bin/rm -f /tmp/_tar$$ /tmp/_uu$$ /tmp/_ex$$
  endif 
	
echo "Done."