Results 1 to 5 of 5
Hello,
Well, as this is my first post on this forum, I think it's worth to say that the newbie category fits perfectly for me. My programming experience is not ...
- 04-21-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 1
GNU Packages
Hello,
Well, as this is my first post on this forum, I think it's worth to say that the newbie category fits perfectly for me. My programming experience is not over 1.5 years, and I'm having the first contact with the Linux world now that I've installed a virtual machine running Ubuntu on my Mac.
Back to programming, though I still learning a bunch of new things every day, sometimes I think that my knowledge is achieving a good point. I started with C, and then moved to Objective-C, which is my main tool for programming. Indeed, I already published software for Mac, and I'm continuously working on other projects as well.
Recently, I moved from the initial way of thinking in higher levels to the desire of understanding the computer in its bytes. I even started using a decent text editor! (That's Vim. Emacs is great as well, but Vim fits better to me).
Anyway, I was saying sometimes I get happy with my knowledge, because when I see thinks like this…
…I realize I know nothing.Code:THANKS: THANKS.in Makefile.am .mailmap thanks-gen .version $(AM_V_GEN) \ { \ $(prologue); echo; \ { perl -ne '/^$$/.../^$$/ and print' $(srcdir)/THANKS.in \ | grep -v '^$$' | perl -pe 's/ +/\0/'; \ git log --pretty=format:'%aN%x00%aE' \ | $(ASSORT) -u; \ } | $(srcdir)/thanks-gen \ | LC_ALL=en_US.UTF-8 sort -f; \ echo; \ printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \ }
That's an extract from the Makefile of coreutils GNU Package. I really think that reading such well done software source can help me learning new things. But when I download and open a package, and see that bunch of files with strange extensions and monster content, well I feel "fear"
Fear, because I have no control over it maybe. So, I'd like to ask the community: Which directions should I take?
Are there any good books or articles explaining these things? Certainly there are, the problem is that I don't know where to search (ok, google) nor what exactly to search. This probably involves a lot of aspects, a lot of subjects. But I'd like to have a little basis on what's what, to begin researching and learning more on each separate subject.
By the way, I don't even know how to install this. Well, I know the basic path, and I've read the recommended newbie forum threads on that. But, for example: where will the binaries be installed? Does I have how to configure this? etc.
Any help, directions, comments, positive or negative ones, are really appreciated.
Thanks!
- 04-22-2011 #2
Well, you're brave! Most of us leave automatically generated makefiles strictly alone as they are pretty well incomprehensible to human beings. You could perhaps look at this HOWTO for inspiration.
Where programs get installed depends largely on the PREFIX variable which is defined at the beginning of the config file. The default value of this is usually /usr/local so programs go in /usr/local/bin, libraries in /usr/local/lib and so on. But you can change this by redefining the PREFIX variable when you run config. For example, if you want to install the software in the same place as all the stuff that came with your installation, type ./config PREFIX="/""I'm just a little old lady; don't try to dazzle me with jargon!"
- 04-23-2011 #3
AutoTools
Linux has a thing called( AutoTools) that is supposed to compile source code that will be compatible with your architecture. "Make" I believe is part of AutoTools. Make is both a file and code which is used interchangeably in Linux jargon which is confusing The documentation is not very good. If you just want to install an application I recommend using your Package-Manager. Is it apt-get for Ubuntu? I doubt that anyone except developers understand it a great deal. It's like Grub where there are lots of lousy guides on it with hardly any info on it. There are a plenty of Linux topics where you will learn a few things about it and the next time you encounter it you will be a little farther along.
- 04-23-2011 #4Just Joined!
- Join Date
- Nov 2009
- Location
- Sweden
- Posts
- 31
A simple example might help
Create these three files:
main.c
Makefile.amCode:#include <config.h> #include <stdio.h> int main() { puts("Hello World!"); puts("This is " PACKAGE_STRING "."); return 0; }
configure.acCode:bin_PROGRAMS = hello hello_SOURCES = main.c
Now, just run autoreconf --install.Code:AC_INIT([hello], [1.0]) AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AC_PROG_CC AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT
This will create all those files with strange extensions. Then you can run the usual ./configure && make && make install.
If you run make dist, a tar.gz package will be created for you.
This is all you have to do to create a simple GNU package.
Does this look less scary?
- 04-24-2011 #5
So let's talk a bit about compiling and installing software.
Distributed Linux software traditionally uses a Makefile to automate the process of compiling and installing software. It's pretty straightforward: you just list the files that need to be compiled, and the commands to compile them. So easy!
However, as packages got bigger and bigger, and Makefiles were expected to do more things (automatically generate tarballs, install and uninstall software, etc.), they moved to a new piece of software called automake. Now all that you have to do is list the source files that you have, and a Makefile will be automatically generated that has all of the standard targets for those source code files! The resulting Makefile is basically impossible to understand, but the original automake template is really simple, so it's okay! So now you compile using the "Makefile" file, but the readable file is now called "Makefile.am".
But then things got more complicated. For instance, maybe some of the dependencies of the software are installed in non-standard locations. Maybe the software should be installed to a non-standard location. Maybe the command for creating directories is something weird on this computer. What to do?
So they also have something called a configure script, which analyses the computer and checks where things are installed. These scripts are basically impossible to understand, and are difficult to write yourself, so you use autoconf to generate one. But the configure script has to modify the Makefile!
So we've gone from having a single file called Makefile to:
- Makefile.am: the automake template
- Makefile.in: the Makefile generated by automake
- configure.ac: The autoconf template
- configure: The configure script
- Makefile: The Makefile generated by configure
So these days, you can write a simple Makefile for yourself, but if you are distributing software (or if you are working on a bigger project), you should probably use autoconf and automake. There is, fortunately, some good documentation for it out there:
automake
AutoconfDISTRO=Arch
Registered Linux User #388732


Reply With Quote