To compile azpainter from source code, download and unpack the source code archive, check for documentation on how to install, install whatever build dependencies you determine are necessary, and run ./configure
and make
as instructed by the documentation.
While that is also a good general pattern for compiling software from source code, the rest of this post is a step-by-step walkthrough for azpainter, including some useful information not currently provided in the official installation instructions. I have tested this in Ubuntu 14.04 LTS and Ubuntu 16.04 LTS.
Getting the Source Code
Suppose you have downloaded azpainter 2.0.6 (later readers can check here for other versions):
wget https://osdn.net/dl/azpainter/azpainter-2.0.6.tar.bz2
If you run a command like that, or download it in your web browser, you don't get a folder--you get a .tar.bz2
archive which you must unpack in order to use. To unpack it you would make sure you're in whatever directory contains it (you can use the cd
command for that) and run:
tar xf azpainter-2.0.6.tar.bz2
For that particular archive, this creates an azpainter-2.0.6
directory, which you can enter with cd
:
cd azpainter-2.0.6
Determining Build Dependencies
When compiling software you're unfamiliar with from source code, you should always check for files that provide instructions. Reading the README
file in this directory (you can also view its contents in your graphical file browser, if you like) contains a list of "What you need to compile." It also lists specific packages (scroll down to "Debian/Ubuntu") that you can install to provide what it needs.
Although it's okay to install gcc
and make
directly, I suggest installing the build-essential
package, which causes those packages to be installed, as well as a number of other tools that are frequently useful in compiling software.
When you install azpainter, the gtk-update-icon-cache
command is used to attempt to create an easy graphical launcher for the program and to make them immediately available through your menus. Usually this succeeds; if not, and you want a launcher, you can make it yourself (see below). Furthermore, the update-desktop-database
command is used to update the database of file types and what applications are capable of opening them. However, depending on what release and flavor of Ubuntu you are running, these two commands might not be installed, so I suggest installing the packages that provide them, which are libgtk2.0-bin
and desktop-file-utils
, respectively.
Therefore I suggest running these commands to obtain the necessary build dependencies for azpainter:
sudo apt update
sudo apt install build-essential libx11-dev libxext-dev libxi-dev libfreetype6-dev libfontconfig1-dev zlib1g-dev libjpeg-dev libpng-dev libpng12-dev libgtk2.0-bin desktop-file-utils
(The instructions advise installing libpng-dev
for some versions of Ubuntu and libpng12-dev
for others, but if you like you can just install both as shown above.)
Compiling and Installing the Software
The next section of the README
file tells you what commands you can run to install the software, once you've installed the build dependencies (see above). You should run these commands from inside the directory you unpacked that contains the configure
script:
./configure
make
sudo make install-strip
Using the install-strip
target instead of the install
target strips debug symbols from the installed binaries, making them smaller. The README
file recommends this, which is why I have shown it.
This installs the program in /usr/local
--different parts of it will be placed in different subdirectories therein (which is typical). Specifically, the azpainter
executable itself will be in /usr/local/bin
. If that directory is in your $PATH
then you can simply run azpainter
; either way you can run the program as /usr/local/bin/azpainter
.
Optional: Manually Creating a Launcher
You don't have to do anything else. However, it is possible no .desktop
file for azpainter
was successfully created.
A .desktop
file is also called a launcher, and it makes it easier to run graphical programs by double-clicking icons or selecting them in menus. If you don't see it in your menus then you may want to create one. You may be able to copy and use or modify the stock .desktop
file included in the desktop
subdirectory of the azpainter-2.0.6
directory (i.e., the directory created by unpacking the source code).
If the program runs just by typing azpainter
and pressing Enter, then the stock .desktop
file included in the source archive should work without modification.
Optional: Uninstalling the Software
If you want to uninstall the software, you can do this by cd
ing back to the directory where you ran sudo make install-strip
(or sudo make install
) and running:
sudo make uninstall
Not all programs and libraries that you build and install from source with ./configure
and make
supports being uninstalled this way, but many do, including azpainter.
You may one day want to install. Even if you are very happy with the software, you may want to upgrade it to a later version, which for software you've manually installed from source like this is usually best achieved by uninstalling and then building and installing the newer version. Therefore I recommend you keep the azpainter-2.0.6
(or whatever version you are using) directory and its contents.
However, if you do ever remove it, then you can regain the ability to uninstall by repeating the steps to install it, up to and including the make
step.
- If you ever do this, you should use the same version of the software that was installed, starting from the same
.tar.bz2
archive. (For some programs, you have to actually run the make install
or make install-strip
step to get the ability to uninstall, but this does not appear to be necessary with azpainter.)
- You won't have to reinstall the packages you installed as build dependencies, though (i.e., no
apt
or apt-get
commands required), unless you've subsequently removed them.
Another way to manage installing, uninstalling, and upgrading packages you build yourself from source code is to use checkinstall
. See below for further reading that includes this and other useful general information not covered in this answer.
Further Reading
To learn more about installing programs from source code, see:
Best Answer
From the results of
apt-cache show ghc
:To install ghc open the terminal and type:
Create an example Haskell source file, example.hs, containing:
main = putStrLn "Hello, World!"
To compile example.hs change directories usingcd
to the directory containing example.hs and type:To run the executable: