Excerpts from hollunder's message of Tue Jul 07 11:22:31 -0400 2009:
On Tue, 07 Jul 2009 09:41:49 -0400 Andrei Thorp <garoth@gmail.com> wrote:
Excerpts from Magnus Therning's message of Tue Jul 07 01:31:42 -0400 2009:
edogawaconan wrote: [..]
use install instead of mkdir/cp
Even better, to help non-Arch users, use auto-tools (or some other build/install/distribution tool with Vala support) for building and installing.
automake[1] waf[2]
To explain this a bit more, generally, it's not the software packager's job to make stuff install per se. Most software that you get comes with commands like "make" and "make install" -- these are used for compiling the software and having it install, respectively.
The way you do this is by creating build scripts of some sort for your package. The most common way is to use autotools, as mentioned before. This is the standard "make" system made by GNU, and it's pretty much oriented around shell scripts.
Then, the packager uses the fairly standard variable to make, DESTDIR, to tell the package to install into a folder rather than to / by default. This folder is then packaged up by makepkg and can be extracted over / to "install" the software to the correct place.
Personally, I find that the old autotools are kind of... old. They work fine and are easy to do for small projects that don't need to do much work during build/install (like yours), but newer systems like SCons and CMake are being used more and more frequently in larger systems like KDE.
I think you get the idea generally, but here is a very simple example Makefile (the script used by make) to give you an idea. Note that make requires the use of tabs instead of spaces in indentation:
DESTDIR=
all: @ echo -ne "\e[32;1m==>\e[0m Building." valac foobar.vala
install: @ echo -e "\e[32;1m==>\e[0m Installing files." install -d ${DESTDIR}/usr/bin install -m0555 foobar ${DESTDIR}/usr/bin
uninstall: @ echo -e "\e[32;1m==>\e[0m Uninstall files." rm ${DESTDIR}/usr/bin/foobar || true
clean:
====================================================
Some notes on this: - the sections are the categories for make (ie. make uninstall) - @ in front of the line tells make to not print this line. Usually, make outputs what command it's running as it runs it. - The funky characters in the echos are cli colour codes for prettiness. - the first section is the default -- so just "make" instead of "make all" is fine. - The clean instruction isn't used in this example, but it's generally used to clean up executables and stuff. Debian requires this instruction by default...
Good luck!
Wow, thanks for this simple example. So far I've only patched DESTDIR into Makefiles, good to know a little bit more about this stuff.
Happy to help. -- Andrei Thorp, Developer: Xandros Corp. (http://www.xandros.com)