Deploying Your Application/ja

From Free Pascal wiki
Jump to navigationJump to search

English (en) español (es) français (fr) 日本語 (ja) português (pt)

Windows のインストーラ

Window にはフリーでオープンソースなインストーラーが多く作成されているため、これらの利用をお勧めします。

Inno Setup

Inno Setup は Windows 用のフリーでオープンソースなインストーラーであり、商用にも自由に利用できます。 (ソースは Borland Delphi 2.0-5.0 用となっています。)

現在利用されている全てバージョンの Windows -- Vista, XP, 2008, 2003, 2000, Me, 98, 95, and NT 4.0. (サービスパックは不要) -- をサポートしており、ファイルのバージョン情報の比較、使用中のファイルの置き換え、レジストリと .ini ファイルへのエントリ作成など、多くの機能があります。[1]

パブリックドメインではありませんので、配布や利用には制約があります。 詳細は、ライセンス を確認してください。

Inno Setup は、 Windows 用の Lazarus インストーラーにも利用されています。

InstallJammer

InstallJammer は、マルチプラットフォームなオープンソースの GUI インストーラーです。 完全なクロスプラットフォームとなるようにデザインされており、Windows、UNIX の多くのバリエーションのほぼ全て、Mac OS X で利用できます。

HJ-Install

HJ-Install は、Windows 95, 98, ME, NT 4.0, 2000, 2003, XP, Vista 用のフリーウェアのインストーラーです。 インターネット上やCD-Rom、1枚または複数枚のフロッピーディスクで配布されることを考慮して作られています。 しかし、ネットワークからもスタンドアローンのスクリプトエンジンとして利用できます。 インストーラーと他ファイルの合計で138kbと軽いサイズです。 レジストリと ini ファイルの変更、アンインストールはサポートしていません。 詳細は、ウェブサイト を確認してください。

LizaJet Installer

LizaJet Installer は商用のインストーラーですがフリー版もあります。 Object Pascal をスクリプトに用いています。 詳細は、 ウェブサイト を確認してください。(訳注:09時点でウェブサイトは404エラーですが、インストーラ名で検索すると数多くヒットします。)

NSIS (Nullsoft Scriptable Install System)

NSIS はプロ向けのオープンソースなシステムであり、 Windows 用のインストーラーを生成できます。 NSIS インストーラーは34kbの大きさです。 詳細は、ウェブサイト または、 エディター を確認してください。

Windows Installer XML (WiX) toolset

XML ファイルから Windows用インストールパッケージを作成します。 開発者がビルドプロセスをMSIやMSMといったセットアップパッケージに統合できるように、コマンドライン環境もサポートしています。 詳細は、ウェブサイト を確認してください。

Unix のインストーラー

Linux 上で RPM パッケージを作る

On 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.

To 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.

To build the rpm file use either the emacs menu or this command line (man rpmbuild for more information):

rpmbuild -ba --clean $HOME/RPM/SPECS/myprogram.spec

構築環境を設定する

RPM 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.

First, go to your home directory (or another directory inside it) and create the following directory structure:

RPM

RPM/BUILD - This directory is utilized by RPM to build the package.

RPM/RPMS - Here you can find binary RPMs after you build them.

RPM/SOURCES - Place your compressed tar files and patches here.

RPM/SPECS - Place all your spec files here.

RPM/SRPMS - Here you can find source RPMs after you build them.

Next 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.

%_topdir                /home/felipe/RPM/
%_tmppath               /home/felipe/tmp

%_signature             gpg
%_gpg_name              Mandrakelinux
%_gpg_path              ~/.gnupg

バイナリパッケージを作る

The 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:

  • It requires creating a Makefile and makefiles are complex
  • Some packages don't have any binary software in them, so they don't need to be built.

Each 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.

To 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

Bellow 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.

%define name    braillevirtual 
%define version 1.0 
%define release mdk 
%define dir     braillevirtual
%define root    /home/felipe/tmp/ROOT/

Summary:   Curso On-Line de Braille
Name:      %{name}
Version:   %{version}
Release:   %{release}
Vendor:    Laboratório de Brinquedos da Faculdade de Educação da USP
URL:       www.braillevirtual.fe.usp.br
License:   Distribuível livremente
Group:     Books/Other
Packager:  Felipe Monteiro de Carvalho
Source0:   home/felipe/Programacao/SOURCES/braillevirtual.tar.bz2
BuildRoot: %{root}

%description
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.

%prep
cd $RPM_SOURCE_DIR
cp braillevirtual.tar.bz2 $RPM_BUILD_DIR
cd $RPM_BUILD_DIR
rm -rf %{dir}
rm -f braillevirtual.tar
bunzip2 -d braillevirtual.tar.bz2
tar -xvf braillevirtual.tar

%install
rm -rf $RPM_BUILD_ROOT/usr/share/%{dir}
cp -r $RPM_BUILD_DIR/%{dir} $RPM_BUILD_ROOT/usr/share/

%clean
rm -rf $RPM_BUILD_DIR/*.*

%files
/usr/share/%{dir}/

%changelog

* Mon Oct 24 2005 1.0-mdk.noarch.rpm

- Nova atualização do pacote de instalação. Inclusão dos exercícios avançados.

* Wed May 12 2005 1.0-mdk.noarch.rpm

- Atualizei o pacote para refletir as mudanças no site. Várias pequenas mudanças.

* Sun May 05 2005 1.0-1mdk.i586.rpm

- O pacote de instalação do braille Virtual para linux é criado.

ソースとバイナリのパッケージを作る

Linux 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#Creating_a_Makefile_for_your_Lazarus_software.

You need to use the %build section to compile the software.

Bellow 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.

Name:           magnifier
Version:        3.2.1
Release:        1
Summary:        Virtual Magnifying Glass
Group:          Accessibility
License:        GPL Version 2
URL:            http://magnifier.sourceforge.net
Source0:        http://internap.dl.sourceforge.net/sourceforge/magnifier/magnifier-3.2.1.zip
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  fpc >= 2.0.2, lazarus >= 0.9.12
Requires:       ImageMagick

%description

Virtual Magnifying Glass is a free, open source, multiplatform, screen magnification tool. It is simple, customizable, and easy-to-use.

%prep
%setup -q magnifier

%build
make TARGET=%{_target_cpu}

%install
./install.sh DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT/

%files
%defattr(-,root,root,-)
/usr/share/magnifier/
/usr/bin/magnifier

%changelog

* Wed Feb 15 2006 Felipe Monteiro de Carvalho <felipemonteiro.carvalho at gmail.com> - 3.2-mdk.i386.rpm
- The Linux RPM package is created.

Linux 上で Debian のパッケージを作る

Please, write me.

In the mean time have a look at this tutorial written by IBM.
http://www-128.ibm.com/developerworks/linux/library/l-debpkg.html

GUInseng

GUInseng is a a GTK+ based installer for Linux released under GPL.

The Zero Install system

The Zero Install system aims to provide a better way of installing software than traditional systems

(tarballs, apt-get, bundles, setup.exe, etc). Here are some of yours goals:

Anyone can install software

You don't have to be the administrator (root) just to install a word-processor.

Anyone can distribute software

You don't need to be blessed by a distribution (or anyone else) to be part of Zero Install. The system is completely

decentralised.

It doesn't matter whether software is installed or not

You just run it. Zero Install handles the rest (downloading and caching as needed).

Security

If one user downloads a malicious program, other users aren't affected. Users can share downloads without having to trust

each other. Installation does not execute any of the downloaded code. Digital signatures are always checked before new

software is run.

Creating a Makefile for your Lazarus software

The 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.


make.sh

#
# Detects and parses the architecture
#

ARCH=$(uname -m)

case "$ARCH" in

 "i686") ARCH="i386";;

 "i586") ARCH="i386";;

 "i486") ARCH="i386";;

esac

echo "Target architecture: $ARCH"

#
# Detects and parses the OS
#

OS="linux"

echo "Target operating system: $OS"


#
# Command line to build the sofware
#

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

install.sh

#
# Parses command line options. Currently supported options are:
#
# DESTDIR		Destination root directory
# 

DESTDIR=""

for arg; do

  case $arg in

    DESTDIR=*) DESTDIR=${arg#DESTDIR=};;

  esac;

done

#
# Does the install
#
# "mkdir -p" is equivalent to ForceDirectories pascal function
#

mkdir -p $DESTDIR/usr/share/magnifier

cp ./topleft.bmp $DESTDIR/usr/share/magnifier/
cp ./topright.bmp $DESTDIR/usr/share/magnifier/
cp ./bottomleft.bmp $DESTDIR/usr/share/magnifier/
cp ./bottomright.bmp $DESTDIR/usr/share/magnifier/
cp ./top.bmp $DESTDIR/usr/share/magnifier/
cp ./left.bmp $DESTDIR/usr/share/magnifier/
cp ./bottom.bmp $DESTDIR/usr/share/magnifier/
cp ./right.bmp $DESTDIR/usr/share/magnifier/
cp ./icon3.ico $DESTDIR/usr/share/magnifier/

mkdir -p $DESTDIR/usr/bin

cp ./magnifier $DESTDIR/usr/bin/

clean.sh

rm -rf *.o
rm -rf *.ppu

rm -rf *.pas~
rm -rf *.sh~
rm -rf *.bak

rm -rf *~

rm -rf magnifier

uninstall.sh

#
# Don´t use "rm -rf" in here, because you should only remove the files you created
#
rm -f /usr/share/magnifier/topleft.bmp
rm -f /usr/share/magnifier/topright.bmp
rm -f /usr/share/magnifier/bottomleft.bmp
rm -f /usr/share/magnifier/bottomright.bmp
rm -f /usr/share/magnifier/top.bmp
rm -f /usr/share/magnifier/left.bmp
rm -f /usr/share/magnifier/bottom.bmp
rm -f /usr/share/magnifier/right.bmp
rm -f /usr/share/magnifier/icon3.ico

rm -f /usr/share/magnifier/magnifier

rm -f /usr/bin/magnifier

rmdir /usr/share/magnifier

Makefile

#
# Targets
#

#
# The First target is the one build when there is nothing on make command line
#
all:
	./make.sh

clean:
	./clean.sh

install:
	./install.sh

uninstall:
	./uninstall.sh


macOS のインストーラー

macOS のパッケージメーカー(PackageMaker)を使う

Most 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.

The 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.

You 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).

To 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.

macOS に X11 と GTK をインストールする

GUI 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.

To 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.