How do programmers create a cross platform installer for both Windows and Linux? - linux

I have searched high and low for installers to customize after creating my applications (small, medium, and much bigger) in size. Yes, portable apps great but most people just want to install and also have it just update when updates are available and install and restart the next time or at least warn the user to save the work before the Application can reopen.
Yes, I have looked at NSIS and other installers, but they are merely for windows and not for both windows and Linux. Some of these installer projects have been discontinued. Most people who use Linux don't like to always build from the source.
I was wondering how I can create a POSIX compliant installer that my software can install on both Windows and Linux. What are the steps involved? I assume most or all installers use C++ to do all of the grunt work. I am interested in creating my own to fully understand C++ and how it works. This why I really need to know how an installer is made. Any helpful advice is welcomed.
Thanks in advance.

"Mainstream": A shared packaging format seems elusive. However, there are a few multi-platform deployment tools available. Installsite.org has a list towards the bottom here. I guess the two most commonly used tools are (both are commercial):
Advanced Installer for Java / Advanced Installer Enterprise (Windows and Mac, no Linux)
Flexera InstallAnywhere (Windows, Mac, Linux)
From this answer:

Related

Develop Windows applications with Linux tools

I like the Linux operating system and vim editor, but there are many companies that develop under Windows environment in Visual studio etc. There is a possibility that I will have to work for such a company in about a month.
I'd like to do my work on my Linux system and copy the files to them. I have experience with both developments and I found out that I don't want to work with MS products but I like programming and writing MS code is not such a pain.
Are you a similar developer? Could you give me some advice about your methodology to be most of the time on Linux platform, to create code and debug everything in vim on Linux and only when neccessary open Visual Studio with Windows forms and similar things and test the things that weren't possible to test in Linux environment?
I would see the work in creating small peaces of code on Linux, testing them and then move it to MS platform and integrate to the whole system. How do you debug and test your code? The development will be probably in C# or C++. I can't imagine Visual Basic.
Please write here your experience, style of work, if this has sence or there are too many troubles and I should rather give up.
So the question is: How to develop applications that run on Windows with Linux tools, without touching Visual Studio and browsing with Windows file manager etc.
thank you
Not sure, if this will help you or not but there is a Vim Emulation layer for Visual Studio 2010 called VsVim.
Check out : http://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329
If I were you I'd install MinGW or Cygwin on your windows machine and just use gvim/vim anyway (or maybe just use the Win32 vim).
VS is just a big editor. You'll be building with the microsoft compilers ( perhaps using msbuild or nmake ) but probably are going to have to accept that you can only debug windows things with VS ( unless you build for MinGW or Cygwin and use gcc and gdb)
You can use vim as a code editor, you can even stick on Linux when developing software for the .NET platform. The people behind the Mono make this happen. Mono is a software platform designed to allow developers to easily create cross platform applications. It is an open source implementation of Microsoft's .Net Framework based on the ECMA standards for C# and the Common Language Runtime.
You can stick to the editor of your liking and use the tools that come with Mono to compile your stuff. There is a IDE called Mono Develop, but compared to Visual Studio it is pretty basic... and compared to VIM it lacks simplicity.
C# projects are plain text files so it's easy enough to edit them over an SMB share in whatever editor you wish from anywhere the sysadmins let you.
Testing however will be difficult without going back to the windows machine, and while Mono implements the framework, it's still a different environment if you're targeting Windows.

How to create vc++ program which can be install

Thanks in advance...
I have a solution in vc++ and it is working fine. I need to create this as a program that can be installed. Also need to create a start menu folder and a desktop icon. What are the steps to create this?
Use an install builder. There's several (free) ones around on the web that you can search for.
Personally, I recommend InnoSetup by Jordan Russel. It's free, nice, easy to use, and very rich in features : (quoting from website)
Support for all versions of Windows in use today: 7, 2008 R2, Vista,
XP, 2008, 2003, 2000, Me, 98, 95, and NT 4.0. (No service packs are
required.) Extensive support for installation of 64-bit applications
on the 64-bit editions of Windows. Both the x64 and Itanium
architectures are supported. (On the Itanium architecture, Service
Pack 1 or later is required on Windows Server 2003 to install in
64-bit mode.)
Supports creation of a single EXE to install your
program for easy online distribution. Disk spanning is also supported.
Standard Windows 2000/XP-style wizard interface.
Customizable setup types, e.g. Full, Minimal, Custom.
Complete uninstall capabilities.
Installation of files: Includes integrated support for "deflate",
bzip2, and 7-Zip LZMA/LZMA2 file compression. The installer has the
ability to compare file version info, replace in-use files, use shared
file counting, register DLL/OCX's and type libraries, and install
fonts.
Creation of shortcuts anywhere, including in the Start Menu and
on the desktop.
Creation of registry and .INI entries. Running other
programs before, during or after install.
Support for multilingual
installs, including right-to-left language support.
Support for passworded and encrypted installs.
Support for digitally signed
installs and uninstalls.
Silent install and uninstall.
Unicode installs. (Windows 2000/XP or later)
Integrated preprocessor option
for advanced compile-time customization.
Integrated Pascal scripting
engine option for advanced run-time install and uninstall
customization.
Full source code is available (Borland Delphi 2.0-5.0
and 2009).
I would learn Wix if I were you. The current tutorial at http://wix.tramontana.co.hu/ will help you quickly implement the setup for your application. Also, this will be a good investment in knowledge and it will allow you to implement more complex setup applications in the future.

What is Cygwin and how to use it in relation in Android NDK

Hi I am new to android NDK Devlopment.I downloaded Android NDK 4 for windows.I read through the docs.But i am not clear with it.
First thing is that,I want to develop the native file which may be c 0r c++.I think Using Cygwin will come to play.I dont have any idea or how to use cygwin .From the Docs i just read Cygwin is required for Windows platform.Apart from it ,i dont have any knowledge about it.
Not yet started with NDK Concepts.Help Required
Cygwin is a way to make Windows support some linux functionality. If you install cygwin on your windows machine you'd be able to run some linux software on windows (you'd have to recompile it especially for cygwin though). You can find it and more information about it here. There's also a good explanation at the wiki page here.
If the Android NDK needs it I suppose the Android NDK needs some linux functionality or tools to work properly. The other option might be to install Linux on a machine and run the Android NDK on there, it might be better since I assume Linux is the native environment for Android NDK development.
Since you're saying that you're a bit unclear about the NDK, you should probably be aware that as far as I understand you can not build a whole Android app using it, you can only develop bits of it, you will still need to develop at least part of the app to run on top of the Dalvik virtual machine, which, as far as I know, means that you'll have to write that bit in Java. In general I think that you should develop Android apps only in Java unless there is a specific reason to build certain parts of it using the NDK.
From wiki:
Cygwin (pronounced /ˈsɪɡwɪn/,[2] SIG-win) is a Unix-like environment and command-line interface for Microsoft Windows. Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment. Thus it is possible to launch Windows applications from the Cygwin environment, as well as to use Cygwin tools and applications within the Windows operating context.
Cygwin consists of two parts: a Dynamic-link library (DLL) as an API compatibility layer providing a substantial part of the POSIX API functionality, and an extensive collection of software tools and applications that provide a Unix-like look and feel.
So, Cygwin is a set of tools which allows you to emulate a unix-like (or linux) environment on your windows machines.
The NDK is the Android Native Development Kit. It allows you to write parts of your application in native code (C/C++) and integrate them into your application. Your application still runs under the Dalvik VM but it can load shared objects creating using a cross compiler. The NDK contains all the necessary tools and build scripts to generate native code binaries. It's an advanced concept and one you should probably wait on until you fully understand the architecture.
The reason why it requires Cygwin (or some flavor of linux) is because it uses GnuMake and other linux tools such as awk or Nawk. These tools are not available (or are really hard to use) on windows platforms, hence the need for at least Cygwin (though I would advise you do yourself a favor and just install linux).

NSIS support for Linux and Solaris

Does NSIS support Linux and Solaris? I read somewhere that we can compile nsis script on Linux but cant execute the .exe generated on any other platforms but Windows. Can somebody put more light in this?
No.
See the NSIS feature list for more information ...
Portable Compiler
The NSIS compiler can be compiled for POSIX platforms like
Linux and *BSD. Generated installer
will still run on Windows only, but
this way they can be generated without
Windows or WINE.
You can compile installers on POSIX and Windows systems, but it always produces a Win32 PE file that only runs on Windows (And maybe under WINE on *nix)
Check the NSIS manual for more info
The installer systems for Windows and Linux are completely different.
Whereas Windows' only contribution to a software management system is one registry entry pointing to the uninstaller, Linux has a full working software management system. There are apt, yum, pacman and many more out there, which are supporting many more features and possibilities including automatic execution of scripts and pulling in/installing dependencies. If you have a cross platform application you wanna share, you're either stuck with creating a tar-ball, or you learn how to build deb/rpm etc. packages.
Linux and Windows are not binary compatible, so you can't do that.
But, most of the windows binary installer could able to install at WINE

Best approach to writing a generic installer for a Linux application?

We have a Linux server application that is comprised of a number of open-source tools as well as programs we've written ourselves. Ideally we would like to be able to install this application on any common Linux distribution.
In the past, we've written perl scripts to automate installs of this application. Unfortunately, due to idiosyncrasies of different Linux distros, the logic inside these install scripts gets horribly complex, and can change as new versions of each supported distro are released. Maintaining the installer thus becomes one of the most time-intensive parts of the project!
I'm looking for assistance, be it a framework, documentation, code samples, that can make this process less painful. Here are the types of things our installer needs to do:
Create user/group accounts
Create directory trees with specific ownership and permissions
Install open-source applications, potentially compiling them from source during install
Insert pre-compiled binaries, scripts, config files, and docs into specific directories
Register init-type startup and shutdown scripts
Generate encryption keys
Verify connectivity to a central server
Instead of the installer approach, I think a better way than having a single script that does it at install time is to have a build system which generates .deb or .rpm files suitable for installation on each system you have to support.
A poor man's way of going at that might be to use checkinstall, which creates packages from the files installed via 'make install'. So you'd build your app on each system and have the package magically created in the distro's native format.
I believe that most of the tasks which you describe are fairly standardized between Linux distros. In my experience, the following should work the Debian family (including Ubuntu) and the Red Hat family (including Fedora and CentOS):
Create user / group accounts - adduser command
Create directory trees - mkdir or install, or just expand a tarball
Install open source applications - Unless you have particularly esoteric needs, this should probably be left to the distro's package manager.
Install files - install, or just expand a tarball
Startup and shutdown scripts - install to /etc/init.d then symlink to /etc/rc*.d
VMware Server is freely available for Linux and does most of the tasks which you describe. It uses Perl and maybe shell for its installation and configuration, so you might see the approach that it takes.
However, speaking as a Linux admin, I strongly prefer applications that integrate with my package management system. In other words, create .deb and .rpm files, as Vinko Vrsalovic suggested. Building packages is extremely well documented:
Building RPMs for Fedora (or Red Hat or CentOS): draft documentation, RPM Guide
Building .debs for Debian (or Ubuntu): Debian Maintainer's Guide
I tried Autopackage a few years ago, don't know how universal it is but worked quite well (was the only truly universal way back then). Surely you have to provide some LSB-compatible ways of setting up proper directories on your own, but this piece of software should help you.
Though there's probably still too much diversity among linux distributions to do everything in a completely platform-agnostic way but I may be wrong.
You may want to try BitRock InstallBuilder. It is a cross platform installation tool that allows you to do exactly what you are looking for (adding users, installing services, install pre-compiled binaries, etc). Although some of the other posts mention a number of tools that you could use in your scripts, the problem is that every Linux distribution is a bit different and simple tasks like adding an user or installer a service are suddenly non-trivial when you need to do them across Debian, Ubuntu, Mandriva, RedHat, Gentoo, etc. A good cross platform installer should isolate you from all that. Many commercial open source companies like MySQL, SugarCRM, Zenoss, Jaspersoft, Groundwork etc. have built installers based on our technology exactly because of that (in addition to their regular source code tarballs, etc.) We also provide free licenses for open source projects.
Autopackage now merged with Listaller project. Documentation's not really thorough yet but seems to be working.

Resources