Commit 63c2bfe4 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Separate the library and the program

parent 209d3f54
Pipeline #78149 passed with stages
in 3 minutes and 32 seconds
......@@ -21,85 +21,4 @@
# job)
*~
/.version
/ABOUT-NLS
/INSTALL
/Makefile.in
/aclocal.m4
/ar-lib
/autom4te.cache
/compile
/config.guess
/config.h.in
/config.rpath
/config.sub
/configure
/depcomp
/doc/tarot-tmp.org
/doc/tarot.info
/doc/tarot.texi
/install-sh
/lib
/libtool
/ltmain.sh
/m4
/mdate-sh
/missing
/po/Makefile.in.in
/po/Makevars.template
/po/POTFILES
/po/Rules-quot
/po/boldquot.sed
/po/en@boldquot.gmo
/po/en@boldquot.header
/po/en@boldquot.po
/po/en@quot.gmo
/po/en@quot.header
/po/en@quot.po
/po/fr.gmo
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sed
/po/remove-potcdate.sin
/po/stamp-po
/po/tarot.pot
/snippet
/src/cards/cards.c
/src/cards/tarot.c
/src/cards/tarot.l
/src/lexer/tarot.c
/src/parser/tarot.c
/src/program/cmdline.c
/src/program/cmdline.h
/src/program/tarot-bid.c
/src/program/tarot-bid.h
/src/program/tarot-call.c
/src/program/tarot-call.h
/src/program/tarot-deal.c
/src/program/tarot-deal.h
/src/program/tarot-decl.c
/src/program/tarot-decl.h
/src/program/tarot-discard.c
/src/program/tarot-discard.h
/src/program/tarot-dog.c
/src/program/tarot-dog.h
/src/program/tarot-handful.c
/src/program/tarot-handful.h
/src/program/tarot-help.c
/src/program/tarot-help.h
/src/program/tarot-license.c
/src/program/tarot-license.h
/src/program/tarot-new.c
/src/program/tarot-new.h
/src/program/tarot-play.c
/src/program/tarot-play.h
/src/program/tarot-setup.c
/src/program/tarot-setup.h
/src/program/tarot-status.c
/src/program/tarot-status.h
/src/program/tarot-version.c
/src/program/tarot-version.h
/src/program/tarot.6.gz
/test-driver
/texinfo.tex
/version.texi
\ No newline at end of file
public
\ No newline at end of file
________________________________________
READ ME !
Vivien Kraus <vivien@planete-kraus.eu>
________________________________________
Table of Contents
_________________
1 READ ME
2 About tarot
3 Project site
4 Download tarot
5 Compile this project
.. 5.1 Gitlab users: make a source distribution
..... 5.1.1 The CI/CD pipeline
.. 5.2 Everyone: configure, make and install
6 Let me know
1 READ ME
=========
RUN THE CONFIGURE SCRIPT NOT `autogen.sh'. If you don't have a
configure script, see section 5.1.
2 About tarot
=============
This repository hosts the project named Tarot, for /The Amazing Rules
Of Tarot/. It aims at providing a game and an artificial
intelligence.
3 Project site
==============
Go check out the [project manual].
[project manual]
http://gugurumbe.frama.io/tarot/share/doc/tarot/tarot.html/index.html
4 Download tarot
================
Tarot is hosted [on gitlab]. You can download the source distribution
from the latest commit [here]. However, you should still be able to
build from the git repo, provided you have the required programs like
emacs...
[on gitlab] https://framagit.org/gugurumbe/tarot
[here] http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
5 Compile this project
======================
To compile this project, you will need a /source distribution/. If
you have received an archive of source code, then you it is what you
have. If you cloned this project from gitlab, then you have to do
some more work.
5.1 Gitlab users: make a source distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need more tools in order to bootstrap the source distribution.
I am assuming you run on debian stable, if you don't then please tell
me. If you work on a platform where the a tool required to make a
distribution, such as emacs with a recent enough version of org-mode
is /not/ available, or difficult to install, then I advise you to make
a /source/ distribution from an easier system or download [the build
from the latest passing commit], and then use this distribution as
discussed in section 5.2.
[the build from the latest passing commit]
http://gugurumbe.frama.io/tarot/tarot-devel.tar.gz
5.1.1 The CI/CD pipeline
------------------------
Once you push your commit, the CI/CD settings in `gitlab-ci.yml' will:
1. Make a source distribution, using various programs in the debian
stable distro (gperf, flex, bison, emacs, indent, help2man, ...);
2. Check that the commit is not modified by a standard build and
indent (thus, check that the commit is indented);
3. Build the manual as a set of HTML files.
5.2 Everyone: configure, make and install
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can run:
,----
| ./configure --help
`----
to know what options are available. If you want more details, see
`INSTALL'.
There are some dependencies, some optional, some are known not to have
a pkg-config configuration. In this case, pass the compiler flags and
linker flags as instructed at the end of `./configure --help'.
6 Let me know
=============
I develop Tarot as a personal hobby. If you find it interesting, or
have bugs to submit, please let me know: `vivien@planete-kraus.eu'
......@@ -4,42 +4,84 @@ apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends texlive-base texlive-latex-base git ca-certificates texlive-fonts-recommended texlive-generic-recommended autoconf automake gettext autopoint libtool texinfo gnulib autoconf-archive make gcc flex bison gperf emacs org-mode indent check gengetopt help2man libreadline-dev libunistring-dev valgrind autogen
SOURCE=$(pwd)
mkdir -p ../rebuilt ../clean
chmod -R ugo+w ../rebuilt ../clean || exit 1
rm -rf ../rebuilt ../clean || exit 1
mkdir -p ../rebuilt ../clean || exit 1
cd ../clean
git clone $SOURCE . || exit 1
cd ../rebuilt
git clone $SOURCE . || exit 1
sh ./autogen.sh || exit 1
SOURCE_TOP=$(pwd)
CLEAN_TOP=$(cd .. && pwd)/clean
mkdir -p ../clean
chmod -R ugo+w ../clean || exit 1
rm -rf ../clean || exit 1
mkdir -p ../clean || exit 1
cd $CLEAN_TOP
git clone $SOURCE_TOP . || exit 1
## Distribution of the library
cd $SOURCE_TOP || exit 1
cd library || exit 1
rm -rf ../../libtarot-*.tar.gz ../../libtarot-*/ libtarot-*.tar.gz
sh autogen.sh || exit 1
./configure \
CFLAGS="-Wall -Wextra -g -O0 -Wno-unused-function" \
--with-asan=yes \
--with-libunistring=yes \
--prefix="$PWD/public" \
--prefix="$SOURCE_TOP/root" \
|| (cat config.log ; exit 1) \
|| exit 1
make indent || exit 1
(cd lib && make -j 16) || exit 1
make -j 16 distcheck || exit 1
make -j 16 check || exit 1
make -j 16 install install-html || exit 1not ignored
cp libtarot-*.tar.gz ../../ || exit 1
cd ../../ || exit 1
tar xf libtarot-*.tar.gz || exit 1
cd libtarot-* || exit 1
DIST_TOP=$(pwd)
cd $CLEAN_TOP/library || exit 1
OK="yes"
for source in $(find . -type f)
do
case $source in
*.po | *.pot)
echo "Ignoring PO file $source, as it has a date in it.";;
*.md)
echo "Ignoring Markdown file $source, as it may be non-reproducibly generated by org-mode.";;
*)
if ! $(diff $source $DIST_TOP/$source)
then
echo "ERROR: $source has been modified since check-in, or ignored from the distribution. Is it automatically generated? Did you forget to indent it? Did you forget to include it as distributed in Automake?"
OK="no"
fi;;
esac
done;
if test "$OK" = "no"
then
echo "Failure."
exit 1
fi
echo "INDENTING"
## Distribution of the program
cd $SOURCE_TOP || exit 1
cd program || exit 1
rm -rf ../../tarot-*.tar.gz ../../tarot-*/ tarot-*.tar.gz
sh autogen.sh || exit 1
export PKG_CONFIG_PATH="$SOURCE_TOP/root/share/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$SOURCE_TOP/root/lib:$LD_LIBRARY_PATH"
echo "Looking for libtarot.pc in $PKG_CONFIG_PATH"
./configure \
CFLAGS="-Wall -Wextra -g -O0" \
--prefix="$SOURCE_TOP/public" \
|| (cat config.log ; exit 1) \
|| exit 1
make indent || exit 1
echo "GNULIB"
(cd lib && make -j 16) || exit 1
echo "DIST"
make -j 16 distcheck || exit 1
echo "CHECK"
make -j 16 check || exit 1
echo "INSTALL"
make -j 16 install || exit 1
rm -rf ../tarot-*.tar.gz ../tarot-*/
cp tarot-*.tar.gz ../ || exit 1
cd ..
make -j 16 install install-html || exit 1
rm -rf ../../tarot-*.tar.gz ../../tarot-*/
cp tarot-*.tar.gz ../../ || exit 1
cd ../../ || exit 1
tar xf tarot-*.tar.gz || exit 1
cd tarot-* || exit 1
DIST=$(pwd)
cd $SOURCE/../clean
DIST_TOP=$(pwd)
cd $CLEAN_TOP/program || exit 1
OK="yes"
for source in $(find . -type f)
do
......@@ -48,24 +90,26 @@ do
echo "Ignoring PO file $source, as it has a date in it.";;
*.md)
echo "Ignoring Markdown file $source, as it may be non-reproducibly generated by org-mode.";;
*~)
echo "Ignoring backup file $source.";;
./.git/*);;
./tarot-*);;
*)
if ! $(diff $source $DIST/$source)
if ! $(diff $source $DIST_TOP/$source)
then
echo "ERROR: $source has been modified since check-in, or ignored from the distribution. Is it automatically generated? Did you forget to indent it? Did you forget to include it as distributed in Automake?"
OK="no"
fi;;
esac
done;
if test "$OK" = "no"
then
echo "Failure."
exit 1
fi
mkdir -p $SOURCE/public || exit 1
cp ../rebuilt/.version $SOURCE/public || exit 1
cp ../tarot-*.tar.gz $SOURCE/public/ || exit 1
## Nice!
cd $SOURCE_TOP || exit 1
mkdir -p $SOURCE_TOP/public || exit 1
cp $SOURCE_TOP/library/.version \
$SOURCE_TOP/public/library-version || exit 1
cp $SOURCE_TOP/program/.version \
$SOURCE_TOP/public/program-version || exit 1
cp ../libtarot-*.tar.gz $SOURCE_TOP/public/ || exit 1
cp ../tarot-*.tar.gz $SOURCE_TOP/public/ || exit 1
#!/bin/sh
VERSION=$(cat public/.version)
LIBRARY_VERSION=$(cat public/library-version)
PROGRAM_VERSION=$(cat public/program-version)
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends build-essential libreadline-dev libunistring-dev texinfo
cp public/tarot-$VERSION.tar.gz . || exit 1
tar xf tarot-$VERSION.tar.gz || exit 1
apt-get install -y --no-install-recommends \
build-essential \
libreadline-dev \
libunistring-dev \
texinfo \
pkg-config
cp public/libtarot-$LIBRARY_VERSION.tar.gz . || exit 1
cp public/tarot-$PROGRAM_VERSION.tar.gz . || exit 1
tar xf libtarot-$LIBRARY_VERSION.tar.gz || exit 1
tar xf tarot-$PROGRAM_VERSION.tar.gz || exit 1
mkdir build || exit 1
cd build/
../tarot-$VERSION/configure \
../libtarot-$LIBRARY_VERSION/configure \
--prefix="$PWD/root" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
make -j 16 install || exit 1
make distclean || exit 1
export PKG_CONFIG_PATH="$PWD/root/share/pkgconfig:$PKG_CONFIG_PATH"
../tarot-$PROGRAM_VERSION/configure \
--prefix="$PWD/../public" \
--enable-silent-rules=yes \
|| (cat config.log; exit 1)
......
dnl AX_TAROT_PACKAGE(package_var, package, sensible_cflags,
dnl sensible_libs, headers, functions, action_if_found,
dnl action_if_not_found)
AC_DEFUN([AX_TAROT_PACKAGE], [
SAVED_CFLAGS="$CFLAGS"
SAVED_LIBS="$LIBS"
PKG_CHECK_MODULES([$1], [$2], [], [
AC_MSG_WARN([Could not find [$1] with pkg-config... Trying sensible defaults.])
$1_CFLAGS="[$3]"
$1_LIBS="[$4]"
])
CFLAGS="$SAVED_FLAGS $$1_CFLAGS"
LIBS="$SAVED_LIBS $$1_LIBS"
FOUND_HEADERS="yes"
FOUND_FUNCTION="yes"
m4_foreach_w([header], [$5], [
AC_CHECK_HEADER([header], [], [FOUND_HEADERS="no"])
])
m4_foreach_w([function], [$6], [
AC_CHECK_FUNC([function], [], [FOUND_FUNCTIONS="no"])
])
CFLAGS="$SAVED_CFLAGS"
LIBS="$SAVED_LIBS"
AC_SUBST([$1_CFLAGS])
AC_SUBST([$1_LIBS])
AS_IF([test "x$FOUND_HEADERS" != "xno" && test "x$FOUND_FUNCTIONS" != "xno"], [$7], [$8])
])
......@@ -16,10 +16,7 @@
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
SUBDIRS = po lib
if NEED_LIBOPTS
SUBDIRS += $(LIBOPTS_DIR)
endif # NEED_LIBOPTS
SUBDIRS = lib
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS =
......@@ -35,62 +32,40 @@ pkgconfig_DATA =
pkgdatadir = $(datadir)/@PACKAGE@
pkgdata_SCRIPTS =
dist_pkgdata_DATA = COPYING
sysconf_DATA =
dist_sysconf_DATA =
tarotsysconfdir = $(sysconfdir)/tarot
tarotsysconf_DATA =
dist_tarotsysconf_DATA =
INDENTED =
SUFFIXES =
dist_noinst_SCRIPTS = \
autogen.sh \
run-tarot.sh \
build-aux/git-version-gen \
ci/dist.sh \
ci/pages.sh
build-aux/git-version-gen
nodist_noinst_DATA =
dist_man_MANS =
ACLOCAL_AMFLAGS = -I m4 -I custom-m4
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = \
.gitignore \
tarot.org \
setup.el \
AUTHORS.org \
.dir-locals.el.in \
.gitlab-ci.yml \
Dockerfile \
m4/gnulib-cache.m4 \
$(top_srcdir)/.version
BUILT_SOURCES = \
$(top_srcdir)/.version
AM_DISTCHECK_CONFIGURE_FLAGS = \
--with-asan=yes \
--enable-silent-rules=yes
AM_CPPFLAGS = \
-DLOCALEDIR="\"$(localedir)\"" \
-DSYSCONFDIR="\"$(sysconfdir)\"" \
-I. -I$(srcdir) \
-Ilib -I$(srcdir)/lib
AM_CFLAGS =
AM_YFLAGS = -d
AM_LIBS =
AM_LDADD = $(LTLIBINTL) $(LTLIBTHREAD) @INTL_MACOSX_LIBS@
AM_LDADD =
# Texinfo -> html flags, overriden in doc/Makefile.am
AM_MAKEINFOHTMLFLAGS =
CLEANFILES = core
TESTS =
AM_TESTS_ENVIRONMENT = LANG="C" $(LIBTOOL) --mode=execute
if HAVE_VALGRIND
AM_TESTS_ENVIRONMENT += $(VALGRIND) --tool=memcheck
endif # HAVE_VALGRIND
TEST_EXTENSIONS = .tarot
TAROT_LOG_COMPILER = $(SHELL) $(top_srcdir)/run-tarot.sh
AM_TAROT_LOG_FLAGS =
include doc/Makefile.am
include src/Makefile.am
include games/Makefile.am
TESTS += $(check_PROGRAMS)
indent_verbose = $(indent_verbose_@AM_V@)
......
________________________________________
LIBTAROT
Vivien Kraus <vivien@planete-kraus.eu>
________________________________________
Table of Contents
_________________
Welcome to the libtarot source code! This is a pure library. For now
it does not, but it could bind to other C libraries, provided that these
libraries would not manage resources like memory, the file system, and
not mess with the control flow, like abort (except for assertions) or
setjump / longjump.
You will find the usual autogen.sh, configure.ac, Makefile.am, a
pkg-config configuration file, a script in build-aux to guess the
development version number, the manual under doc/, and the gnulib module
(assert) under lib/.
#!/bin/sh
# autogen.sh
#
# Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
(echo "@setfilename tarot.info" \
&& echo '\bye') > doc/tarot.texi || exit 1
gnulib-tool --libtool \
--import assert || exit 1
autoreconf -vif || exit 1
rm doc/tarot.texi || exit 1
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([libtarot],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[vivien@planete-kraus.eu])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_STDC
gl_EARLY
AM_INIT_AUTOMAKE
AM_PROG_AR
LT_INIT
AM_MISSING_PROG([GPERF], [gperf])
AM_MISSING_PROG([INDENT], [indent])
AM_MISSING_PROG([EMACS], [emacs])
AM_MISSING_PROG([AUTOGEN], [autogen])
AC_ARG_ENABLE([valgrind], AS_HELP_STRING([--enable-valgrind=yes],
[Run the unit tests under valgrind (slow, incompatible with asan)]))
AS_IF([test "x$enable_valgrind" = "xyes"], [
AC_PATH_PROG([VALGRIND], [valgrind], [no])
AS_IF([test "x$VALGRIND" != "xno"], [
AC_SUBST([VALGRIND])
HAVE_VALGRIND="yes"
], [
AC_MSG_ERROR([Could not find valgrind, pass --disable-valgrind])
])
])
AM_CONDITIONAL([HAVE_VALGRIND], [test "x$HAVE_VALGRIND" = "xyes"])
# Checks for libraries.
gl_INIT
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CONFIG_FILES([
Makefile
lib/Makefile
src/libtarot.pc
])
AC_OUTPUT
# Makefile.am
#
# Copyright (C) 2017, 2018 Vivien Kraus <vivien@planete-kraus.eu>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
info_TEXINFOS += %reldir%/tarot.texi
%canon_reldir%_tarot_TEXINFOS = \
%reldir%/fdl.texi
AM_MAKEINFOHTMLFLAGS += --css-include %reldir%/style.css
EXTRA_DIST += \
%reldir%/style.css \
%reldir%/ChangeLog \
%reldir%/tarot.org \
%reldir%/setup.el
%reldir%/tarot.texi: %reldir%/tarot.org %reldir%/setup.el .version
$(AM_V_GEN) (cd $(srcdir)/%reldir% && \
LIBTAROT_VERSION="$(VERSION)" \
$(EMACS) --batch -q \
-l setup.el \