User:Timothee Flutre/Notebook/Postdoc/2012/11/27

From OpenWetWare

(Difference between revisions)
Jump to: navigation, search
(How to make a GNU package?: add link to tuto by Martin Mann)
(How to make a GNU package?: add usage of CXXFLAGS with make)
(3 intermediate revisions not shown.)
Line 27: Line 27:
  touch configure.ac Makefile.am src/Makefile.am doc/Makefile.am # and edit these files
  touch configure.ac Makefile.am src/Makefile.am doc/Makefile.am # and edit these files
  autoreconf --install # use autoreconf --force the next times you want re-build configure
  autoreconf --install # use autoreconf --force the next times you want re-build configure
-
  ./configure # can be followed by --prefix=$HOME, LDFLAGS=-L/usr/local/lib, etc
+
#if needed, use: 'automake --add-missing' and 'libtoolize --force'
-
  make # can be followed by LDFLAGS="-L/usr/local/lib -static"
+
  ./configure # can be followed by --prefix=$HOME, LDFLAGS=-L/usr/local/lib, 'CXXFLAGS=-O0 -g', etc
 +
  make # can be followed by LDFLAGS="-L/usr/local/lib -static" as well as CXXFLAGS="-DDEBUG -Wall"
  make check # to automatically execute the tests
  make check # to automatically execute the tests
Line 64: Line 65:
* share your code, for instance on [http://en.wikipedia.org/wiki/GitHub GitHub] (read the [http://help.github.com/ help]!)
* share your code, for instance on [http://en.wikipedia.org/wiki/GitHub GitHub] (read the [http://help.github.com/ help]!)
 +
 +
* '''Tips:'''
 +
** if your package uses [http://www.gnu.org/software/libtool/manual/html_node/index.html libtool], you need to use gdb like this: <code>$ libtool --mode=execute gdb --args myprogram -i input.txt</code>
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### -->
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### -->

Revision as of 17:08, 4 October 2013

Project name Main project page
Previous entry      

How to make a GNU package?

(A very good tutorial by Martin Mann is available here.)

  • find a name for the package, for instance "hello"
  • structure the package directory:
mkdir mypkg; cd mypkg
touch COPYING README INSTALL NEWS AUTHORS ChangeLog
mkdir src build-aux doc tests # you can also add other directories, e.g. scripts, data, lib
  • populate the src/ directory with your code, e.g. hello.cpp
  • retrieve the license, for instance GPLv3:
wget -O COPYING http://www.gnu.org/licenses/gpl-3.0.txt
  • fill the information files, such as README (example), INSTALL (example)...
touch configure.ac Makefile.am src/Makefile.am doc/Makefile.am # and edit these files
autoreconf --install # use autoreconf --force the next times you want re-build configure
#if needed, use: 'automake --add-missing' and 'libtoolize --force'
./configure # can be followed by --prefix=$HOME, LDFLAGS=-L/usr/local/lib, 'CXXFLAGS=-O0 -g', etc
make # can be followed by LDFLAGS="-L/usr/local/lib -static" as well as CXXFLAGS="-DDEBUG -Wall"
make check # to automatically execute the tests
  • write some documentation in Texinfo:
 cd doc
 wget -O fdl.texi http://cvs.savannah.gnu.org/viewvc/*checkout*/gnustandards/fdl.texi?root=gnustand
ards&content-type=text%2Fplain
 touch manual_hello.texi # and edit
 make pdf

  • make your package available to anyone:
make install
make distcheck # can be followed by DISTCHECK_CONFIGURE_FLAGS=LDFLAGS=-L/usr/local/lib for instance
tar tzvf mypkg-0.1.tar.gz # to check what is in the release
  • version your code, for instance with Git (read the book!):
git init
git add AUTHORS COPYING ChangeLog INSTALL Makefile.am NEWS README TODO build-aux/* configure.ac 
git add src/Makefile.am src/hello.cpp
git add doc/Makefile.am doc/manual_hello.texi doc/fdl.texi
git add tests/Makefile.am tests/test1.bash
git commit -m "first commit"
# and edit .git/info/exclude or .gitignore, tag your release, etc

And check that you have all required files in your repo:

cd ~/tmp; git clone ~/<path_to_original_repo>/hello
autoreconf --force
./configure
make
make check
make install
make distcheck
  • share your code, for instance on GitHub (read the help!)
  • Tips:
    • if your package uses libtool, you need to use gdb like this: $ libtool --mode=execute gdb --args myprogram -i input.txt


Personal tools