Questions tagged [source]

Everything that includes the source code of Unix programs for example compiling, installing or how to retrieve the code for studying.

Unix programmers have a long lasting tradition of sharing and exchanging source codes. An important number of tools and application are commonly published under Free Software and/or Open Source licenses, making the necessity to develop some conventions and standards in publishing source code.

Tarballs

Source code is generally distributed as a compressed archive. The most common compression method are and bzip2 (a slower but more effective compression algorithm). The packaged archives are referred to as tarballs. Commonly, here are the filename extension used in naming conventions:

  • .tar.gz and.tgz signaling gzip compression
  • .tar.bz2, .tbz, .tbz2 and .tb2 signaling bzip2 compression.

Here's how to extract the source code from the tarball:

On

tar xvzf foo.tar.gz

tar xvjf foo.tar.bz2

On

gzcat foo.tar.gz | tar xv

bzcat foo.tbz2 | tar xv

A common case: Autotools

The GNU build system (sometimes referred to as autotools, because it includes tools like autoconf or automake) is by far the most common format of Unix-source packages. Here's the most basic use-case to install an autotools package from source:

  • ./configure --prefix=/path

The configure script will detect the tools installed in the user's environment and will generate the Makefile (and other scripts) accordingly. The option --prefix=/path will define the target install directory (if nothing is specified it will use /usr/local by default). More options may be available and can generally be consulted with ./configure --help.

  • make

    This command will compile the code into binaries by calling the tool. It can optionally take specific targets as arguments and/or options.

  • make install

    This command will install the compiled code into the target directory (/usr/local by default). Depending on the user's permission on the directory, it may need to be executed with permissions.

Publicly available Source Control systems

Another form of source code distribution is setting up a publicly available source repository. Some projects make the latest developments of the code available this way. For instance:

Git

git clone http://url-to-git-repo

SVN

svn co http://url-to-svn-repo proj-trunk
350 questions
21
votes
1 answer

Where can I find the source code for /bin/ip?

I've been using the command /bin/ip: ip addr add 10.10.10.0 dev eth0 I would like to see the source code of how the ip command works. Is it available?
Chadness3
  • 337
4
votes
1 answer

Where should I keep the source files of the compiled applications?

I use Slackware Linux and I install most applications from the source. I would like to know how to manage the source files, specially the header files, so they are available to other applications.
fdisk
  • 155
4
votes
2 answers

Exploding amount of Debian source code lines

According to the table at the Source lines of code article at Wikipedia, the amount of Debian source code lines rapidly grew to over 324m LoC (Lines of Code) in 2009: 2000: 55-59m 2002: 104m 2005: 215m 2007: 283m 2009: 324m On the other…
Marius K.
  • 165
3
votes
3 answers

Where can I find sources for

Emacs lisp source code for .elc files? e.g. cal-mayan.elc Files in the /bin directory? e.g. cat, split, and echo
ixtmixilix
  • 13,230
2
votes
2 answers

What is the website for `say` program?

Embarrassing, but after system upgrade say vanished from it -- either it is no longer provided by the distro, or I installed it independently before (but I don't remember how and where from). The problem is say word is so ubiquitous word, that…
greenoldman
  • 6,176
1
vote
2 answers

How to find out the initiator of a script in unix

I am wondering if there is a way to find out how a file execution was initiated. For example, consider the following files: ~/foo.sh echo "Hello from foo.sh" # print the name of the initiator/parent of this execution ~/bar.sh source…
1
vote
1 answer

How to type from the source directory on mac

In the website http://gfs.sourceforge.net/wiki/index.php/Mac_OSX_Installation In this line: type from the source directory ... What is source directory referring to ?
Meva
  • 383
-1
votes
1 answer

I source a file each day - is it dangerous by means of filling up the disk drive?

I source a file each day - is it dangerous by means of filling up the disk drive (if something is written anywhere)? Someone once criticized me here in StackExchange for sourcing a file each minute (something I no longer do), I think it was…