30 January 2014

Install Indy components into Lazarus

To have internet or server time in your application, you must install Indy components.
For a lot of users, I'm sure that the information given above won't work, or will be somewhat confusing given the differences between versions and inconsistent explanations.

The website points you to download the latest version from the snapshots page.
This wiki tells you to copy a lot of files over into directories.For me, neither worked, and ended up making a mess of my Lazarus installations.
  • Firstly, the page I would retrieve this from is here. Other sites I tried had problems with some files inside the archive.
  • When you open up the archive above, you will see there are folders: "fpc" and "lazarus".
  • You can copy the contents of "fpc" into: LAZARUS_DIR\fpc\2.6.0\source\packages\indylaz if you want to have things neat and tidy.
  • The "lazarus" folder, you copy into LAZARUS_DIR\components\indylaz
  • With both of these, make sure that there isn't a sub-directory inside the folders given. i.e. LAZARUS_DIR\components\indylaz\lazarus\
  • Go into Lazarus and go to "Package" -> "Open package file" and point it to the "indylaz.lpk" inside the LAZARUS_DIR\components\indylaz directory.
  • Once the package loads inside your project, click on the "options" button, which resembles an image of a parcel with a cog next to it.
  • Click the "Compiler Options" on the left-hand side and Click on the ".." button next to "Other unit files (-Fu) (delimiter is semicolon)". Select the "fpc" folder you created above and click OK. Lazarus will sort out the relative path for you. Don't change it.
  • Click OK and compile and then direct angry bile towards the individual who has steered you wrong with the previous, unhelpful, instructions.
  • Compile then install (will rebuild Lazarus). 
  • Currently, due to a know bug in FPC, you must compile the Indy package TWICE before installing it.