Gentoo Wiki


This page is a candidate for deletion 
Reason given: Not really Gentoo related. Belongs on a programming wiki.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.

This example shows how to create a new helloworld package from scratch.


Create the development directory structure for the helloworld package

Before writing the code for the helloworld program, the directory structure for the helloworld package is first created:

Creating a project directory for the package

cd ~/
mkdir helloworld
cd ~/helloworld

Create the development subdirectories for the new package

Next the directory infrastructure for the source code and supplementary files is created:

mkdir src

Create the source code files for the helloworld package

The development subdirectories for the helloworld package have been created. The next step is to make the package source directory current:

cd ~/helloworld/src

The hello.c source file for the new package can now be created:

  * hello.c
  * This program outputs a message to the terminal
  * (C) Copyright 2004 Mark Hobley
  * This is free software. This file can be redistributed or modified
  * under the terms of the GNU General Public Licence (Version 2)
  * as published by the Free Software Foundation.

#include <stdio.h>

main ()
  printf("Hello World!");

Create the file for the helloworld package

The file is used by the automake tool to create the project makefile entries used by the build scripts.

Create the file for the package sources

Make the source directory current before creating the makefile:

cd ~/helloworld/src

Create the file as follows:

bin_PROGRAMS = hello
hello_SOURCES = hello.c

Use autoscan to scan the source code

Make the helloworld project directory current

Before using the autoscan tool, first make the helloworld project directory current:

cd ~/helloworld

Run the autoscan tool

Now run the autoscan tool:


Create the file

The autoscan tool will create a configure.scan file. Copy this file to create a file for use by the autoconf tool as follows:

cp configure.scan

Configure the package name and version number

The generated file requires modification to change the default package name, version number and bug report email address information:


Modify these entries as follows:

AC_INIT(The helloworld example, 1.0.0,
Retrieved from ""

Last modified: Thu, 12 Jun 2008 10:18:00 +0000 Hits: 1,006