User:Timothee Flutre/Notebook/Postdoc/2012/11/27
From OpenWetWare
(Difference between revisions)
(→How to make a GNU package?: add info about documentation) |
(→How to make a GNU package?: add tip for how to use -static) |
||
| (7 intermediate revisions not shown.) | |||
| Line 8: | Line 8: | ||
==How to make a GNU package?== | ==How to make a GNU package?== | ||
| - | * find a name for the package | + | * find a name for the package, for instance "hello" |
* structure the package directory: | * structure the package directory: | ||
| - | touch README INSTALL NEWS AUTHORS | + | mkdir mypkg; cd mypkg |
| - | mkdir src build-aux doc | + | 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 <code>src/</code> directory with your code, e.g. <code>hello.cpp</code> | * populate the <code>src/</code> directory with your code, e.g. <code>hello.cpp</code> | ||
| - | * use [http://en.wikipedia.org/wiki/GNU_build_system Autotools] (see [http://www.lrde.epita.fr/~adl/autotools.html tutorial]): | + | * retrieve the license, for instance [http://www.gnu.org/licenses/gpl.html GPLv3]: |
| - | touch configure.ac Makefile.am src/Makefile.am doc/Makefile.am #and edit | + | wget -O COPYING http://www.gnu.org/licenses/gpl-3.0.txt |
| - | autoreconf --install | + | |
| - | ./configure #can be followed by --prefix= | + | * fill the information files, such as README ([http://bzr.savannah.gnu.org/lh/gsl/trunk/annotate/head:/README example]), INSTALL ([http://bzr.savannah.gnu.org/lh/gsl/trunk/annotate/head:/INSTALL example])... |
| - | make | + | |
| - | make check | + | * use [http://en.wikipedia.org/wiki/GNU_build_system Autotools] (see the [http://www.gnu.org/software/automake/manual/automake.html manual] and this [http://www.lrde.epita.fr/~adl/autotools.html tutorial]; for the tests, have a look [http://www.sourceware.org/autobook/autobook/autobook_98.html here]): |
| + | 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 | ||
| + | ./configure # can be followed by --prefix=~/bin, LDFLAGS=-L/usr/local/lib, etc | ||
| + | make # can be followed by LDFLAGS="-L/usr/local/lib -static" | ||
| + | make check # to automatically execute the tests | ||
* write some documentation in [http://en.wikipedia.org/wiki/Texinfo Texinfo]: | * write some documentation in [http://en.wikipedia.org/wiki/Texinfo Texinfo]: | ||
| Line 28: | Line 34: | ||
wget -O fdl.texi http://cvs.savannah.gnu.org/viewvc/*checkout*/gnustandards/fdl.texi?root=gnustand | wget -O fdl.texi http://cvs.savannah.gnu.org/viewvc/*checkout*/gnustandards/fdl.texi?root=gnustand | ||
ards&content-type=text%2Fplain | ards&content-type=text%2Fplain | ||
| - | touch | + | touch manual_hello.texi # and edit |
| + | make pdf | ||
</nowiki> | </nowiki> | ||
* make your package available to anyone: | * make your package available to anyone: | ||
make install | make install | ||
| - | make | + | make distcheck # can be followed by DISTCHECK_CONFIGURE_FLAGS=LDFLAGS=-L/usr/local/lib for instance |
| - | make | + | tar tzvf mypkg-0.1.tar.gz # to check what is in the release |
| + | |||
| + | * version your code, for instance with [http://en.wikipedia.org/wiki/Git_%28software%29 Git] (read the [http://git-scm.com/book 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 [http://en.wikipedia.org/wiki/GitHub GitHub] ( | + | * share your code, for instance on [http://en.wikipedia.org/wiki/GitHub GitHub] (read the [http://help.github.com/ help]!) |
<!-- ##### 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 19:27, 27 January 2013
Main project page Previous entry
| |
How to make a GNU package?
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
wget -O COPYING http://www.gnu.org/licenses/gpl-3.0.txt 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 ./configure # can be followed by --prefix=~/bin, LDFLAGS=-L/usr/local/lib, etc make # can be followed by LDFLAGS="-L/usr/local/lib -static" make check # to automatically execute the tests
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 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 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 | |



