[Tutorial] Packing and Deployment
Author |
Message |
rdrake
|
Posted: Fri Sep 22, 2006 12:55 pm Post subject: [Tutorial] Packing and Deployment |
|
|
So you've got your picture perfect application all coded and ready to go. But you're probably wondering, "how do I get this marvelous program to other people?" The answer is simple, you must create an installer.
Here is our gem of a program, in its entirity:
code: |
#include <stdio.h>
int main() {
printf("Hello, world!");
return 0;
}
| Excellent! Worthy of sharing with the world.
Note: This tutorial will only cover creating Windows installers. There should be enough resources on this site covering Linux deployment.
Now, we have quite a few free options for creating installers on Windows. I will discuss two of my favourites, and some of the most widely used install creators, NSIS and Inno.
You can find their respective sites at the following locations:
I personally find Inno Setup is easier for a beginner to use, however, you may use NSIS if you feel more comfortable. After reviewing the features, it appears as though NSIS offers more advanced options. This tutorial will mostly cover Inno.
Both of these installers follow the following order in the structure of their scripts.
- Default Options
- Files to Copy
- Icons
- Registry Keys (optional)
Default Options
In Inno Setup, begins with "[Setup]"
code: | [Setup]
; Name of your application (display name, not the name of the executable)
AppName=Hello, World!
; Version of your application
AppVerName=Version 1.0
; Where you suggest we install
DefaultDirName={pf}\Hello World
; Group name, usually if your installer package is part of a suite
DefaultGroupName=Hello World Software Inc.
; Uninstaller's icon as well
UninstallDisplayIcon={app}\helloworld.exe
; Displays the license and makes them accept if they wish to install
LicenseFile=license.txt | Pretty self explainatory comments.
Files to Copy
Next we must define which files to copy. Now, some files can have special flags (ie, the Readme). This allows us to present the user with the option to view the files upon successful install.
code: | ; All of the files you wish to install
[Files]
; Your main executable
Source: "helloworld.exe"; DestDir: "{app}"
; README, specially marked (the user can choose to view the readme upon install)
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme | You might notice something special here, "{app}". That tells the installer to copy the files to the root directory of where the user installs the program.
Of course you can create subdirectories as well, by doing something like the following.
code: | Source: "helloworld.exe"; DestDir: "{app}\bin" |
Icons
Finally we can create some icons. Always nice when you want to make your program a bit more friendly.
code: | [Icons]
; We only really need one icon created
Name: "{group}\Hello, World!"; Filename: "{app}\helloworld.exe" |
Putting it all together, we get this.
code: | ; -- Hello, World! Program example -- ;
[Setup]
; Name of your application (display name, not the name of the executable)
AppName=Hello, World!
; Version of your application
AppVerName=Version 1.0
; Where you suggest we install
DefaultDirName={pf}\Hello World
; Group name, usually if your installer package is part of a suite
DefaultGroupName=Hello World Software Inc.
; Uninstaller's icon as well
UninstallDisplayIcon={app}\helloworld.exe
; Displays the license and makes them accept if they wish to install
LicenseFile=license.txt
; All of the files you wish to install
[Files]
; Your main executable
Source: "helloworld.exe"; DestDir: "{app}"
; README, specially marked (the user can choose to view the readme upon install)
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
[Icons]
; We only really need one icon created
Name: "{group}\Hello, World!"; Filename: "{app}\helloworld.exe" |
If you're using Inno Setup, just press CTRL+F9 in order to compile the setup file. Look in the Output directory created by Inno for the installer.
Deployment
Now that you've got your installer all ready to go, where do you put it? There are several options.
- Removable Media
- CD-ROM - More widely used, however, can seem like a waste when your installer is small.
- Floppy Disk - Not recommended by me, many computers no longer have a floppy drive.
- Internet - Cheaper to distribute smaller installers, however, can get expensive as your setups get larger and larger. I'm not familiar with any places that actually host the files for you, but many sites will link to your installer.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
iamcow
|
Posted: Tue Sep 26, 2006 4:43 pm Post subject: (No subject) |
|
|
what language. It looks like C but I only started learning C so i wouldn't be able to tell between c and c++ |
|
|
|
|
|
rdrake
|
Posted: Tue Sep 26, 2006 4:54 pm Post subject: (No subject) |
|
|
iamcow wrote: what language. It looks like C but I only started learning C so i wouldn't be able to tell between c and c++ The example is in C, however that does not make a difference. The program you are distributing can be in any language. |
|
|
|
|
|
wtd
|
Posted: Tue Sep 26, 2006 5:42 pm Post subject: (No subject) |
|
|
As I'm on a bit of a retro kick...
code: | program HelloWorld;
begin
writeln('Hello, world!')
end. |
|
|
|
|
|
|
|
|