Sign in Join
Wiki copytemporary

Deploying Your Application/ja: what changed

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

OldNewLine
1-## Contents
2-
3- * 1 Windows のインストーラ
4- * 1.1 Inno Setup
5- * 1.2 InstallJammer
6- * 1.3 HJ-Install
7- * 1.4 LizaJet Installer
8- * 1.5 NSIS (Nullsoft Scriptable Install System)
9- * 1.6 Windows Installer XML (WiX) toolset
10- * 2 Unix のインストーラー
11- * 2.1 Linux 上で RPM パッケージを作る
12- * 2.1.1 構築環境を設定する
13- * 2.1.2 バイナリパッケージを作る
14- * 2.1.3 ソースとバイナリのパッケージを作る
15- * 2.2 Linux 上で Debian のパッケージを作る
16- * 2.3 GUInseng
17- * 2.4 The Zero Install system
18- * 2.4.1 Anyone can install software
19- * 2.4.2 Anyone can distribute software
20- * 2.4.3 It doesn't matter whether software is installed or not
21- * 2.4.4 Security
22- * 3 Creating a Makefile for your Lazarus software
23- * 4 macOS のインストーラー
24- * 4.1 macOS のパッケージメーカー(PackageMaker)を使う
25- * 4.2 macOS に X11 と GTK をインストールする
26-
271## Windows のインストーラ
282
293Window にはフリーでオープンソースなインストーラーが多く作成されているため、これらの利用をお勧めします。
304
315### Inno Setup
326
337[Inno Setup](<http://www.jrsoftware.org/isinfo.php>) は Windows 用のフリーでオープンソースなインストーラーであり、商用にも自由に利用できます。 (ソースは Borland Delphi 2.0-5.0 用となっています。)
348
359現在利用されている全てバージョンの Windows -- Vista, XP, 2008, 2003, 2000, Me, 98, 95, and NT 4.0. (サービスパックは不要) -- をサポートしており、ファイルのバージョン情報の比較、使用中のファイルの置き換え、レジストリと .ini ファイルへのエントリ作成など、多くの機能があります。[[1]](<http://www.jrsoftware.org/isinfo.php#features>)
3610
3711パブリックドメインではありませんので、配布や利用には制約があります。 詳細は、[ライセンス](<http://www.jrsoftware.org/files/is/license.txt>) を確認してください。
3812
3913Inno Setup は、 Windows 用の Lazarus インストーラーにも利用されています。
4014
4115### InstallJammer
4216
4317[InstallJammer](<http://www.installjammer.com/>) は、マルチプラットフォームなオープンソースの GUI インストーラーです。 完全なクロスプラットフォームとなるようにデザインされており、Windows、UNIX の多くのバリエーションのほぼ全て、Mac OS X で利用できます。
4418
4519### HJ-Install
4620
4721HJ-Install は、Windows 95, 98, ME, NT 4.0, 2000, 2003, XP, Vista 用のフリーウェアのインストーラーです。 インターネット上やCD-Rom、1枚または複数枚のフロッピーディスクで配布されることを考慮して作られています。 しかし、ネットワークからもスタンドアローンのスクリプトエンジンとして利用できます。 インストーラーと他ファイルの合計で138kbと軽いサイズです。 レジストリと ini ファイルの変更、アンインストールはサポートしていません。 詳細は、[ウェブサイト](<http://www.freebyte.com/hjinstall/>) を確認してください。
4822
4923### LizaJet Installer
5024
5125LizaJet Installer は商用のインストーラーですがフリー版もあります。 Object Pascal をスクリプトに用いています。 詳細は、 [ウェブサイト](<http://www.lizajet.com>) を確認してください。(訳注:09時点でウェブサイトは404エラーですが、インストーラ名で検索すると数多くヒットします。)
5226
5327### NSIS (Nullsoft Scriptable Install System)
5428
5529NSIS はプロ向けのオープンソースなシステムであり、 Windows 用のインストーラーを生成できます。 NSIS インストーラーは34kbの大きさです。 詳細は、[ウェブサイト](<http://nsis.sourceforge.net/Main_Page>) または、 [エディター](<http://hmne.sourceforge.net/>) を確認してください。
5630
5731### Windows Installer XML (WiX) toolset
5832
5933XML ファイルから Windows用インストールパッケージを作成します。 開発者がビルドプロセスをMSIやMSMといったセットアップパッケージに統合できるように、コマンドライン環境もサポートしています。 詳細は、[ウェブサイト](<http://wix.sourceforge.net/>) を確認してください。
6034
6135## Unix のインストーラー
6236
6337### Linux 上で RPM パッケージを作る
6438
6539On 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.
6640
6741To create a RPM file, you need to create a spec text file will 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.
6842
6943To build the rpm file use either the emacs menu or this command line (man rpmbuild for more information):
7044```
7145rpmbuild -ba --clean $HOME/RPM/SPECS/myprogram.spec
7246```
7347
7448#### 構築環境を設定する
7549
7650RPM 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 use. 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.
7751
7852First, go to your home directory (or another directory inside it) and create the following directory structure:
7953
8054RPM
8155
8256RPM/BUILD - This directory is utilized by RPM to build the package.
8357
8458RPM/RPMS - Here you can find binary RPMs after you build them.
8559
8660RPM/SOURCES - Place your compressed tar files and patches here.
8761
8862RPM/SPECS - Place all your spec files here.
8963
9064RPM/SRPMS - Here you can find source RPMs after you build them.
9165
9266Next 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 bellow on it. Make sure to change the directories to the correct ones on your system.
9367```
9468%_topdir /home/felipe/RPM/
9569 %_tmppath /home/felipe/tmp
9670
9771 %_signature gpg
9872 %_gpg_name Mandrakelinux
9973 %_gpg_path ~/.gnupg
10074```
10175
10276#### バイナリパッケージを作る
10377
10478The 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:
10579
10680 * It requires creating a Makefile and makefiles are complex
10781
10882 * Some packages don't have any binary software in them, so they don't need to be built.
10983
11084Each 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.
11185
11286To 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
11387
11488Bellow 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.
11589```
11690%define name braillevirtual
11791 %define version 1.0
11892 %define release mdk
11993 %define dir braillevirtual
12094 %define root /home/felipe/tmp/ROOT/
12195
12296 Summary: Curso On-Line de Braille
12397 Name: %{name}
12498 Version: %{version}
12599 Release: %{release}
126100 Vendor: Laboratório de Brinquedos da Faculdade de Educação da USP
127101 URL: www.braillevirtual.fe.usp.br
128102 License: Distribuível livremente
129103 Group: Books/Other
130104 Packager: Felipe Monteiro de Carvalho
131105 Source0: home/felipe/Programacao/SOURCES/braillevirtual.tar.bz2
132106 BuildRoot: %{root}
133107
134108 %description
135109 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.
136110
137111 %prep
138112 cd $RPM_SOURCE_DIR
139113 cp braillevirtual.tar.bz2 $RPM_BUILD_DIR
140114 cd $RPM_BUILD_DIR
141115 rm -rf %{dir}
142116 rm -f braillevirtual.tar
143117 bunzip2 -d braillevirtual.tar.bz2
144118 tar -xvf braillevirtual.tar
145119
146120 %install
147121 rm -rf $RPM_BUILD_ROOT/usr/share/%{dir}
148122 cp -r $RPM_BUILD_DIR/%{dir} $RPM_BUILD_ROOT/usr/share/
149123
150124 %clean
151125 rm -rf $RPM_BUILD_DIR/*.*
152126
153127 %files
154128 /usr/share/%{dir}/
155129
156130 %changelog
157131
158132 * Mon Oct 24 2005 1.0-mdk.noarch.rpm
159133
160134 - Nova atualização do pacote de instalação. Inclusão dos exercícios avançados.
161135
162136 * Wed May 12 2005 1.0-mdk.noarch.rpm
163137
164138 - Atualizei o pacote para refletir as mudanças no site. Várias pequenas mudanças.
165139
166140 * Sun May 05 2005 1.0-1mdk.i586.rpm
167141
168142 - O pacote de instalação do braille Virtual para linux é criado.
169143```
170144
171145#### ソースとバイナリのパッケージを作る
172146
173147Linux 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 [[Deploying Your Application|Deploying_Your_Application#Creating_a_Makefile_for_your_Lazarus_software]].
174148
175149You need to use the %build section to compile the software.
176150
177151Bellow is an example of a spec file capable of building the software. Be very careful when studing this as every little detail is important and follows a precise pattern.
178152```
179153Name: magnifier
180154 Version: 3.2.1
181155 Release: 1
182156 Summary: Virtual Magnifying Glass
183157 Group: Accessibility
184158 License: GPL Version 2
185159 URL: http://magnifier.sourceforge.net
186160 Source0: http://internap.dl.sourceforge.net/sourceforge/magnifier/magnifier-3.2.1.zip
187161 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
188162 BuildRequires: fpc >= 2.0.2, lazarus >= 0.9.12
189163 Requires: ImageMagick
190164
191165 %description
192166
193167 Virtual Magnifying Glass is a free, open source, multiplatform, screen magnification tool. It is simple, customizable, and easy-to-use.
194168
195169 %prep
196170 %setup -q magnifier
197171
198172 %build
199173 make TARGET=%{_target_cpu}
200174
201175 %install
202176 ./install.sh DESTDIR=$RPM_BUILD_ROOT
203177
204178 %clean
205179 rm -rf $RPM_BUILD_ROOT/
206180
207181 %files
208182 %defattr(-,root,root,-)
209183 /usr/share/magnifier/
210184 /usr/bin/magnifier
211185
212186 %changelog
213187
214188 * Wed Feb 15 2006 Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com> - 3.2-mdk.i386.rpm
215189 - The Linux RPM package is created.
216190```
217191
218192### Linux 上で Debian のパッケージを作る
219193
220194Please, write me.
221195
222196In the mean time have a look at this tutorial written by IBM.
223197<http://www-128.ibm.com/developerworks/linux/library/l-debpkg.html>
224198
225199### GUInseng
226200
227201[GUInseng](<http://www.guinseng.de/>) is a a GTK+ based installer for Linux released under GPL.
228202
229203### The Zero Install system
230204
231205[The Zero Install system](<http://0install.net/>) aims to provide a better way of installing software than traditional systems
232206
233207(tarballs, apt-get, bundles, setup.exe, etc). Here are some of yours goals:
234208
235209#### Anyone can install software
236210
237211You don't have to be the administrator (root) just to install a word-processor.
238212
239213#### Anyone can distribute software
240214
241215You don't need to be blessed by a distribution (or anyone else) to be part of Zero Install. The system is completely
242216
243217decentralised.
244218
245219#### It doesn't matter whether software is installed or not
246220
247221You just run it. Zero Install handles the rest (downloading and caching as needed).
248222
249223#### Security
250224
251225If one user downloads a malicious program, other users aren't affected. Users can share downloads without having to trust
252226
253227each other. Installation does not execute any of the downloaded code. Digital signatures are always checked before new
254228
255229software is run.
256230
257231## Creating a Makefile for your Lazarus software
258232
259233The following is a command line build system for a Lazarus software. This is particularly usefull if you with to create a RPM package suitable for inclusing on GNU/Linux distributions. The comments on the files should explain what each part does.
260234
261235
262236make.sh
263237```
264238#
265239 # Detects and parses the architecture
266240 #
267241
268242 ARCH=$(uname -m)
269243
270244 case "$ARCH" in
271245
272246 "i686") ARCH="i386";;
273247
274248 "i586") ARCH="i386";;
275249
276250 "i486") ARCH="i386";;
277251
278252 esac
279253
280254 echo "Target architecture: $ARCH"
281255
282256 #
283257 # Detects and parses the OS
284258 #
285259
286260 OS="linux"
287261
288262 echo "Target operating system: $OS"
289263
290264
291265 #
292266 # Command line to build the sofware
293267 #
294268
295269 fpc -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
296270```
297271
298272install.sh
299273```
300274#
301275 # Parses command line options. Currently supported options are:
302276 #
303277 # DESTDIR Destination root directory
304278 #
305279
306280 DESTDIR=""
307281
308282 for arg; do
309283
310284 case $arg in
311285
312286 DESTDIR=*) DESTDIR=${arg#DESTDIR=};;
313287
314288 esac;
315289
316290 done
317291
318292 #
319293 # Does the install
320294 #
321295 # "mkdir -p" is equivalent to ForceDirectories pascal function
322296 #
323297
324298 mkdir -p $DESTDIR/usr/share/magnifier
325299
326300 cp ./topleft.bmp $DESTDIR/usr/share/magnifier/
327301 cp ./topright.bmp $DESTDIR/usr/share/magnifier/
328302 cp ./bottomleft.bmp $DESTDIR/usr/share/magnifier/
329303 cp ./bottomright.bmp $DESTDIR/usr/share/magnifier/
330304 cp ./top.bmp $DESTDIR/usr/share/magnifier/
331305 cp ./left.bmp $DESTDIR/usr/share/magnifier/
332306 cp ./bottom.bmp $DESTDIR/usr/share/magnifier/
333307 cp ./right.bmp $DESTDIR/usr/share/magnifier/
334308 cp ./icon3.ico $DESTDIR/usr/share/magnifier/
335309
336310 mkdir -p $DESTDIR/usr/bin
337311
338312 cp ./magnifier $DESTDIR/usr/bin/
339313```
340314
341315clean.sh
342316```
343317rm -rf *.o
344318 rm -rf *.ppu
345319
346320 rm -rf *.pas~
347321 rm -rf *.sh~
348322 rm -rf *.bak
349323
350324 rm -rf *~
351325
352326 rm -rf magnifier
353327```
354328
355329uninstall.sh
356330```
357331#
358332 # Don´t use "rm -rf" in here, because you should only remove the files you created
359333 #
360334 rm -f /usr/share/magnifier/topleft.bmp
361335 rm -f /usr/share/magnifier/topright.bmp
362336 rm -f /usr/share/magnifier/bottomleft.bmp
363337 rm -f /usr/share/magnifier/bottomright.bmp
364338 rm -f /usr/share/magnifier/top.bmp
365339 rm -f /usr/share/magnifier/left.bmp
366340 rm -f /usr/share/magnifier/bottom.bmp
367341 rm -f /usr/share/magnifier/right.bmp
368342 rm -f /usr/share/magnifier/icon3.ico
369343
370344 rm -f /usr/share/magnifier/magnifier
371345
372346 rm -f /usr/bin/magnifier
373347
374348 rmdir /usr/share/magnifier
375349```
376350
377351Makefile
378352```
379353#
380354 # Targets
381355 #
382356
383357 #
384358 # The First target is the one build when there is nothing on make command line
385359 #
386360 all:
387361 ./make.sh
388362
389363 clean:
390364 ./clean.sh
391365
392366 install:
393367 ./install.sh
394368
395369 uninstall:
396370 ./uninstall.sh
397371```
398372
399373
400374
401375## macOS のインストーラー
402376
403377### macOS のパッケージメーカー(PackageMaker)を使う
404378
405379Most macOS programs are distributed as a disk image file (.dmg extension). Normally you download or copy a program's .dmg file to your Mac and double-click it. This "mounts" the disk image and opens it in a window on the desktop, where you'll typically see a package file (.pkg extension) that you double-click to perform the actual program installation. After installation is complete, you "unmount" (eject) the mounted disk image by dragging it to the trash. You can also delete the .dmg file by dragging it to the trash as well.
406380
407381The 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.
408382
409383You create .pkg files using PackageMaker, which is installed along with the XCode tools in /Developer/Applications/Utilities. With PackageMaker, you select the folder containing the files you want to package and set other installation options, for example whether a password must be entered to install the program. Note that the folder you select can be an .app file. Choose File | Create Package to create the .pkg file. You can also save your settings for future use in PackageMaker by choosing File | Save to create a .pmsp file that you name (.pmproj with later versions).
410384
411385To create a .dmg file, run the macOS Disk Utility, which is installed 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.
412386
413387### macOS に X11 と GTK をインストールする
414388
415389GUI apps created with Lazarus that use the GTK widgetset require X11 and the GTK libraries to run. X11 is included with macOS, but may not be installed by default on a user's Mac, so you'll want to mention this in your app's read-me file.
416390
417391To install the GTK libraries on a user's system, you could include instructions for using fink. Or you could create a separate .dmg file containing just the files from the /sw/lib folder on your Mac. If you don't want to install all of the subfolders under the /sw/lib folder, copy just the .dylib files from /sw/lib to a different folder and package this folder instead of /sw/lib. Also, remember that the GTK libraries installed on your Mac are specific to the processor that you're running. That is, if you want to support both PowerPC and Intel Macs you'll need to create two different .dmg files and instruct your users to install the appropriate one. Note that the GTK libraries only need to be installed once and can be used with any number of Lazarus GUI programs that you develop.
418392
419393---
420394*From the Free Pascal wiki, page "Deploying Your Application/ja", as the Internet Archive kept it on 2022-08-19, last changed on 2020-02-29. 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