README.Unix.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. README.Unix.txt - 2010-11-14 - Building FLTK on Unix
  2. -----------------------------------------------------
  3. CONTENTS
  4. ==========
  5. 1 INTRODUCTION
  6. 2 PREREQUISITES
  7. 2.1 Ubuntu 10
  8. 2.2 Linux Mint 9
  9. 2.3 Fedora 13
  10. 2.4 * http://www2.mandriva.com/
  11. 2.5 * http://www.opensuse.org/en/
  12. 2.6 * http://www.debian.org/
  13. 2.7 * Mandrake?
  14. 2.8 SunOS / Solaris
  15. 2.9 * SGI?
  16. 2.10 HP-UX
  17. 2.11 AIX
  18. 2.12 NetBSD
  19. 3 HOW TO BUILD FLTK USING GCC
  20. 3.1 Prerequisites
  21. 3.2 Downloading and Unpacking
  22. 3.3 Configuring FLTK
  23. 3.4 Building FLTK
  24. 3.5 Testing FLTK
  25. 3.6 Installing FLTK
  26. 3.7 Creating new Projects
  27. 4 CREATING A NEW PROJECT IN CODE::BLOCKS
  28. 5 DOCUMENT HISTORY
  29. * TODO: we still need to write these chapters
  30. 1 INTRODUCTION
  31. =================
  32. FLTK currently supports the following development environments on vmost Unix
  33. platforms:
  34. - gcc command line tools
  35. - Code::Blocks
  36. - ...
  37. The Symbol font and the Zapf Dingbats font do not work on X11. This is correct
  38. behavior for UTF-8 platforms.
  39. 2 PREREQUISITES
  40. ==================
  41. 2.1 Ubuntu 10
  42. ----------------
  43. Ubuntu Linux can be downloaded here:
  44. http://www.ubuntu.com/
  45. If you have not done so yet, download and install Ubuntu.
  46. Open a shell and install some software:
  47. sudo apt-get install g++
  48. sudo apt-get install gdb
  49. sudo apt-get install subversion
  50. sudo apt-get install autoconf
  51. sudo apt-get install libx11-dev
  52. sudo apt-get install libglu1-mesa-dev
  53. These two are optional, but highly recommended:
  54. sudo apt-get install libasound2-dev
  55. sudo apt-get install libxft-dev
  56. If you are planning to use the Code::Blocks IDE, also install this
  57. sudo apt-get install codeblocks
  58. I like to use subversion to install the latest FLTK-1.3.release:
  59. svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
  60. To update to the latest version, just go into the fltk-1.3 directory and type
  61. svn update
  62. 2.2 Linux Mint 9
  63. -------------------
  64. Linux Mint 9 can be downloaded here:
  65. http://www.linuxmint.com/
  66. If you have not done so yet, download and install Linux Mint.
  67. Open a shell and install some software:
  68. sudo apt-get install g++
  69. sudo apt-get install gdb
  70. sudo apt-get install subversion
  71. sudo apt-get install autoconf
  72. sudo apt-get install libx11-dev
  73. sudo apt-get install libglu1-mesa-dev
  74. These two are optional, but highly recommended:
  75. sudo apt-get install libasound2-dev
  76. sudo apt-get install libxft-dev
  77. If you are planning to use the Code::Blocks IDE, also install this
  78. sudo apt-get install codeblocks
  79. I like to use subversion to install the latest FLTK-1.3.release:
  80. svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
  81. To update to the latest version, just go into the fltk-1.3 directory and type
  82. svn update
  83. FIXME: no FL_SYMBOL font (-*-symbol-*), font 15 (Zapf-Dingbats)
  84. 2.3 Fedora 13
  85. -------------------
  86. Fedora 13 Linux can be downloaded here:
  87. http://fedoraproject.org/
  88. If you have not done so yet, download and install Fedora.
  89. Open a terminal window and install some software. In Fedora, the default user
  90. has no permission to call "sudo", so we will change user a few times:
  91. su root
  92. yum groupinstall "Development Tools"
  93. yum groupinstall "X Software Development"
  94. If you are planning to use the Code::Blocks IDE, also install this
  95. yum install codeblocks.i686 (for 64 bit machines)
  96. Don't forget to leave root status (Ctrl-D) before loading FLTK. To install FLTK
  97. for every user, you either have to set root user again, or use "visudo" to add
  98. yourself to the "sudo" list.
  99. I like to use subversion to install the latest FLTK-1.3.release:
  100. svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
  101. To update to the latest version, just go into the fltk-1.3 directory and type
  102. svn update
  103. FIXME: no FL_SYMBOL font (-*-symbol-*), font 15 (Zapf-Dingbats)
  104. 2.8 SunOS / Solaris
  105. ----------------------
  106. SunOS is a commercial operating system from Sun Microsystems (in 2009 the
  107. company was sold to Oracle). SunOS is also called Solaris since version 5.
  108. There was an open source derivative called OpenSolaris (based on Solaris 10)
  109. that was cancelled by Oracle. The successor in spirit is called OpenIndiana
  110. and can be downloaded from here:
  111. http://www.openindiana.org/
  112. For FLTK you need at least SunOS 5.7 (aka Solaris 7). This version supports
  113. 64 bit machines and POSIX threads. For machines with 64 bit SPARC processors
  114. it is highly recommended to use Sun compilers, the 64 bit code generated by
  115. older versions of GCC for such machines is unusable (expect something between
  116. horribly broken and immediate crash).
  117. Consider using pkgsrc with this operating system. See the NetBSD section if
  118. you want to do so.
  119. If you have GCC and Sun compilers installed, configure your environment like
  120. this to use the Sun compilers and pkgsrc graphics libraries:
  121. export CC="cc"
  122. export CXX="CC"
  123. export CPPFLAGS="-I/usr/pkg/include"
  124. export LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib"
  125. To build a 64 bit FLTK library, add the following flags:
  126. export CFLAGS="-xarch=v9"
  127. export CXXFLAGS="-xarch=v9"
  128. 2.10 HP-UX
  129. -------------
  130. HP-UX is a commercial operating system from HP, no free or open source
  131. derivatives are available.
  132. For FLTK you need at least HP-UX 11.11 and the latest patch bundles should be
  133. installed.
  134. Consider using pkgsrc with this operating system. See the NetBSD section if
  135. you want to do so.
  136. 2.11 AIX
  137. -----------
  138. AIX is a commercial operating system from IBM, no free or open source
  139. derivatives are available.
  140. For FLTK you need at least AIX 5L, I have tested version 5.1 patched to ML9.
  141. Consider using pkgsrc with this operating system. See the NetBSD section if
  142. you want to do so.
  143. 2.12 NetBSD
  144. --------------
  145. NetBSD can be downloaded here:
  146. http://www.netbsd.org/
  147. If you have not done so yet, download and install NetBSD. Ensure that the
  148. optional distribution sets "comp" (Compiler, header files, development tools)
  149. and x*** (X Window System) are installed.
  150. Now install and configure pkgsrc. The current version can be downloaded here:
  151. http://www.pkgsrc.org/
  152. To use the current stable version of FLTK, simply install it from pkgsrc:
  153. cd /usr/pkgsrc/x11/fltk13
  154. bmake install
  155. For the latest development snapshot, first install the svn client from pkgsrc:
  156. cd /usr/pkgsrc/devel/subversion
  157. bmake install
  158. Now fetch the latest FLTK source code:
  159. svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
  160. To update to the latest version, just go into the fltk-1.3 directory and type
  161. svn update
  162. If you have installed JPEG and PNG libraries from pkgsrc, configure your
  163. environment as follows so that the FLTK configure script can find them:
  164. export CPPFLAGS="-I/usr/pkg/include"
  165. export LDFLAGS="-L/usr/pkg/lib"
  166. To install GNU autoconf from pkgsrc:
  167. cd /usr/pkgsrc/devel/autoconf
  168. bmake install
  169. 3 HOW TO BUILD FLTK USING GCC
  170. ================================
  171. 3.1 Downloading and Unpacking
  172. --------------------------------
  173. Download FLTK from here:
  174. http://www.fltk.org/software.php
  175. If you are familiar with "subversion" and like to stay current with your
  176. version, you will find the subversion access parameters at the bottom of that
  177. page. Unpack FLTK into a convenient location. I like to have everything in my
  178. dev directory:
  179. cd
  180. mkdir dev
  181. cd dev
  182. mv ~/Downloads/fltk-1.3.xxxx.tar.gz .
  183. tar xvfz fltk-1.3.xxxx.tar.gz
  184. cd fltk-1.3.xxxx
  185. 3.2 Configuring FLTK
  186. -----------------------
  187. If you got FLTK via subversion then you need one extra step. Otherwise skip
  188. over this part. Stay in your FLTK source-code directory and type the
  189. following:
  190. NOCONFIGURE=1 ./autogen.sh
  191. Now configure your FLTK installation:
  192. ./configure
  193. ADVANCED: type "./configure --help" to get a complete list of optional
  194. configurations parameters. These should be pretty self-explanatory. Some
  195. more details can be found in README.
  196. :END_ADVANCED
  197. The configuration script will check your machine for the required resources
  198. which you should have installed as described in the Prerequisites chapter. Review
  199. the Configuration Summary, maybe take some notes.
  200. 3.3 Building FLTK
  201. --------------------
  202. Now this is easy. Stay in your FLTK source-code directory and type:
  203. make
  204. The entire FLTK toolkit including many test programs will be built for you. No
  205. warnings should appear. If some do, please let the FLTK developer team know via
  206. the mailing list or the bug reporting template at www.fltk.org .
  207. Actually, as of Oct 28 2010, quite a bunch of warnings will show, mostly about
  208. suggested parenthesis. Please ignore them until we can fix them.
  209. 3.4 Testing FLTK
  210. -------------------
  211. After a successful build, you can test FLTK's capabilities:
  212. test/demo
  213. 3.5 Installing FLTK
  214. ----------------------
  215. If you did not change any of the configuration settings, FLTK will be installed
  216. in "/usr/local/include" and "/usr/local/lib" by typing
  217. sudo make install
  218. If you are using the KDE, GNOME or XFCE desktop environments and want to call
  219. "fluid" from the desktop menu, you will need to install additional files and
  220. icons under "/usr/share" by typing:
  221. sudo make install-desktop
  222. It is possible to install FLTK without superuser privileges by changing the
  223. installation path to a location within the user account by adding the
  224. "--prefix=PREFIX" parameters to the "./configure" command.
  225. 3.6 Creating new Projects
  226. ----------------------------
  227. FLTK provides a neat script named "fltk-config" that can provide all the flags
  228. needed to build FLTK applications using the same flags that were used to build
  229. the library itself. Running "fltk-config" without arguments will print a list
  230. options. The easiest call to compile an FLTK application from a single source
  231. file is:
  232. fltk-config --compile myProgram.cxx
  233. "fltk-config" and "fluid" will be installed in "/usr/local/bin/" by default. I
  234. recommend that you add it to the command search path.
  235. 4 CREATING A NEW PROJECT IN CODE::BLOCKS
  236. ===========================================
  237. Code::Blocks is a free and popular C++ IDE in the Linux world. It also runs on
  238. OS X and MSWindows. Configured correctly, it can also cross-compile between
  239. these platforms. This chapter focuses on creating a new FLTK project for Linux,
  240. assuming that FLTK 1.3 was previously built and installed in its default
  241. location from the command line.
  242. If not done yet, install Code::Blocks as described in the Prerequisites chapter
  243. above, or download it from their web site. This description is based on
  244. version 10.05:
  245. http://www.codeblocks.org/
  246. Start Code::Blocks. Select File > New > Project. In the "New from template"
  247. dialog box, click on "FLTK project" and follow the instructions.
  248. The default project support basic fltk. If you would like to add support for
  249. images, OpenGL, GLUT, or Forms, add the corresponding flags --use-images,
  250. --use-gl, --use-glut, and --use-forms respectively.
  251. The flags are located in the "Project Build Options" dialog. To change the
  252. compiler flags, select your project in the tree view, then select the
  253. "Compiler Settings" tab, then "Other Options" and add the flags to
  254. `fltk-config --cxxflags` in front of the second "`".
  255. The linker flags are located in the "Linker Settings" tab under "Other Linker
  256. Options". Add the flags to `fltk-config --ldstaticflags` in front of the
  257. second "`".
  258. CodeBlocks can be set up to use fluid to manage modules..
  259. The following info is from [email protected] posted on fltk.general 06/17/2013:
  260. """
  261. I have these settings in codeblocks on linux:
  262. Settings ->
  263. Compiler and debugging settings ->
  264. Other settings ->
  265. Advanced options:
  266. -- Add an extension (in my case "fl")
  267. -- On command line macro:
  268. cd $file_dir; fluid -c $file
  269. -- Generated files (to be further compiled):
  270. $file_dir/$file_name.cxx
  271. $file_dir/$file_name.h
  272. Settings -> Environment -> Files extension handling :
  273. Wildcard : *.fl
  274. To open file: Launch an external program
  275. External program: fluid
  276. With that I can double click on any fluid file I include on a project
  277. and it opens with fluid. When I press "run" or "build" codeblocks
  278. calls fluid to generate the c++ files and compiles if needed.
  279. """
  280. 5 DOCUMENT HISTORY
  281. =====================
  282. Oct 30 2010 - matt: added Code::Blocks chapter
  283. Oct 28 2010 - matt: restructured entire document and verified instructions
  284. Nov 14 2010 - duncan: added install-desktop
  285. Jun 17 2013 - erco: added mingodad's CodeBlocks/Fluid recommendations