home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / source / xpdf-0.80 / compiling.amiga < prev    next >
Encoding:
Text File  |  1999-06-10  |  3.8 KB  |  124 lines

  1.  
  2.                COMPILING APDF
  3.  
  4.  
  5.     ** Warning **
  6.  
  7. Compiling Apdf is not an easy task. It requires a good knowledge of  the
  8. geekgadget   environment.  In  particular,  setting  up  an  environment
  9. allowing to compile the PPC version can be tricky.
  10.  
  11.  
  12. With this archive and the decryption patch for xpdf-0.80 pointed  to  on
  13. the  page  http://www.foolabs.com/xpdf/, you can build a version of Apdf
  14. supporting encrypted documents.
  15.  
  16. With this archive and the  gzip-1.2.4  source  code,  you  can  build  a
  17. version of Apdf with decompression handled internally. This version is a
  18. bit faster, especially on PPC (but don't hope too much from it).
  19.  
  20. Compiling a 68k version of Apdf  requires  a  GeekGadgets  environnement
  21. including:
  22.  - egcs C and C++ compilers (at least version 1.1)
  23.  - libnix
  24.  - amigaos includes
  25.  - make
  26.  - sh
  27.  - fileutils
  28. and possibly a few others.
  29. You also need the MUI and Cybergrapics developer kits.
  30.  
  31. To compile a PPC version of Apdf, you need all of the above, and
  32.  - egcs C and C++ compilers (at least version 1.1) for PPC
  33.  - libnixppc
  34.  - the powerup developer kit.
  35.  
  36.  
  37.  
  38.  How to compile Apdf:
  39.  --------------------
  40.  
  41. The theory is simple: in an 'sh' shell, 'cd' to the build  directory  of
  42. your  choice  (buildppc,  build060,  ...),  type  'make',  wait,  and if
  43. everything goes fine, you will get  the  Apdf  executable  in  the  xpdf
  44. subdirectory  of  that build directory (note: do not run 'configure' !).
  45. The problem is that you will probably get errors in the process.
  46.  
  47.  
  48. Some things to watch out:
  49.  
  50. - some versions of libnix (and libnixppc) have a buggy atoi()  function.
  51. To  test that, check if atoi("010")==10. If not, you should replace atoi
  52. by a working one, e.g.:
  53.  
  54. int atoi(const char* str) { return (int)strtol(str,0,10); }
  55.  
  56. (While this is not necessary for Apdf, you may want to  fix  the  atol()
  57. function as well.)
  58.  
  59. - you will probably have to fix things in various include files.
  60.  
  61.  
  62. While a 68k executable is probably not too hard to obtain, a PPC one  is
  63. more  will  require more include tweakings. Furthermore, the ppc version
  64. of  gcc  (at  least  the  version  I  use)  has  a  problem   with   the
  65. initialization  of  static objects. It seems that the constructors table
  66. built by the linker contains NULL pointers, and that  the  startup  code
  67. stops executing constructors when it encounters one. To work around that
  68. problem, I have added a "stub.cc" file that has to  be  just  after  the
  69. startup  code  when  linked,  and  a  custom  linker script that defines
  70. symbols for the start and the  end  of  the  ctor/dtor  tables.  If  the
  71. version of gcc that you use doesn't have this problem, you *must* remove
  72. stub.o.
  73.  
  74.  
  75. Once you have managed to compile Apdf,  building  a  version  supporting
  76. encrypted documents and/or builtin decompression should be easy:
  77.  
  78. The decryption patch:
  79.  
  80. * Get the original decryption patch from
  81.  
  82. ftp://ftp.sci.usq.edu.au/pub/linux/xpdf/xpdf-0.80-decrypt.patch
  83.  
  84. * patch it to make it suitable for Apdf:
  85.  
  86. patch -l <decrypt_patch.diff
  87.  
  88. * apply the patch
  89.  
  90. cd the_main_directory_of_the_source_archive
  91. patch -l -p1 <xpdf-0.80-decrypt.patch
  92.  
  93. * recompile.
  94.  
  95.  
  96. The gzip patch:
  97.  
  98. * get the gzip-1.2.4-src.tgz archive, e.g. from ftp://ftp.ninemoons.com
  99.  
  100. * copy the unlzw.c from that archive to xpdf/unlzw.cc
  101.  
  102. * apply the gzip patch:
  103.  
  104. cd the_main_directory_of_the_source_archive
  105. patch -l -p1 <gzip.diff
  106.  
  107. * recompile.
  108.  
  109.  
  110.  
  111.  SAS/C
  112.  -----
  113.  
  114. You can build a "semi-working" version of  Apdf  68k  using  the  latest
  115. eperimental  version of the SAS/C++ compiler. It is probably easier than
  116. with gcc. However, the version  produced  by  SAS/C  will  not  properly
  117. behave  in case a runtime error occurs, such as a memory shortage. It is
  118. possible that some resources are not returned to the system if  such  an
  119. error  occurs.  This  is  due  to  the  fact  that  this  compiler lacks
  120. exceptions support.
  121. Note that you can _not_ build a ppc version with scppc.
  122.  
  123.  
  124.