bsdport.txt 6.9 KB

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