Sign in Join
Wiki copytemporary

Deploying Your Application: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11You've created your application in Lazarus, tested within the IDE. Now it's time to deploy it to test it on a specific platform.
22
33## Windows Deployment
44
55### InnoSetup
66
77[[Inno Setup]] [1](http://www.jrsoftware.org/) is a free installer for Windows programs. It may be used completely free of charge, even when deploying commercial applications, full Delphi source code is available. See [[Inno Setup]] for more details and links to the Lazarus installer that is written using Inno.
88
99Features:
1010
1111- Inno supports all versions of Windows in use today -- Windows 95, 98, ME, NT4, 2000, 2003, XP, Vista, 7, 8. The latest version that can create installers for Windows versions before Windows 2000 is version 5.4. See [2](http://www.jrsoftware.org/files/is5-whatsnew.htm)
1212- It can compare file version info, replace in-use files, use shared file counting.
1313- It can register DLL/OCXs and type libraries
1414- It can install fonts.
1515- It can create shortcuts anywhere, including in the Start Menu and on the desktop.
1616- It can create registry and .INI entries
1717- It has integrated Pascal scripting engine that allows e.g. manipulation of COM/ActiveX objects (e.g. MS Word), setting firewall rules etc.
1818- It supports multilingual installs
1919- It supports passworded and encrypted installs
2020- It supports silent install and uninstall.
2121
2222While it is free for use, Inno Setup is copyrighted software, not public domain software. There are some restrictions on distribution and use; see the <http://www.jrsoftware.org/files/is/license.txt> file for details.
2323
2424Inno Setup is used to create the Lazarus installer for Windows.
2525
2626### HJ-Install
2727
2828HJ-Install is a freeware installer for Windows 95, 98, ME, NT 4.0, 2000 and XP. It is created with Internet distributed, CD-Rom, single-floppy and multi-floppy installations in mind, but it can also be used in network situations and as a stand-alone scripting engine. The installer is small and adds only 138 Kb. It doesn't support changing the registry and ini files, and un-install. See <http://www.freebyte.com/hjinstall/>
2929
3030### LizaJet Installer
3131
3232LizaJet Installer is a commercial installer, but a free edition is available. Uses Object Pascal for scripting. See <http://www.lizajet.com>
3333
3434### NSIS (Nullsoft Scriptable Install System)
3535
3636A professional open source system to create Windows installers. A full-featured NSIS installer has an overhead of only 34 KB. See <http://nsis.sourceforge.net/Main_Page> and <http://hmne.sourceforge.net/>
3737
3838### Windows Installer XML (WiX) toolset
3939
4040A toolset that builds Windows installation packages from XML source code. The toolset supports a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages. See <http://wix.sourceforge.net/>
4141
4242### Code signing
4343
4444For details of code signing Windows executables to avoid your end users receiving warnings that the publisher of the software is "unknown" when attempting to run your executable, see [[Code Signing for Windows]].
4545
4646## Linux Deployment
4747
4848### Creating a RPM Package on Linux
4949
5050On Linux, the best way to deploy applications is by using the native package system. Of the many package systems available, RPM (RedHat Package Manager) is the most commonly utilized format, and is defined as the standard one in the Linux Standard Base.
5151
5252To create a RPM file, you need to create a spec text file with the information necessary to build the software, and also an environment to build that spec. The best editor to create RPM packages is Emacs, because it recognizes the spec extension, highlights the text appropriately and even has a menu option to build rpm packages.
5353
5454To build the rpm file use either the emacs menu or this command line (man rpmbuild for more information):
5555
5656`rpmbuild -ba --clean $HOME/RPM/SPECS/myprogram.spec`
5757
5858#### Setting up your build environment
5959
6060RPM Packages are installed as root to the base system (/ directory), but an accident as root can destroy your machine. To avoid this, packages can be build as a normal user. The build process includes a real install, to make sure the package works, but this install is made to a fake root directory represented by the \$RPM_BUILD_ROOT variable.
6161
6262First, go to your home directory (or another directory inside it) and create the following directory structure:
6363
6464- RPM
6565- RPM/BUILD - This directory is utilized by RPM to build the package.
6666- RPM/RPMS - Here you can find binary RPMs after you build them.
6767- RPM/SOURCES - Place your compressed tar files and patches here.
6868- RPM/SPECS - Place all your spec files here.
6969- RPM/SRPMS - Here you can find source RPMs after you build them.
7070
7171Next you will need to create a configuration file to tell rpm builder software where he can find your build directories. Go to your home directory and create a file named .rpmmacros and place the text below on it. Make sure to change the directories to the correct ones on your system.
7272
7373 %_topdir /home/felipe/RPM/
7474 %_tmppath /home/felipe/tmp
7575
7676 %_signature gpg
7777 %_gpg_name Mandrakelinux
7878 %_gpg_path ~/.gnupg
7979
8080#### Creating a binary only package
8181
8282The easiest way to create a RPM package is to make it install already compiled software. There are some reason why we might want to avoid compiling the software in the spec file:
8383
8484- It requires creating a Makefile and makefiles are complex
8585
8686- Some packages don't have any binary software in them, so they don't need to be built.
8787
8888Each RPM Package contains a single compressed tar archive. Place the archive under the RPM/SOURCES directory. Zip, gz and bz2 compressions should work ok. The file can either contain the full source of the project if you with to create a source and a binary package or a directory with the files already in place, like if they were installed in the user machine, if you with to create a binary only package.
8989
9090To build a binary package open a spec file with Emacs text editor. On Emacs open the menu "RPM spec" --\> "RPM Build" --\> "Build Binary Package". This will create a .rpm file under the directory RPM/RPMS
9191
9292Below is a spec file that doesn't build the software. In this case the software is a Braille Course composed of html and Macromedia Flash files. Flash files cannot be build on Linux, so it's not possible to create a source package in this case.
9393
9494 %define name braillevirtual
9595 %define version 1.0
9696 %define release mdk
9797 %define dir braillevirtual
9898 %define root /home/felipe/tmp/ROOT/
9999
100100 Summary: Curso On-Line de Braille
101101 Name: %{name}
102102 Version: %{version}
103103 Release: %{release}
104104 Vendor: Laboratório de Brinquedos da Faculdade de Educação da USP
105105 URL: www.braillevirtual.fe.usp.br
106106 License: Distribuível livremente
107107 Group: Books/Other
108108 Packager: Felipe Monteiro de Carvalho
109109 Source0: home/felipe/Programacao/SOURCES/braillevirtual.tar.bz2
110110 BuildRoot: %{root}
111111
112112 %description
113113 O Braille Virtual é um curso on-line público e gratuito destinado à difusão e ensino do sistema Braille de leitura e escrita para cegos a pessoas que vêem. É orientado especialmente a pais, crianças, professores e funcionários de escolas inclusivas e pretende facilitar a comunicação entre estas pessoas e as pessoas com cegueira.
114114
115115 %prep
116116 cd $RPM_SOURCE_DIR
117117 cp braillevirtual.tar.bz2 $RPM_BUILD_DIR
118118 cd $RPM_BUILD_DIR
119119 rm -rf %{dir}
120120 rm -f braillevirtual.tar
121121 bunzip2 -d braillevirtual.tar.bz2
122122 tar -xvf braillevirtual.tar
123123
124124 %install
125125 mkdir -p $RPM_BUILD_ROOT/usr/share/
126126 rm -rf $RPM_BUILD_ROOT/usr/share/%{dir}
127127 cp -r $RPM_BUILD_DIR/%{dir} $RPM_BUILD_ROOT/usr/share/
128128
129129 %clean
130130 rm -rf $RPM_BUILD_DIR/*.*
131131
132132 %files
133133 /usr/share/%{dir}/
134134
135135 %changelog
136136
137137 * Mon Oct 24 2005 1.0-mdk.noarch.rpm
138138
139139 - Nova atualização do pacote de instalação. Inclusão dos exercícios avançados.
140140
141141 * Wed May 12 2005 1.0-mdk.noarch.rpm
142142
143143 - Atualizei o pacote para refletir as mudanças no site. Várias pequenas mudanças.
144144
145145 * Sun May 05 2005 1.0-1mdk.i586.rpm
146146
147147 - O pacote de instalação do braille Virtual para linux é criado.
148148
149149##### Tip:
150150
151151The following packages are required for an very basic GUI Application in GTK+ (binary only):
152152
153153` libc6                libx11-6         libgdk-pixbuf2.0-0         libgtk2.0-0         libglib2.0-0`\
154154` libpango-1.0-0       libcairo2    libatk1.0-0                libxcb1             libglib2.0-0`\
155155` libpangocairo-1.0-0  libxfixes3       libpangoft2-1.0-0          libfontconfig1      libxrender1`\
156156` libxinerama1         libxi6           libxrandr2                 libxcursor1         libxcomposite1`\
157157` libxdamage1          libxext6         libffi6                    libpcre3            libthai0`\
158158` libpixman-1-0        libfreetype6     libpng12-0                 libxcb-shm0         libxcb-render0`\
159159` zlib1g               libxau6          libxdmcp6                  libselinux1         libharfbuzz0b`\
160160` libexpat1            libdatrie1       libgraphite2-3`
161161
162162You can get a list of used libraries with: `ldd [executable of your project]`.
163163
164164And find the packages in which it belongs:
165165
166166RPM based: `rpm -qf <lib name>`
167167
168168DEB based: `dpkg -S <lib name>`
169169
170170Where \<lib name\> is the name of library, before =\> or ")" in list
171171
172172Example: `rpm -qf libgtk-x11-2.0.so.0`
173173
174174A script (DEB based) using pipes, in order to join all these commands in a single command line, could be (replace 'amd64' by 'i386' if you install 32 bits packages):
175175
176176` $ ldd yourAppli | awk '/=>/{print $(NF-1)}' | while read n; do dpkg -S $n; done | awk '{print $1}' | sed 's/:amd64://' | sort | uniq | while read n; do echo "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --> Usefullness of the package named $n:"; apt-cache search ^$n; echo "...which installs the following libraries on the system:"; dpkg -L $n |grep .so; echo "...and which depends itself on the following packages on the system:"; apt show $n | grep Depends; done;`
177177
178178#### Creating a source and binary package
179179
180180Linux distributions only accept RPM packages that can build the software. This will probably require creating build scripts and/or a Makefile. For more information see the section Creating a Makefile for your Lazarus software.
181181
182182You need to use the %build section to compile the software. Below is an example of a spec file capable of building the software. Be very careful when studying this as every little detail is important and follows a precise pattern.
183183
184184```text
185185 Name: magnifier
186186 Version: 3.2.1
187187 Release: 1
188188 Summary: Virtual Magnifying Glass
189189 Group: Accessibility
190190 License: GPL Version 2
191191 URL: http://magnifier.sourceforge.net
192192 Source0: http://internap.dl.sourceforge.net/sourceforge/magnifier/magnifier-3.2.1.zip
193193 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
194194 BuildRequires: fpc >= 2.0.2, lazarus >= 0.9.12
195195 Requires: ImageMagick
196196
197197 %description
198198 Virtual Magnifying Glass is a free, open source, multiplatform, screen magnification tool. It is simple, customizable, and easy-to-use.
199199
200200 %prep
201201 %setup -q magnifier
202202 %build
203203 make TARGET=%{_target_cpu}
204204
205205 %install
206206 ./install.sh DESTDIR=$RPM_BUILD_ROOT
207207
208208 %clean
209209 rm -rf $RPM_BUILD_ROOT/
210210
211211 %files
212212 %defattr(-,root,root,-)
213213 /usr/share/magnifier/
214214 /usr/bin/magnifier
215215
216216 %changelog
217217 * Wed Feb 15 2006 Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com> - 3.2-mdk.i386.rpm
218218 - The Linux RPM package is created.
219219```
220220
221221### Creating a Debian Package on Linux
222222
223223Debian packages are similar to installers. They can be downloaded by users from a website or ftp. You can craft them manually from the binary file by using their [[Debian package structure|specific structure]] and a .deb extension. However, they will not be automatically included in Debian distributions.
224224
225225If you want to make a package available into Debian distributions, you need to provide a [[Debian upstream|source upstream]] that can generate the Debian package as well as other files like the .orig.tar.gz and .dsc file. Those will be necessary for anybody to build your package for their target platform.
226226
227227There is an IDE plugin here: <https://github.com/prof7bit/LazPackager>
228228
229229### Creating a Pacman (Arch) Package
230230
231231Please see <https://wiki.freepascal.org/pacman>
232232
233233### Automating the creation of RPM and DEB packages
234234
235235To simplify the work of creating RPM and DEB packages one can create a script which generates them, just like is done here:
236236
237237<http://sourceforge.net/p/magnifier/code/HEAD/tree/trunk/build/build_package.sh>
238238
239239### Snap
240240
241241See [[Create snap package]].
242242
243243### Flatpak
244244
245245See [[Flatpak]].
246246
247247### GUInseng
248248
249249[GUInseng](http://www.guinseng.de/) is a a GTK+ based installer for Linux released under GPL.
250250
251251### The Zero Install system
252252
253253[The Zero Install system](http://0install.net/) is a Python based install system that aims to provide a better way of installing software than traditional systems (tarballs, apt-get, bundles, setup.exe, etc).
254254
255255### Simple deployment of Lazarus application directly to Desktop Environment (e.g., KDE Plasma 5/Manjaro)
256256
257257One of the first things anyone coming from Delphi/Windows environment wants to know is how to QUICKLY deploy a newly-created Linux GUI program outside of the IDE, without spending a lot of time having to first study various package management systems. Unlike Windows, Linux is a disparate collection of Distributions ("Distros" - e.g., Debian, Arch, Ubuntu, etc.) and Desktop Environments ("DE" - e.g., KDE, Gnome, XFCE, Mate, etc.) Deployment entails some knowledge of one's Disto and DE, however the learning curve and effort is a tiny fraction of the effort required to set up and use an installation package system (e.g., DEB or RPM installation systems). The following focuses on Manjaro (ArchLinux) Distribution running the KDE Plasma 5 Desktop Environment. Before getting started, the following are required.
258258
259259*Prerequisites*
260260
261261**You must know the Path to your application's Binary.** It will be located in the Target directory that you specified under *Project Options*. If you just left default settings, the Binary will be located for example for Linux x86-64 target at: *\[...\]/MyProgram/lib/x86_64-linux*. The file will generally not have any extension (no *.exe*) and will have the same name as your Project. Linux executable binaries typically either have .bin extension or no extension.
262262
263263**You must have sufficient rights to the file.** By default, Lazarus should have created the file with your username and group as owner. If not for some reason, change ownership using *chown* terminal command or file manager, if available. (KDE Dolphin no longer allows *sudo* changes within the file manager.)
264264
265265**The file must be executable.** Lazarus should have already set the file to be executable, but if not, change this using *chmod* or file manager, if available.
266266
267267**As inital test, make sure your application can be launched directly from the Terminal.** For example, within the same directory as you application binary (e.g., MyProgram) execute:
268268
269269``` bash
270270 $ ./MyProgram
271271```
272272
273273Make sure you can launch your application from Terminal before proceeding.
274274
275275*Desktop entries*
276276
277277To get your application to correctly launch in your Desktop Environment, you have to tell it some information by way of creating a *Desktop Entry* file ending in *.desktop* extension. This is simply a text file located in a particular directory and having specific keys. For Manjaro/ArchLinux, the following is helpful reference material:
278278
279279ArchLinux Desktop Entries [3](https://wiki.archlinux.org/index.php/Desktop_Entries)
280280
281281The foregoing is simply a guide, not to be taken too literally. For example, for KDE Plasma 5 on Manjaro, use of separate Path and Exec keys does NOT work. Instead, a single Exec with the application binary's full path is required. You can uncover such details and quirks by examining the existing .desktop files of other applications already installed for your particular Distro and DE.
282282
283283Using the example of KDE Plasma 5 on Manjaro, proceed as follows, using hypothetical *MyApp* application program just created with Lazarus. Determine the location for *.desktop* files. For Manjaro, these were found to be at */usr/share/applications/*. Now, create your *.desktop* file:
284284
285285``` bash
286286 $ sudo nano /usr/share/applications/myapp.desktop
287287```
288288
289289By convention, use lowercase for the foregoing file name. Now, enter your application details (using hypothetical "MyApp" application binary).
290290
291291``` bash
292292 [Desktop Entry]
293293 Type=Application
294294 # Change Name to your application
295295 Name=My Application
296296 # Change icon to your icon - leave OFF any file extension
297297 Icon=myappicon
298298 Comment=My First App
299299 # The FULL path to the folder in which the executable is run
300300 # Change to your actual application binary's full path
301301 Exec=/mysamplepath/Lazarus/MyApp/lib/x86_64-linux/MyApp
302302 Terminal=false
303303 # Sample Category - will determine where it is listed in Menu tree
304304 Categories=Office;
305305```
306306
307307You will be storing your icon separately, as required by your DE, so that it may be displayed in the DE's menu along with your application name. In Manjaro, icons are required to be placed at */usr/share/pixmaps*. If needed, a good source for icons is available at: Open Icon Library [4](https://sourceforge.net/projects/openiconlibrary/) For KDE Plasma 5 on Manjaro, 48x48 PNGs work well. Note that you must leave .png extension off above icon reference to avoid validation errors. Now validate your Desktop Entry file:
308308
309309``` bash
310310 $ sudo desktop-file-validate /usr/share/applications/myapp.desktop
311311```
312312
313313Correct any errors. Finally, complete installation by updating the DE's desktop database:
314314
315315``` bash
316316 $ sudo update-desktop-database
317317```
318318
319319Your application should now be listed in KDE's menu tree and easily launched with mouse click. If you need to clean up KDE's menu (e.g., delete incorrect menu item), launch *kmenuedit* from Terminal or right click (if available) directly on menu item.
320320
321321### See also
322322
323323- [[Create snap package|How to create an Ubuntu snap package]]
324324- [[Publish project on Launchpad]]
325325
326326## Creating a Makefile for your Lazarus software
327327
328328The following is a command line build system for a Lazarus software. This is particularly useful if you wish to create an RPM package suitable for including on GNU/Linux distributions. The comments on the files should explain what each part does.
329329
330330make.sh
331331
332332``` bash
333333# Detects and parses the architecture
334334ARCH=$(uname -m)
335335
336336case "$ARCH" in
337337 "i686") ARCH="i386";;
338338 "i586") ARCH="i386";;
339339 "i486") ARCH="i386";;
340340esac
341341
342342echo "Target architecture: $ARCH"
343343
344344# Detects and parses the OS
345345OS="linux"
346346
347347echo "Target operating system: $OS"
348348
349349# Command line to build the sofware
350350fpc -S2cgi -OG1 -gl -WG -vewnhi -l -Fu/usr/lib/lazarus/components/opengl/gtk2x11/ -Fi/usr/lib/lazarus/components/opengl/gtk2x11/include/ -Fu/usr/lib/lazarus/components/jpeg/ -Fu/usr/lib/lazarus/lcl/units/$ARCH-$OS/ -Fu/usr/lib/lazarus/lcl/units/$ARCH-$OS/ -Fu/usr/lib/lazarus/lcl/units/$ARCH-$OS/gtk2/ -Fu/usr/lib/lazarus/packager/units/$ARCH-$OS/ -Fu. -o./magnifier -dLCL -dLCLgtk2 magnifier.dpr
351351```
352352
353353install.sh
354354
355355``` bash
356356# Parses command line options. Currently supported options are:
357357# DESTDIR Destination root directory
358358
359359DESTDIR=""
360360
361361for arg; do
362362 case $arg in
363363 DESTDIR=*) DESTDIR=${arg#DESTDIR=};;
364364 esac;
365365done
366366
367367# Does the install
368368# "mkdir -p" is equivalent to ForceDirectories Pascal function
369369
370370mkdir -p $DESTDIR/usr/share/magnifier
371371
372372cp ./topleft.bmp $DESTDIR/usr/share/magnifier/
373373cp ./topright.bmp $DESTDIR/usr/share/magnifier/
374374cp ./bottomleft.bmp $DESTDIR/usr/share/magnifier/
375375cp ./bottomright.bmp $DESTDIR/usr/share/magnifier/
376376cp ./top.bmp $DESTDIR/usr/share/magnifier/
377377cp ./left.bmp $DESTDIR/usr/share/magnifier/
378378cp ./bottom.bmp $DESTDIR/usr/share/magnifier/
379379cp ./right.bmp $DESTDIR/usr/share/magnifier/
380380cp ./icon3.ico $DESTDIR/usr/share/magnifier/
381381
382382mkdir -p $DESTDIR/usr/bin
383383
384384cp ./magnifier $DESTDIR/usr/bin/
385385```
386386
387387clean.sh
388388
389389``` bash
390390rm -rf *.o
391391rm -rf *.ppu
392392rm -rf *.pas~
393393rm -rf *.sh~
394394rm -rf *.bak
395395rm -rf *~
396396rm -rf magnifier
397397```
398398
399399uninstall.sh
400400
401401``` bash
402402#
403403# Don´t use "rm -rf" in here, because you should only remove the files you created
404404rm -f /usr/share/magnifier/topleft.bmp
405405rm -f /usr/share/magnifier/topright.bmp
406406rm -f /usr/share/magnifier/bottomleft.bmp
407407rm -f /usr/share/magnifier/bottomright.bmp
408408rm -f /usr/share/magnifier/top.bmp
409409rm -f /usr/share/magnifier/left.bmp
410410rm -f /usr/share/magnifier/bottom.bmp
411411rm -f /usr/share/magnifier/right.bmp
412412rm -f /usr/share/magnifier/icon3.ico
413413rm -f /usr/share/magnifier/magnifier
414414rm -f /usr/bin/magnifier
415415rmdir /usr/share/magnifier
416416```
417417
418418Makefile
419419
420420``` bash
421421# Targets
422422# The First target is the one build when there is nothing on make command line
423423all:
424424 ./make.sh
425425clean:
426426 ./clean.sh
427427install:
428428 ./install.sh
429429uninstall:
430430 ./uninstall.sh
431431```
432432
433433## macOS Deployment
434434
435435### An Application Bundle
436436
437437See [[Application Bundle]] for information on how to create an application bundle (a directory with application files that is treated by macOS as an executable).
438438
439439Most macOS applications are distributed as a disk image file (.dmg extension). Normally you download or copy a program's disk image to your Mac and double-click it. This mounts the disk image and opens a window on the desktop, where you'll typically see an application bundle as described in the previous point. To install, a user simply drags the bundle to the hard drive, typically into his or the general Applications folder. Therefore, many disk images present a link to the general Applications folder for easier dragging. "Uninstalling" is by deleting the bundle.
440440
441441Once the installation is complete, you eject (unmount) the mounted disk image, for example by dragging it to the trash. You can also delete the .dmg file by dragging it to the trash as well.
442442
443443Your bonus point is, if the application can also run directly from the (read-only) disk image.
444444
445445Here is the `app2dmg.sh` script which I use to create a .dmg file for an application bundle:
446446
447447``` sh
448448#!/bin/sh
449449
450450if [ "${1}" = "" ]
451451 then
452452 echo "Usage: app2dmg.sh app_name.app disk_size_in_mb"
453453 exit
454454fi
455455
456456if [ "${2}" = "" ]
457457 then
458458 echo "Usage: app2dmg.sh app_name.app disk_size_in_mb"
459459 exit
460460fi
461461
462462if [ ! -r "${1}" ]
463463 then
464464 echo "${1} is not in the current directory!"
465465 exit
466466fi
467467
468468APP=`echo "${1}" | sed "s/\.app//"`
469469DATE=`date "+%d%m%Y"`
470470VOLUME="${APP}_${DATE}"
471471
472472echo "Application name: ${APP}"
473473echo "Volume name: ${VOLUME}"
474474
475475if [ -r ${APP}*.dmg.sparseimage ]
476476 then
477477 rm ${APP}*.dmg.sparseimage
478478fi
479479
480480hdiutil create -size ${2}M -type SPARSE -volname "${VOLUME}" -fs HFS+ ${VOLUME}.dmg
481481
482482hdiutil attach ${VOLUME}.dmg.sparseimage
483483cp -R ${APP}.app "/Volumes/${VOLUME}/"
484484cp README_FIRST.TXT "/Volumes/${VOLUME}/"
485485hdiutil detach -force "/Volumes/${VOLUME}"
486486
487487hdiutil convert "${VOLUME}.dmg.sparseimage" -format UDBZ -o "${VOLUME}.dmg" -ov -imagekey zlib-level=9
488488rm ${VOLUME}*.dmg.sparseimage
489489```
490490
491491You can also read [this guide](http://el-tramo.be/guides/fancy-dmg) for how to create a fancy disk image.
492492
493493### Using Packages on macOS
494494
495495The Apple `pkgbuild` and `productbuild` command line tools can produce package .pkg files or the aptly named, third party GUI [`Packages`](http://s.sudre.free.fr/Software/Packages/about.html) application which builds flat packages (cf bundle-style packages built by the same author's GUI [`Iceberg`](http://s.sudre.free.fr/Software/Iceberg.html) application.
496496
497497If you absolutely require that several files are installed in different locations, then (and only then!) should you create a package file (.pkg extension) for the Apple Installer. This package file can then be moved, downloaded or emailed. Once the end user has it, they can double-click the package and the `Installer.app`, which will perform the installation, is launched.
498498
499499Package files have certain advantages:
500500
501501- You have control over permissions;
502502- Multiple files can be placed in different locations;
503503- You can run scripts as part of the installation process;
504504- A logged-in user is not needed to install a package;
505505- Most, if not all, Mac management systems can install Apple installer packages.
506506
507507The installer .pkg file is actually a directory, as is the resulting application bundle (.app extension) that it copies to the Applications folder. To the user, .pkg and .app files look and act like ordinary files, but they're really directories whose details have been hidden from the user. You can see what's inside a .pkg or .app file by entering normal `cd` commands in a Terminal window (for example, `cd progname.app`) or by Ctrl-Clicking the file and choosing *Show Package Contents* from the popup menu.
508508
509509To create a .dmg file, run the macOS Disk Utility (located in Applications \> Utilities). Select Images \> New \> Image from Folder and choose the folder containing your .pkg file and any other files you want to include in the disk image. In the Convert Image dialog, enter the name of the .dmg file to create, select where it should be saved, and select "compressed" as the image format. The .dmg file that Disk Utility creates is then ready for distribution.
510510
511511### Installing X11 and GTK on macOS
512512
513513GUI apps created with Lazarus that use the GTK widgetset require X11 and the GTK libraries to run. The [XQuartz open source project](https://www.xquartz.org) `X11.app` was shipped with Leopard 10.5 through Lion 10.7 as an optional installation. After Lion 10.7, Apple stopped providing X11 but it can still be downloaded from the XQuartz project website.
514514
515515To install the GTK libraries on a user's system, you should include instructions for using [Fink](http://www.finkproject.org/) or [MacPorts](http://www.macports.org/). Do *not* manually package the libraries and install those in the default Fink/MacPorts locations, because then they may be overwritten in case the user decides to install one of these distributions. A good practice is to put those libraries in the application bundle itself, which requires [using the install_name_tool](http://qin.laya.com/tech_coding_help/dylib_linking.html) program. Putting them somewhere else is possible, but in most cases not conform to the Apple Guidelines as well as not what users expect. Before simply using directories common to other systems, you should carefully read the guidelines about the file system layout [File System Overview](http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFileSystem/BPFileSystem.html).
516516
517517### Code signing and Notarization
518518
519519See [[Code Signing for macOS]] (required from macOS 10.7+) and [[Notarization for macOS 10.14.5+|Notarization for macOS]] (required from macOS 10.14.5+).
520520
521521Note: It is still possible not to code sign and notarise your applications if you do not mind your endusers facing scary warning dialogs from Apple - Gatekeeper can (still) be by-passed by Conctrol-Clicking on the application or right clicking on the application for the context menu, and then choosing *Open* and not *Move to trash* or *Cancel*. Notarization requires you to enrol in the [Apple Developer Program](https://developer.apple.com/programs/) (\$US 99 annually).
522522
523523### See also
524524
525525- [Apple's Software Delivery Legacy Guide](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/SoftwareDistribution4/Introduction/Introduction.html).
526526
527527- [The Luggage](https://github.com/unixorn/luggage/wiki) Uses a Makefile describing where you want each file in the package to end up on the target machines with rules that will generate a package root with appropriate permissions, copy the files into place, create a package version-stamped with the date, then wrap the package in a disk image file. This allows packages to be built in a consistent and repeatable way using source files and scripts.
528528
529529- [munkipkg](https://github.com/munki/munki-pkg) is a simple tool for building packages in a consistent, repeatable manner from source files and scripts in a project directory. Files, scripts, and metadata are stored in a way that is easy to track and manage using a version control system like git.
530530
531531- [[macOS PackageMaker]] - legacy - discontinued after Xcode 4.4.
532532
533533## Android Deployment
534534
535535(This information needs to be consolidated here and the below links adjusted)
536536
537537- [[Android]]
538538- [[FPC JVM Android Development]]
539539- [[Android Programming]]
540540
541541## Apple iOS Deployment
542542
543543(This information needs to be consolidated here and the below links adjusted)
544544
545545- [[iOS Designer]]
546546- [[Portal:iOS|iOS Portal]]
547547- [[iPhone/iPod development]]
548548
549549## Other, General Cross-Platform Deployment
550550
551551### BitRock
552552
553-<figure>
554-<img src="gui-newproject.png" title="|600px" />
555-<figcaption>|600px</figcaption>
556-</figure>
553+![](/wiki-images/2/28/Gui-newproject.png)
557554
558555[[BitRockInstallBuilder|Bitrock]] (website www.bitrock.com) make an installer that will deploy to Windows, Mac OS and many flavors of Linux. If your application is open-source, they will give you a full license to download and use their 'InstallBuilder' application.[[http://installbuilder.bitrock.com/open-source-licenses.html Application form link]]. Commercial application licenses are available.
559556
560557### fpGUI Installer
561558
562559This is a cross-platform CLI and GUI installer. It is loosely based on the concept of the Loki Installer (implemented in the C programming language) created by [Loki Games](http://www.lokigames.com/). The difference being that fpGUI Installer is implemented from scratch using Object Pascal and the fpGUI Toolkit for the GUI parts. This installer is still under active development, but to date no public release has been made. A public release is planned though. No official name has been given to this project either - thus the not ideal "fpGUI Installer" name.
563560
564561Here is a screenshot of fpGUI Installer replacing the original Kylix 3 installer: ![fpGUI Installer\|400px](/wiki-images/b/b5/Fpgui_installer.png)
565562
566563Features:
567564
568565- Installer setup is done via an easily managed XML file. A GUI front-end is used to edit the XML, but it can be done by hand too.
569566- CD-ROM or Downloadable installers. The difference being that the CD-ROM installer is normally unpacked and multiple languages, tools etc are included. A Downloadable installer is a single file download and normally packaged for a specific language.
570567- Automatic icon shortcut generation
571568- No external libraries or runtime environments required. The idea is that a installer must not have system requirements (eg: a JVM or the Qt library etc), hence fpGUI toolkit was used for the GUI installer, because it talks directly to GDI or X11.
572569- Command Line Installer and GUI Installer included as standard.
573570- Support uninstall as well
574571- fpGUI Installer has been tested on Windows (Win98 thru Win7), Linux (various distros), FreeBSD and OpenSolaris.
575572- Supports 32-bit and 64-bit setup files.
576573- Group installer mode: The installer can present a user friendly interface to install multiple other projects.
577574- Customisable graphics banner and UI theme.
578575
579576### InstallJammer
580577
581578InstallJammer is a multiplatform GUI installer designed to be completely cross-platform and function on Windows and most all versions of UNIX.
582579
583580InstallJammer features a very powerful install builder with support for multiple themes and a high level of configurability for installers. Installers are built as single executable files for easy distribution over the web and handle installing everything you need for your application in a simple, cross-platform way.
584581
585582- Active development of InstallJammer has been discontinued. The source is available for all versions and will always remain so, but your efforts might be better spent on an installer that is active in its development.
586583- Download: <https://sourceforge.net/projects/installjammer/files/InstallJammer/>
587584- Documentation: <http://installjammer.com/docs/>
588585
589586### CMake/CPack
590587
591588CMake is a multiplatform build system that manages the compilation, linking, testing, and setup creation process. It is mainly intended for C/C++ software development, but can also be used for creating setups for Lazarus/FPC projects. The part of CMake that creates the setups is called CPack and is actually a front-end for other software packages that do the real work. In an FPC context, you would write a CMakeLists.txt file that contains lists of files to be installed and then have CPack call NSIS/WiX/... to perform the actual work.
592589
593590Features:
594591
595592- Windows (32+64 Bit), Linux, macOS support
596593- Works with all important back-ends (NSIS, WiX, DEB...)
597594- Just one text file CMakeLists.txt needs to be mainained for all target platforms
598595- Multi-platform setups can be created with minimal work
599596- Download: <http://www.cmake.org/>
600597
601598Using CMake/CPack makes most sense if you have a mixed-language project with Pascal and C/C++ parts that all go into one installer, and you need a platform-independent solution for both parts. If you have a pure FPC project, the overhead might be too much for you.
602599
603600---
604601*From the Free Pascal wiki, page "Deploying Your Application", as it stood on 2023-11-20 after a change by Chronos, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history