Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/system/cmb-cross
ViewVC logotype

Diff of /sml/trunk/system/cmb-cross

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5794, Mon Oct 14 16:33:24 2019 UTC revision 6041, Fri Dec 13 18:57:12 2019 UTC
# Line 3  Line 3 
3  # COPYRIGHT (c) 2019 The Fellowship of SML/NJ (http://www.smlnj.org)  # COPYRIGHT (c) 2019 The Fellowship of SML/NJ (http://www.smlnj.org)
4  # All rights reserved.  # All rights reserved.
5  #  #
6  # usage: cmb-cross [ -z ] <target>  # usage: cmb-cross [ -32 | -64 ] [ -z ] <TARGET>
7  #       <target>        -- one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32  #       <TARGET>        -- one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32
8  #  #
9  # cross compile to the specified target  # cross compile to the specified TARGET
10  #  #
11    
12    usage() {
13      echo "usage: cmb-cross [ options ] <target>"
14      echo "  Options:"
15      echo "    -32 | -64     -- size option for compiler"
16      echo "    -z            -- archive result as gzipped tar file"
17      echo "    -C<ctl>=<v>   -- control argument passed to compile command"
18      echo "    <target>      -- one of amd64-unix, ppc-unix, sparc-unix,"
19      echo "                     x86-unix, or x86-win32"
20      exit 1
21    }
22    
23  this=$0  this=$0
24  here=`pwd`  here=`pwd`
25  cd ../..  cd ../..
26  twoup=`pwd`  twoup=`pwd`
27  cd $here  cd $here
28    
29  # compilation flags for final pass  SIZE_OPT=
 #  
30  CTL_FLAGS=  CTL_FLAGS=
31    SIZE_OPT="-32"
32    MAKE_TARBALL=no
33    TARGET=
34    
35    #
36    # Parse command line
37    #
38    while [ "$#" != 0 ] ; do
39        arg=$1; shift
40        case $arg in
41        -32) SIZE_OPT="-32" ;;
42        -64) SIZE_OPT="-64" ;;
43        -z) MAKE_TARBALL=yes ;;
44        -C) CTL_FLAGS="$CTL_FLAGS $arg" ;;
45        amd64-unix|ppc-unix|sparc-unix|x86-unix|x86-win32)
46            TARGET=$arg
47            ;;
48        *)
49            echo "$this: unknown argument \"$arg\""
50            usage
51            ;;
52        esac
53    done
54    
55  usage() {  if [ x"$TARGET" = x ] ; then
56    echo "usage: cmb-cross [ -z ] <target>"    usage
57    echo "where <target> is one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32"  fi
   exit 1  
 }  
58    
59  to_lower() {  to_lower() {
60    echo $@ | tr "[:upper:]" "[:lower:]"    echo $@ | tr "[:upper:]" "[:lower:]"
# Line 33  Line 64 
64    echo $@ | tr "[:lower:]" "[:upper:]"    echo $@ | tr "[:lower:]" "[:upper:]"
65  }  }
66    
 # check for "-z" flag  
 if [ x"$1" = "x-z" ] ; then  
   shift  
   build_tarball=yes  
 else  
   build_tarball=no  
 fi  
   
 if [ $# -ne 1 ] ; then  
   usage  
 fi  
   
67  # check linking command  # check linking command
68  LINK=$twoup/bin/.link-sml  LINK=$twoup/bin/.link-sml
69  if [ ! -x $LINK ] ; then  if [ ! -x $LINK ] ; then
# Line 66  Line 85 
85  HOST_ARCH=$(to_upper $ARCH)  HOST_ARCH=$(to_upper $ARCH)
86  HOST_OPSYS=$(to_upper $OPSYS)  HOST_OPSYS=$(to_upper $OPSYS)
87    
88  # determine the target ARCH, OPSYS, SIZE, and ENDIANESS variables  # determine the TARGET ARCH, OPSYS, SIZE, and ENDIANESS variables
89  target=$1  #
90  case $target in  case $TARGET in
91    amd64-unix)    amd64-unix)
92      architecture=amd64      architecture=amd64
93      TARGET_ARCH=AMD64;      TARGET_ARCH=AMD64;
# Line 104  Line 123 
123      TARGET_SIZE=32      TARGET_SIZE=32
124      TARGET_ENDIANESS=LITTLE      TARGET_ENDIANESS=LITTLE
125      ;;      ;;
126    *) echo "cmb-cross: unrecognized target '$target'"    *) echo "cmb-cross: unrecognized TARGET '$TARGET'"
127       exit 1       exit 1
128    ;;    ;;
129  esac  esac
# Line 114  Line 133 
133    
134  unset VERSIONTOOL_BUMP_RELEASE  unset VERSIONTOOL_BUMP_RELEASE
135    
136  echo "$this: build $target-cross bin/boot files"  echo "$this: build $TARGET-cross bin/boot files"
137  ../../bin/sml -DNO_PLUGINS \$smlnj/cmb.cm << XXXX  ../../bin/sml $SIZE_OPT -DNO_PLUGINS \$smlnj/cmb.cm << XXXX
138  #set (CMB.symval "ARCH_${HOST_ARCH}") NONE;  #set (CMB.symval "ARCH_${HOST_ARCH}") NONE;
139  #set (CMB.symval "OPSYS_${HOST_OPSYS}") NONE;  #set (CMB.symval "OPSYS_${HOST_OPSYS}") NONE;
140  #set (CMB.symval "ARCH_${TARGET_ARCH}") (SOME 1);  #set (CMB.symval "ARCH_${TARGET_ARCH}") (SOME 1);
141  #set (CMB.symval "OPSYS_${TARGET_OPSYS}") (SOME 1);  #set (CMB.symval "OPSYS_${TARGET_OPSYS}") (SOME 1);
142  #set (CMB.symval "TARGET_SIZE_${TARGET_SIZE}") (SOME 1);  #set (CMB.symval "TARGET_SIZE_${TARGET_SIZE}") (SOME 1);
143  #set (CMB.symval "TARGET_${TARGET_ENDIANESS}_ENDIAN") (SOME 1);  #set (CMB.symval "TARGET_${TARGET_ENDIANESS}_ENDIAN") (SOME 1);
144  CMB.make' (SOME "$target-cross");  CMB.make' (SOME "$TARGET-cross");
145  XXXX  XXXX
146    
147  # the following is equivalent to running  # the following is equivalent to running
148  #  #
149  #       ./makeml -boot $target-cross.boot.x86-unix -rebuild $architecture  #       ./makeml -boot $TARGET-cross.boot.x86-unix -rebuild $architecture
150  #  #
151  echo "$this: cross compile to $target"  echo "$this: cross compile to $TARGET"
152    
153  if [ $HOST_OPSYS = win32 ] ; then  if [ $HOST_OPSYS = win32 ] ; then
154      SUFFIX=$(to_lower "${HOST_ARCH}-win32")      SUFFIX=$(to_lower "${HOST_ARCH}-win32")
155  else  else
156      SUFFIX=$(to_lower "${HOST_ARCH}-unix")      SUFFIX=$(to_lower "${HOST_ARCH}-unix")
157  fi  fi
158  CROSS_BIN_DIR="${target}-cross.bin.${SUFFIX}"  CROSS_BIN_DIR="${TARGET}-cross.bin.${SUFFIX}"
159  CROSS_BOOT_DIR="${target}-cross.boot.${SUFFIX}"  CROSS_BOOT_DIR="${TARGET}-cross.boot.${SUFFIX}"
160    
161  MODE="@SMLrebuild=${architecture}"  MODE="@SMLrebuild=${architecture}"
162    
# Line 146  Line 165 
165    
166  cd $CROSS_BOOT_DIR  cd $CROSS_BOOT_DIR
167    
168  echo $this: $LINK $RUN @SMLboot=BOOTLIST @SMLheap=sml $MODE $CTL_FLAGS  echo $this: $LINK $SIZE_OPT @SMLboot=BOOTLIST @SMLheap=sml $MODE $CTL_FLAGS
169  if $LINK $RUN @SMLboot=BOOTLIST @SMLheap=sml $MODE $CTL_FLAGS ; then  if $LINK $SIZE_OPT @SMLboot=BOOTLIST @SMLheap=sml $MODE $CTL_FLAGS ; then
170      # back to the system directory      # back to the system directory
171      #      #
172      cd $here      cd $here
173      # the new boot/bin files will be in "${architecture}.boot.${target}"      # the new boot/bin files will be in "${architecture}.boot.${TARGET}"
174      # and "${architecture}.bin.${target}"; we rename them with the      # and "${architecture}.bin.${TARGET}"; we rename them with the
175      # standard naming convention by replacing "${architecture}" with "sml"      # standard naming convention by replacing "${architecture}" with "sml"
176      #      #
177      for xxx in bin boot ; do      for xxx in bin boot ; do
178          if [ -d "${architecture}.${xxx}.${target}" ] ; then          if [ -d "${architecture}.${xxx}.${TARGET}" ] ; then
179              rm -rf "sml.${xxx}.${target}"              rm -rf "sml.${xxx}.${TARGET}"
180              mv "${architecture}.${xxx}.${target}" "sml.${xxx}.${target}"              mv "${architecture}.${xxx}.${TARGET}" "sml.${xxx}.${TARGET}"
181          else          else
182              echo "$this: ${architecture}.${xxx}.${target} is missing!"              echo "$this: ${architecture}.${xxx}.${TARGET} is missing!"
183              exit 1              exit 1
184          fi          fi
185      done      done
# Line 173  Line 192 
192      exit 1      exit 1
193  fi  fi
194    
195  if [ $build_tarball = "yes" ] ; then  if [ $MAKE_TARBALL = "yes" ] ; then
196    tar -cf - sml.boot.${target} | gzip > boot.$target.tgz    tar -cf - sml.boot.${TARGET} | gzip > boot.$TARGET.tgz
197  fi  fi

Legend:
Removed from v.5794  
changed lines
  Added in v.6041

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0