bsdport.txt 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. $Id$
  2. The Free Pascal *BSD port.
  3. Comments, mistakes and suggestions to [email protected]
  4. Since the last update to this document, I added the Net and OpenBSD ports,
  5. so now it is a *BSD port. I don't own BSDi or a Mac OS X, or even accounts
  6. on an intel system so that'll have to wait. (the Mac OS X/Darwin port
  7. will definitely take off if the PPC codegenerator is fully working)
  8. In 1.1.x branch, the tree RTLs will be merged into one, for easier
  9. maintaining, this will hopefully increase the Open and NetBSD ports
  10. somewhat.
  11. I'm actively searching for test accounts on Open and NetBSD/i386 (and
  12. in the future also for other processors).
  13. Requirements: minimal: some MBs account, permanent connection, 100 MHz+
  14. (speed not that important)
  15. cool : 100 MB + 100MB tempspace, low latency connection
  16. fast machine that allows swift cycling.
  17. 1 *BSD status and notes. (kept on CVS because I work on several places)
  18. -----------------------------------------------------------------------------
  19. Please read these before running a *BSD snapshot/release
  20. 1.1 Supported OS versions.
  21. ---
  22. FREEBSD
  23. 4.x : Used to develop and maintain port. Should work, all
  24. versions. Best *BSD platform.
  25. 3.x : _not_ supported, (3.2, 3.4, 3.6 would probably work
  26. with some very minor changes to the signalhandling. The
  27. syscall numbers changed)
  28. (NON-ELF) 2.x : _not_ supported, but it might be doable. (the
  29. OpenBSD port works on a.out)
  30. 5.0DP1 : simple testing seemed to work without changes. Nearly
  31. no package tests tried though.
  32. NetBSD 1.5.x : Most stuff should work.
  33. Rest : status unknown, though some NetBSD developper said
  34. he didn't expect problems for 1.6.x
  35. OpenBSD 3.1 : This version should work somewhat. Needs an assembler
  36. from the ports tree (devel/binutils) to function
  37. properly. Linker of the ports tree is easier,
  38. but that one doesn't want to make shared files.
  39. The IDE also is starting to work quite nicely on FreeBSD, so it is included
  40. in the releases since 1.0.6. I didn't check the fixes for *BSD on the other
  41. two OSes yet.
  42. 1.2 Known bugs
  43. ---
  44. The FreeBSD/FPC port is now more or less a tested distro. There are several
  45. known bugs, but I can now only remember one:
  46. - Recover from Delphi exceptions that originate as processor exceptions
  47. will go wrong. (see texception4 in the test suite)
  48. (recovering from several processor
  49. exceptions in one proc will have unpredictable results (breakable hang
  50. probably))
  51. 1.3 Possible issues.
  52. Some things are not really bugs, but status is unknown, or there is
  53. something dodgy about the implementation:
  54. - The NetBSD and OpenBSD ports are barely tested, they build on the stable
  55. FreeBSD base though. Most packages (and the FCL) have been tested with
  56. FreeBSD, quite some with NetBSD, nearly none with OpenBSD.
  57. - IMPORTANT:
  58. !!! An explicite warning: Not all procedures and structures in Linux are
  59. checked, so even if they are not commented out, they can be not implemented!!!
  60. This specially applies to linux specific stuff. In case of doubt, use a
  61. scratch system, view the source, or mail the maintainer.
  62. I fixed a bug in truncate just a few months ago, that had gone unnoticed
  63. for the near two years that the port works now.!!!
  64. - The absence of kernel READDIR support has been fixed with a "hack", which
  65. means that searchpath (-Fx) and FindFirst/FindNext are more or less
  66. working. This "hacked" readdir implementation is now 1 1/2 year
  67. bugfree now (and no anomolies detected), and works on the other two BSDs
  68. too. Be careful with usage on "special" filesystems and files though.
  69. (devfs, tmpfs hardlinks)
  70. Together with Sebastian I developped a port of the libc routines, but
  71. they don't work yet (NOTE to self: retest, am a lot better with debugger
  72. now)
  73. 3 How to build a *BSD compiler/RTL ?
  74. -----------------------------------------------------------------------------
  75. To rebuild the compiler, you need a starting compiler which is either the
  76. last releaseversion, or the release you are building itself (but e.g. on
  77. other OS)
  78. Preparation:
  79. - make sure your tree is up to date and cleaned of stale object and unit files.
  80. - I assume ppc386 is the name of your compiler. Append PP=<compilername> and
  81. replace ppc386 with your compilername if it is different on your system.
  82. - I'll assume we are building openbsd on one of the other systems.
  83. - Start compiler on other OS? (tested is Linux) -> check 3.1
  84. (crosscompiling)
  85. - Already a suitable 1.0.x startcompiler on *BSD -> 3.2 is much
  86. easier.
  87. Trying to build with snapshot compiler binaries is no problem mosttimes, but
  88. release compilers _ought_ to work.
  89. 3.1 How to build a *BSD system starting on (another *BSD, Linux, or Linux
  90. emu on any of them).
  91. ---
  92. The procedure here is verbose, and for the most akward case. If you have
  93. linux support on on your FreeBSD machine, or operate on NFS or Samba share
  94. (so that copying and using the sources in two systems is easier) some steps
  95. can be omitted or simplified. Just play with it.
  96. create the RTL:
  97. 1. go to the target RTL directory. (if you want to build for OpenBSD, to
  98. rtl/openbsd).
  99. 2. If your binary format is the same (both are ELF), simply run
  100. (g)make OS_TARGET=openbsd
  101. this will be called "case A" from now on.
  102. Otherwise we need to build via assembler files; (CASE B) and you'll
  103. need to execute:
  104. (g)make OS_TARGET=openbsd OPT='-a'
  105. compile the compiler:
  106. 3. Go to the compiler/ directory
  107. Case A:
  108. make OS_TARGET=openbsd OPT='-Fu../rtl/openbsd -kdontlink'
  109. Case B:
  110. make OS_TARGET=openbsd OPT='-Fu../rtl/openbsd -kdontlink -a'
  111. 4 Collect all necessary files, put them in one directory on the target
  112. computer.
  113. Case A: - all *.o and *.ppu files in compiler/ and rtl/openbsd/
  114. - compiler/link.res and
  115. - compiler/ppas.sh
  116. Case B: - All *.s and *.ppu files in compiler/ and rtl/openbsd/
  117. - the prt0.as file in rtl/openbsd/i386, rename this file to prt0.s
  118. - compiler/link.res and compiler/ppas.sh
  119. Creating the final compiler:
  120. 5 edit link.res, and fix all paths (it will include ../rtl/openbsd, simply
  121. remove all paths in the INPUT() section, so filenames only)
  122. Remove "dontlink" from the commandline of the linker in the ppas.sh file,
  123. and make the ppas.sh file executable with chmod.
  124. 6 Make sure you are in the right dir.
  125. Case A: run ppas.sh
  126. Case B: run the do_s script in the appendix (which will assembler all *.s
  127. files to *.o on the target system), THEN run ppas.sh
  128. 7 Test your compiler with pp -?, brandelf if necessary. (NetBSD ident code is
  129. already in the prt0.s file. Will be for ELF OpenBSD too)
  130. Rebuild everything (compiler+RTL+FCL+pkgs) on the host system:
  131. 8 Go to the toplevel directory fpc/
  132. 9 Enter:
  133. gmake all
  134. Install the system
  135. 10 gmake install
  136. (will install into $PREFIX=/usr/local)
  137. 3.2 How to build a *BSD system if you have a suitable compiler on the
  138. targetsystem.
  139. ---
  140. Rebuild everything (compiler+RTL+FCL+pkgs) on the host system:
  141. 1 Go to the toplevel directory fpc/
  142. 2 Enter:
  143. gmake all
  144. Install the system
  145. 3 gmake install
  146. (will install into $PREFIX=/usr/local)
  147. ------------------
  148. Appendix A: The DO_S script. (C) El Znorro
  149. ------------------
  150. #!/bin/sh
  151. for i in *.s; do
  152. flup=`basename $i .s`
  153. as $i -o $flup.o
  154. echo $i
  155. echo $flup
  156. done
  157. {
  158. $Log$
  159. Revision 1.5 2003-11-18 21:47:19 marco
  160. * minor updates
  161. Revision 1.4 2002/09/07 16:01:17 peter
  162. * old logs removed and tabs fixed
  163. Revision 1.3 2002/08/08 20:39:26 marco
  164. * Practically rewritten in first update in 2 years or so.
  165. }