[FE training-materials-updates] slides/autotools-advanced: use minted all over the place
Boris Brezillon
boris.brezillon at free-electrons.com
Fri May 22 17:13:24 CEST 2015
Repository : git://git.free-electrons.com/training-materials.git
On branch : mtd-rework-WIP
Link : http://git.free-electrons.com/training-materials/commit/?id=fbea83a5c935279e1a924f254eff2b05068b7a3d
>---------------------------------------------------------------
commit fbea83a5c935279e1a924f254eff2b05068b7a3d
Author: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date: Wed May 20 15:35:25 2015 +0200
slides/autotools-advanced: use minted all over the place
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>---------------------------------------------------------------
fbea83a5c935279e1a924f254eff2b05068b7a3d
slides/autotools-advanced/autotools-advanced.tex | 156 ++++++++++-------------
1 file changed, 66 insertions(+), 90 deletions(-)
diff --git a/slides/autotools-advanced/autotools-advanced.tex b/slides/autotools-advanced/autotools-advanced.tex
index 7b8edb3..d57c692 100644
--- a/slides/autotools-advanced/autotools-advanced.tex
+++ b/slides/autotools-advanced/autotools-advanced.tex
@@ -14,21 +14,19 @@
generally named \code{config.h}
\item Declared using \code{AC_CONFIG_HEADERS}
\begin{block}{\code{configure.ac} extract}
-{\scriptsize
-\begin{verbatim}
+\begin{minted}[fontsize=\scriptsize]{bash}
AC_CONFIG_HEADERS([config.h])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Example config.h}
-{\scriptsize
-\begin{verbatim}
+\begin{minted}[fontsize=\scriptsize]{c}
/* Define if the complete vga libraries (vga, vgagl) are installed */
/* #undef HAVE_LIBVGA */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
-\end{verbatim}}
+\end{minted}
\end{block}
\end{itemize}
\end{frame}
@@ -42,9 +40,9 @@ AC_CONFIG_HEADERS([config.h])
\end{itemize}
\begin{block}{\code{configure.ac}}
-\begin{verbatim}
+\begin{minted}{bash}
AC_DEFINE([FOOBAR], [42], [This is the foobar value])
-\end{verbatim}
+\end{minted}
\end{block}
\begin{block}{Generated \code{config.h}}
@@ -87,13 +85,12 @@ AC_DEFINE([FOOBAR], [42], [This is the foobar value])
\begin{frame}[fragile]{{\tt AC\_CHECK\_FUNCS()} example}
\begin{block}{configure.ac}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{bash}
AC_CHECK_FUNCS([printf foobar])
echo "ac_cv_func_printf: ${ac_cv_func_printf}"
echo "ac_cv_func_foobar: ${ac_cv_func_foobar}"
AC_CONFIG_HEADER([config.h])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Execution of \code{./configure}}
@@ -110,8 +107,7 @@ config.status: creating config.h
\end{block}
\begin{block}{Generated \code{config.h}}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{c}
[...]
/* Define to 1 if you have the `foobar' function. */
/* #undef HAVE_FOOBAR */
@@ -119,7 +115,7 @@ config.status: creating config.h
/* Define to 1 if you have the `printf' function. */
#define HAVE_PRINTF 1
[...]
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
@@ -149,15 +145,14 @@ config.status: creating config.h
\begin{frame}[fragile]{{\tt AC\_CHECK\_HEADERS} example}
\begin{block}{\code{configure.ac}}
-{\scriptsize
-\begin{verbatim}
+\begin{minted}[fontsize=\scriptsize]{bash}
[...]
AC_CHECK_HEADERS([spawn.h],
[echo "Header spawn.h was found"; has_spawn=yes],
[echo "Header spawn.h was not found"])
echo ${has_spawn}
[...]
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Execution of \code{./configure}}
@@ -175,11 +170,11 @@ yes
\begin{frame}[fragile]{Checking for libraries}
\begin{block}{}
-\begin{verbatim}
+\begin{minted}{bash}
AC_SEARCH_LIBS (function, search-libs,
[action-if-found], [action-if-not-found],
[other-libraries])
-\end{verbatim}
+\end{minted}
\end{block}
\begin{itemize}
@@ -201,10 +196,9 @@ AC_SEARCH_LIBS (function, search-libs,
\begin{frame}[fragile]{{\tt AC\_SEARCH\_LIBS} example}
\begin{block}{\code{configure.ac}}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AC_SEARCH_LIBS(mvwaddstr, [ncurses cursesX curses])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Execution of \code{./configure}}
@@ -273,13 +267,12 @@ gcc -g -O2 -o test test.o common.o -lncurses
\begin{frame}[fragile]{Writing new tests: {\tt AC\_LINK\_IFELSE}}
\begin{block}{\code{configure.ac}}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
[char *codeset = nl_langinfo (CODESET);])],
[glib_cv_langinfo_codeset=yes],
[glib_cv_langinfo_codeset=no])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Variable in \code{config.log}}
@@ -323,15 +316,14 @@ glib_cv_langinfo_codeset=yes
\begin{frame}[fragile]{Printing messages: example}
\begin{block}{\code{configure.ac}}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AC_MSG_CHECKING([for nl_langinfo])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
[char *codeset = nl_langinfo (CODESET);])],
[glib_cv_langinfo_codeset=yes],
[glib_cv_langinfo_codeset=no])
AC_MSG_RESULT([$glib_cv_langinfo_codeset])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Execution of \code{./configure}}
@@ -355,11 +347,10 @@ checking for nl_langinfo... yes
software.
\item Implemented using the \code{AC_ARG_WITH} macro.
\begin{block}{}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AC_ARG_WITH (package, help-string,
[action-if-given], [action-if-not-given])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{itemize}
\item \code{package} gives the name of the option
@@ -384,11 +375,10 @@ AC_ARG_WITH (package, help-string,
are generally offered to control the optional feature.
\item Implemented using the \code{AC_ARG_ENABLE} macro.
\begin{block}{}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AC_ARG_ENABLE (feature, help-string,
[action-if-given], [action-if-not-given])
-\end{verbatim}}
+\end{minted}
\end{block}
\item Usage very similar to the one of \code{AC_ARG_WITH}
\item Value available as \code{$enableval} inside {\em
@@ -404,11 +394,10 @@ AC_ARG_ENABLE (feature, help-string,
\item Allows to properly align the different options in the
\code{./configure --help} output
\begin{block}{}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
AS_HELP_STRING (left-hand-side, right-hand-side,
[indent-column = ‘26’], [wrap-column = ‘79’])
-\end{verbatim}}
+\end{minted}
\end{block}
\end{itemize}
\end{frame}
@@ -416,13 +405,12 @@ AS_HELP_STRING (left-hand-side, right-hand-side,
\begin{frame}[fragile]{{\tt AC\_ARG\_ENABLE} example}
\begin{block}{configure.ac}
-{\scriptsize
-\begin{verbatim}
+\begin{minted}[fontsize=\scriptsize]{bash}
AC_ARG_ENABLE([test], AS_HELP_STRING([--enable-test], [Enable tests]),
[echo "Action if given, val = ${enableval}"],
[echo "Action if not given"])
echo "enable_test = ${enable_test}"
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{\code{./configure} tests}
@@ -483,11 +471,10 @@ enable_test = no
\begin{itemize}
\item Syntax:
\begin{block}{}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
PKG_CHECK_MODULES(prefix, list-of-modules,
action-if-found, action-if-not-found)
-\end{verbatim}}
+\end{minted}
\end{block}
\item \code{prefix} will be used to create the
\code{<prefix>_CFLAGS} and \code{<prefix>_LIBS} variables
@@ -509,21 +496,19 @@ PKG_CHECK_MODULES(prefix, list-of-modules,
\begin{frame}[fragile]{{\tt PKG\_CHECK\_MODULES} example}
\begin{block}{configure.ac}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{bash}
PKG_CHECK_MODULES(DBUS1,
dbus-1 >= 1.2.14,
[AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
have_dbus1=no)
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
@@ -599,22 +584,22 @@ gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
\end{itemize}
\begin{block}{configure.ac}
-\begin{verbatim}
+\begin{minted}{bash}
AC_CONFIG_FILES([Makefile src/Makefile])
-\end{verbatim}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-\begin{verbatim}
+\begin{minted}{make}
SUBDIRS = src
-\end{verbatim}
+\end{minted}
\end{block}
\begin{block}{src/Makefile.am}
-\begin{verbatim}
+\begin{minted}{make}
bin_PROGRAMS = hello
hello_SOURCES = main.c
-\end{verbatim}
+\end{minted}
\end{block}
\end{frame}
@@ -628,17 +613,17 @@ hello_SOURCES = main.c
\end{itemize}
\begin{block}{configure.ac}
-\begin{verbatim}
+\begin{minted}{bash}
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_FILES([Makefile])
-\end{verbatim}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-\begin{verbatim}
+\begin{minted}{make}
bin_PROGRAMS = hello
hello_SOURCES = src/main.c
-\end{verbatim}
+\end{minted}
\end{block}
\end{frame}
@@ -655,19 +640,19 @@ hello_SOURCES = src/main.c
\end{itemize}
\begin{block}{configure.ac}
-\begin{verbatim}
+\begin{minted}{bash}
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
-\end{verbatim}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-\begin{verbatim}
+\begin{minted}{make}
if DEBUG
...
else
...
endif
-\end{verbatim}
+\end{minted}
\end{block}
\end{frame}
@@ -678,23 +663,21 @@ endif
\column{0.3\textwidth}
You cannot use conditionals inside a variable definition
\begin{block}{Non-working example}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
bin_PROGRAMS = \
bar \
if DEBUG
baz \
endif
foobar
-\end{verbatim}}
+\end{minted}
\end{block}
\column{0.3\textwidth}
You should instead use an intermediate variable
\begin{block}{Working example}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
if DEBUG
DEBUG_PROGS = baz
endif
@@ -703,15 +686,14 @@ bin_PROGRAMS = \
bar \
$(DEBUG_PROGS) \
foobar
-\end{verbatim}}
+\end{minted}
\end{block}
\column{0.3\textwidth}
Or the \code{+=} assigment sign
\begin{block}{Working example}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
bin_PROGRAMS = \
bar \
foobar
@@ -719,7 +701,7 @@ bin_PROGRAMS = \
if DEBUG
bin_PROGRAMS += baz
endif
-\end{verbatim}}
+\end{minted}
\end{block}
\end{columns}
\end{frame}
@@ -727,17 +709,15 @@ endif
\begin{frame}[fragile]{Conditional example}
\begin{block}{configure.ac}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{bash}
AM_CONDITIONAL(THREADS_POSIX, [test "$g_threads_impl" = "POSIX"])
AM_CONDITIONAL(THREADS_WIN32, [test "$g_threads_impl" = "WIN32"])
AM_CONDITIONAL(THREADS_NONE, [test "$g_threads_impl" = "NONE"])
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
libglib_2_0_la_SOURCES = \
$(deprecated_sources) \
glib_probes.d \
@@ -751,7 +731,7 @@ if THREADS_POSIX
libglib_2_0_la_SOURCES += gthread-posix.c
endif
endif
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
@@ -783,25 +763,23 @@ endif
\begin{frame}[fragile]{Libtool library example}
\begin{block}{configure.ac}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{bash}
[...]
LT_PREREQ([2.4])
LT_INIT
[...]
-\end{verbatim}}
+\end{minted}
\end{block}
\begin{block}{Makefile.am}
-{\small
-\begin{verbatim}
+\begin{minted}[fontsize=\small]{make}
bin_PROGRAMS = hello
hello_SOURCES = src/main.c
lib_LTLIBRARIES = libmyhello.la
libmyhello_la_SOURCES = lib/core.c
include_HEADERS = lib/myhello.h
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
@@ -860,12 +838,11 @@ $ find /tmp/test
\end{itemize}
\begin{block}{Example}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
LDADD = $(top_builddir)/glib/libglib-2.0.la
AM_CPPFLAGS = $(gmodule_INCLUDES) $(GLIB_DEBUG_FLAGS)
AM_CFLAGS = -g
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
@@ -880,14 +857,13 @@ AM_CFLAGS = -g
\end{itemize}
\begin{block}{Example}
-{\tiny
-\begin{verbatim}
+\begin{minted}[fontsize=\tiny]{make}
LDADD = $(top_builddir)/glib/libglib-2.0.la
module_test_LDADD = $(top_builddir)/gmodule/libgmodule-2.0.la $(LDADD)
module_test_LDFLAGS = $(G_MODULE_LDFLAGS)
slice_threadinit_LDADD = $(top_builddir)/gthread/libgthread-2.0.la $(LDADD)
-\end{verbatim}}
+\end{minted}
\end{block}
\end{frame}
More information about the training-materials-updates
mailing list