home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 2 / Geek_Gadgets_2_2352.bin / docs / readme-cross < prev    next >
Text File  |  1997-05-01  |  12KB  |  311 lines

  1.         ===================================================
  2.         How To Build an Amiga Cross Development Environment
  3.         ===================================================
  4.  
  5.                (Last Updated 11/11/96)
  6.  
  7. --------------------------------------------
  8. (1) Pick an installation tree root directory
  9. --------------------------------------------
  10.  
  11. Pick a location for the root of the binary install tree.  This is where all
  12. the executables, libraries, include files, etc will be installed after being
  13. built.  This can be any directory you want, as long as you have sufficient
  14. permissions to create it or write to it.
  15.  
  16. On many systems, the standard location for this directory is "/usr/local",
  17. and in fact that is the default location.  For these instructions, because I
  18. want to create a totally private toolset, I will be installing in the
  19. directory "/home/fnf/ade".
  20.  
  21. Make the install directory and a few necessary subdirectories, if they don't
  22. already exist:
  23.  
  24.     mkdir -p /home/fnf/ade
  25.     mkdir -p /home/fnf/ade/bin
  26.     mkdir -p /home/fnf/ade/lib
  27.     mkdir -p /home/fnf/ade/m68k-amigaos
  28.  
  29. Strictly speaking it isn't necessary to make anything except /home/fnf/ade,
  30. since the subdirectories will normally be created as needed during the
  31. install procedure.
  32.  
  33. -------------------------------------
  34. (2) Pick a source tree root directory
  35. -------------------------------------
  36.  
  37. Pick a location for the root of the source tree.  An example, used in these
  38. directions, is "/home/fnf/ade-src".  This is where you will unpack all the
  39. ADE source archives.
  40.  
  41. Make the directory if it doesn't already exist:
  42.  
  43.     mkdir -p /home/fnf/ade-src
  44.  
  45. ------------------------------------
  46. (3) Pick a build tree root directory
  47. ------------------------------------
  48.  
  49. Pick a location for the build tree.  This is a temporary work area in which
  50. you will build all the object files, executables, libraries, etc, that will
  51. be installed in your installation tree.  It is possible to use the source
  52. tree as the build tree (building "in place") but that is not recommended.
  53. For one thing, you may want to remove the build tree once you've built and
  54. installed everything, and it is much easier to do that if you can just
  55. remove an entire directory and all subdirectories.  For another thing, if
  56. you make changes to the source tree, it is easier to find out later what
  57. those changes are if your source tree is not cluttered with all the files
  58. created during the build, by simply diffing your source tree against the
  59. original.
  60.  
  61. An example, used in these directions, is "/home/fnf/ade-build".  Make the
  62. directory if it doesn't already exist:
  63.  
  64.     mkdir -p /home/fnf/ade-build
  65.  
  66. IMPORTANT: In order to successfully use separate source and build trees you
  67. must be using a "make" program that fully supports "VPATH".  Some native
  68. "make" programs do not!  The workaround is to use GNU make, so you may have
  69. to first build and install GNU make if you wish to keep the build and source
  70. trees separate.  If this is not an option for you, then you can just do the
  71. builds in the source tree and forget about having a separate build tree.
  72.  
  73. ----------------------------------------------------
  74. (4) Get and unpack the ixemul includes and libraries
  75. ----------------------------------------------------
  76.  
  77. During the build of the cross tools, you will need the standard ixemul
  78. header files.  These are not used to build the cross tools, but rather used
  79. by the cross compiler when it is compiling some amiga objects, such as the
  80. libgcc.a runtime library that gets linked with the output of the cross
  81. compiler to make an Amiga executable.  You will also need some other runtime
  82. files, such as an Amiga crt0.o and libc.a, from the ixemul library
  83. distribution.  It is best if you get and install these files now, before
  84. starting to build the cross tools.
  85.  
  86. From the latest ADE distribution, get the AmigaOS specific inline files
  87. (fd2inline-X.X-bin.lha), the AmigaOS specific libraries (libamiga-bin.lha),
  88. the libnix libraries (libnix-X.X-bin.lha) and the ixemul runtime files
  89. (ixemul-X.X-env-bin.lha, ixemul-X.X-inc-bin.lha).
  90.  
  91. If you expect to do Amiga specific development you will also need the
  92. AT/VISCorp include files, which are not available in the ftp ADE
  93. distributions but are in the ADE CD-ROM distributions (at-inc-bin.lha).
  94. Alternatively you can get these files later from some other source, such as
  95. one of the Native Developer Update Kits (NDUK) or from the AT developers
  96. CD-ROM.  The AT/VISCorp include files are not necessary for building the
  97. cross environment, just for using it to build any AmigaOS specific programs.
  98.  
  99. Because these files are distributed in lha format in the ADE distribution,
  100. the easiest way to get them to your cross machine is to extract all of these
  101. archives in a temporary directory on an Amiga and then make a "tar" archive
  102. which will be copied to your cross machine and unpacked there:
  103.  
  104.     (on an Amiga)
  105.     lha -mraxe x fd2inline-X.X-bin.lha
  106.     lha -mraxe x libamiga-bin.lha
  107.     lha -mraxe x libnix-X.X-bin.lha
  108.     lha -mraxe x ixemul-X.X-env-bin.lha
  109.     lha -mraxe x ixemul-X.X-inc-bin.lha
  110.  
  111. This will create subdirectories "bin", "guide", "include", "lib", and "man".
  112. Delete the bin and guide directories since you won't need their contents.
  113.  
  114.     delete bin guide all force
  115.  
  116. Extract the AmigaOS include files from the optional at-inc-bin.lha archive
  117. from the ADE CD-ROM (or skip this step if you don't have the CD-ROM), copy
  118. the files to the include directory, and delete the os-include directory that
  119. is created from the archive extraction:
  120.  
  121.     lha -mraxe x at-inc-bin.lha
  122.     copy os-include/#? include all
  123.     delete os-include all force
  124.  
  125. Use the Amiga version of tar to pack the "include", "lib", and "man"
  126. directories into a tar archive, move the archive to the system on which you
  127. are installing the cross environment, and unarchive it in the appropriate
  128. subdirectory in the binary tree:
  129.  
  130.     (on an Amiga)
  131.     tar -cvf inclibman.tar include lib man
  132.     delete include lib man all
  133.  
  134.     (on the cross host system)
  135.     cd /home/fnf/ade/m68k-amigaos
  136.     tar -xvf inclibman.tar
  137.     rm inclibman.tar
  138.  
  139. Note that you can use any other method you like to get these files from your
  140. Amiga to the cross host system.  The important thing is that they end up in
  141. the correct subdirectory in the installation tree, which is where the cross
  142. tools will look for them once the tools are built.
  143.  
  144. ------------------------------------
  145. (5) Build and install the "binutils"
  146. ------------------------------------
  147.  
  148. Get the binutils (assembler, linker, archiver, etc) distribution from the
  149. latest ADE snapshot (ftp.ninemoons.com:pub/ade/961012/binutils-2.7-src.tgz
  150. for example) and extract it in the source directory.  It will create the
  151. subdirectory "fsf/binutils" and populate it with the binutils source files:
  152.  
  153.     cd /home/fnf/ade-src
  154.     tar -xvzf binutils-2.7-src.tgz
  155.  
  156. Check the ADE updates directory (ftp.ninemoons.com:pub/ade/updates) for any
  157. patch files that need to be applied to the archive from the latest snapshot
  158. directory, and apply the patch (if necessary):
  159.  
  160.     gzip -d binutils-961012-961111.diffs.gz   (no such file, example only)
  161.     cd fsf/binutils
  162.     patch -p0 <../../binutils-961012-961111.diffs
  163.  
  164. Configure and build the binutils in the build tree.  Note that the --prefix
  165. option should be set to the binary tree that you chose and it should be an
  166. absolute path (starts with a '/' character) not a relative path.  Also,
  167. using a common cache file via the --cache-file option makes the configure go
  168. faster:
  169.  
  170.     cd /home/fnf/ade-build
  171.     mkdir binutils
  172.     cd binutils
  173.     /home/fnf/ade-src/fsf/binutils/configure -v --prefix=/home/fnf/ade --target=m68k-amigaos --cache-file=config.cache
  174.     make
  175.  
  176. If everything builds OK, then install the binutils into the binary tree:
  177.  
  178.     make install
  179.  
  180. -------------------------
  181. (6) Build and install gcc
  182. -------------------------
  183.  
  184. Get the gcc distribution (ftp.ninemoons.com:pub/ade/961012/gcc-2.7.2.1-src.tgz
  185. for example) from the latest ADE snapshot and extract it in the source
  186. directory.  It will create the subdirectory "fsf/gcc" and populate it with the
  187. gcc source files:
  188.  
  189.     cd /home/fnf/ade-src
  190.     tar -xvzf gcc-2.7.2.1-src.tgz
  191.  
  192. Check the ADE updates directory (ftp.ninemoons.com:pub/ade/updates) for any
  193. patch files that need to be applied to the archive from the latest snapshot
  194. directory, and apply the patch (if necessary):
  195.  
  196.     gzip -d gcc-961012-961111.diffs.gz   (no such file, example only)
  197.     cd fsf/gcc
  198.     patch -p0 <../../gcc-961012-961111.diffs
  199.  
  200. Configure gcc in the build tree.  Note that the --prefix option should be
  201. set to the binary tree that you chose:
  202.  
  203.     cd /home/fnf/ade-build
  204.     mkdir gcc
  205.     cd gcc
  206.     /home/fnf/ade-src/fsf/gcc/configure -v --prefix=/home/fnf/ade --target=m68k-amigaos
  207.  
  208. Because of some unresolved problems building a cross compiler, apply the
  209. following patch to the gcc Makefile after configuring and before building
  210. gcc.
  211.  
  212. ============================================================================
  213. --- Makefile.orig    Mon Nov 11 18:51:20 1996
  214. +++ Makefile    Mon Nov 11 20:07:16 1996
  215. @@ -38,5 +38,5 @@
  216.  # Selection of languages to be made.
  217.  # This is overridden by configure.
  218. -LANGUAGES = c objective-c proto  c++
  219. +LANGUAGES = c c++
  220.  
  221.  ALLOCA =
  222. @@ -194,5 +194,5 @@
  223.  # include files.
  224.  # NOTE: local_prefix *should not* default from prefix.
  225. -local_prefix = /ade/local
  226. +local_prefix = $(prefix)/local
  227.  # Directory in which to put host dependent programs and libraries
  228.  exec_prefix = $(prefix)
  229. @@ -273,5 +273,5 @@
  230.  
  231.  # libgcc1-test target (must also be overridable for a target)
  232. -LIBGCC1_TEST = libgcc1-test
  233. +LIBGCC1_TEST =
  234.  
  235.  # List of extra executables that should be compiled for this target machine
  236. @@ -438,5 +438,5 @@
  237.  
  238.  SYSTEM_HEADER_DIR = /ade/include
  239. -OTHER_FIXINCLUDES_DIRS = /ade/os-include
  240. +OTHER_FIXINCLUDES_DIRS =
  241.  
  242.  # We don't need a libgcc1, it's all in ixemul.library
  243. @@ -2437,5 +2437,5 @@
  244.  # Remake the info files.
  245.  
  246. -doc: info guide
  247. +doc: info # guide
  248.  info: cpp.info gcc.info lang.info
  249.  guide: cpp.guide gcc.guide lang.guide
  250. @@ -2606,5 +2606,5 @@
  251.  # broken is small.
  252.  install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
  253. -    install-libobjc install-man install-info install-guide lang.install-normal install-driver
  254. +    install-libobjc install-man install-info lang.install-normal install-driver # install-guide 
  255.  
  256.  # Do nothing while making gcc with a cross-compiler. The person who
  257. ============================================================================
  258.  
  259. After the patch is applied, build and install gcc: 
  260.  
  261.     make
  262.     make install
  263.  
  264. You might want to add the binary directory to your PATH variable:
  265.  
  266.     PATH=/home/fnf/ade/bin:$PATH ; export PATH
  267.  
  268. ----------------------------
  269. (7) Test the new cross tools
  270. ----------------------------
  271.  
  272. An easy way to test the new cross tools is to configure and build one of
  273. the ADE components in the cross environment, and then copy the executable
  274. back to an Amiga to see if it runs OK.  I would suggest using the "brik"
  275. program:
  276.  
  277.     cd /home/fnf/ade-src
  278.     tar -xvzf brik-2.0-src.tgz
  279.     cd /home/fnf/ade-build
  280.     mkdir brik
  281.     cd brik
  282.     CC=m68k-amigaos-gcc /home/fnf/ade-src/contrib/brik/configure -v
  283.     make CC=m68k-amigaos-gcc
  284.  
  285. On a 166 Mhz Pentium system running RedHat linux this build takes only 3
  286. seconds while on an A4000 with 40 Mhz WarpEngine, it takes about 20 seconds.
  287. The executable should be about 12,800 bytes, but the exact size may vary
  288. depending upon a number of factors.  Move the executable back to an Amiga
  289. and test it:
  290.  
  291.     (on an Amiga)
  292.     brik -Gvb brik
  293.  
  294. which should print something like:
  295.  
  296.     # Whole file CRCs generated by Brik v2.0.  Use "brik -C" to verify them.
  297.  
  298.     # CRC-32        filename
  299.     # ------        --------
  300.  
  301.     2515614901b     brik
  302.  
  303. Don't worry if the CRC is not the same as printed here.
  304.  
  305. If this works, you now have a functioning cross environment (or at least a
  306. cross compiler) that depending upon the model of your Amiga and the machine
  307. you are using as a cross development host, could easily be 20 times faster
  308. than a native compiler.
  309.  
  310. -Fred Fish
  311.