Andre Noll [Thu, 27 Feb 2014 18:10:55 +0000 (19:10 +0100)]
Merge branch 't/cmd_improvements'
Cooking since 2014-01-16.
* t/cmd_improvements:
afs.cmd: Strip redundant "sort" from ls help output.
audiod.cmd: Improve grab client help text.
afs.cmd: Improve second level indenting.
afd.cmd: Fix a trivial whitespace issue.
Andre Noll [Sat, 22 Feb 2014 16:29:10 +0000 (17:29 +0100)]
Merge branch 't/sync'
Cooking since 2014-01-14.
* t/sync:
The sync filter.
net: Let maksock() callers perform flowopt cleanup.
net: makesock_addrinfo(): Make socketfd local to the loop.
net: Let makesock() continue on setsockopt() failure.
net: Reduce indentation level in makesock_addrinfo().
net: Further simplify makesock_addrinfo().
net: Replace the double loop of lookup_address() by a single loop.
net: makesock(): Combine code for passive sockets.
net: Change makesock_addrinfo() to set given flowopts before SO_REUSEADDR.
net: Clarify code flow of makesock_addrinfo().
net: Remove unnecessary condition in makesock_addrinfo().
net: Remove pointless initialization in makesock_addrinfo().
net: Kill dead code in makesock_addrinfo().
net: Remove networking headers from para.h.
net: Improve error handling of makesock_addrinfo().
net: Split makesock(), part 2: Introduce makesock_addrinfo().
net: Split makesock(), part 1: Introduce lookup_address().
net: Simplify makesock().
net: Fix parse_url().
net: Correct \return text of parse_url().
Andre Noll [Fri, 20 Dec 2013 22:08:48 +0000 (23:08 +0100)]
afs.cmd: Improve second level indenting.
Currently we have an empty line between each item, mainly to make sure
that man pages including the html version look nice. However, indenting
by spaces and dropping the empty lines looks better in the plaintext
version (help output) while still keeping help2man and man2html happy.
Andre Noll [Sun, 8 Sep 2013 07:31:37 +0000 (07:31 +0000)]
net: Let maksock() callers perform flowopt cleanup.
Currently the flowopt user allocates the flowopt structure but
cleanup is performed in makesock(). This commit makes the API
symmetric by dropping the cleanup part in makesock() and exporting
flowopt_cleanup(). Now callers have to perform both the allocation
and the cleanup.
The single user (ddcp_recv) is adjusted accordingly.
Andre Noll [Sun, 8 Sep 2013 05:21:22 +0000 (05:21 +0000)]
net: Let makesock() continue on setsockopt() failure.
If the setsockopt() call succeeds but the following bind() fails, we
happily continue to process the address info structure. It seems wrong
to abort the loop if setsockopt() could not enable SO_REUSEADDR. Just
continue in this case.
Andre Noll [Sat, 7 Sep 2013 00:05:40 +0000 (00:05 +0000)]
net: Split makesock(), part 2: Introduce makesock_addrinfo().
This extracts the addressinfo part of makesock() into the new
makesock_addrinfo(). Hence makesock() becomes a simple function
which first calls lookup_address(), then makesock_addrinfo().
The two helper functions lookup_address() and makesock_addrinfo()
can be made public once there is a need for them.
Andre Noll [Fri, 20 Dec 2013 12:39:49 +0000 (13:39 +0100)]
Merge branch 't/build_system_overhaul'
This topic was quite some PITA to maintain since its commits heavily
conflict with the changes of all other topic branches which touch
the build system. Cooking since 2013-12-01 and tested on FreeBSD,
NetBSD and on different Linux systems.
abb080 Rebuild error2.h on Makefile changes.
71b616 manual: Move crypt library to the list of optional packages.
185c67 build: Don't insist on curses for CLI support.
474d4d build: Rewrite objlist_to_errlist().
1453e8 build: Reorder Makefile.real.
7fb39c build: Split Makefile.in.
d0ddd2 build: Reorder variables in Makefile.in.
61cc38 build: Add Make variable for clock_gettime_ldflags.
976651 build: Add Make variable for PACKAGE_TARNAME.
19b0d3 build: Introduce Make variables for objects.
fe7666 build: Combine link rules.
2440c4 build: Introduce $prefixed_executables.
2f113b build: Combine rules for object files.
761d9b build: Define Make variables for cppflags.
386572 build: Remove two unused variables from Makefile.in.
40439a build: Collect audio format handlers in afh section.
e926e8 build: Move relevant parts to filter section.
b399d6 build: Move relevant parts to gui section.
1781cc build: Move relevant parts to fade section.
0f4790 build: Move relevant parts to audiod section.
4e9788 build: Move relevant parts to client section.
0c8626 build: Move relevant parts to server section.
755904 build: Create section for para_audioc.
d952d6 build: Create section for para_write.
9734df build: Create section for para_play.
14dee3 build: Create section for para_afh.
b1abc2 build: Create section for para_recv.
bfd5b5 build: Create section for para_filter.
9139d9 build: ldflags conversion: coreaudio.
30f966 build: ldflags conversion: libcurses.
15880b build: ldflags conversion: libnsl.
516421 build: ldflags conversion: libsocket.
ce8273 build: ldflags conversion: libgcrypt.
ad3573 build: ldflags conversion: libssl.
52ac85 build: ldflags conversion: libosl.
37083e build: ldflags conversion: libsamplerate.
7de07a build: ldflags conversion: libreadline.
0e9f1c build: ldflags conversion: libao.
ecac89 build: ldflags conversion: alsa.
6c632d build: ldflags conversion: liboss.
e74262 build: ldflags conversion: libflac.
648197 build: ldflags conversion: libmad.
91ed86 build: ldflags conversion: libfaad.
8ee713 build: ldflags/cppflags conversion: libopus.
b6c705 build: cppflags/ldflags conversion: libspeex.
7aa414 build: ldflags conversion: libvorbis.
80a639 build: ldflags conversion: libogg.
c79cdc build: cppflags/ldflags conversion: libid3tag
a02396 build: Remove duplicates from $all_objs.
d2fc4d build: Remove inactive DEBUG_CPPFLAGS.
e8f310 build: Replace error2.pl by error2.c.
06e33e build: Fix filter output of configure summary.
994889 build: Convert remaining object lists to one object per line format.
782e47 build: Separate curses detection from gui configuration.
fbe4b0 build: Move down fade section.
003815 build: Add object "cmdline" suffix only once.
3097e5 INSTALL: Add an example for cross-compiling.
e8b555 build: Fix make install for cross builds.
aab667 build: Generate man pages directly from ggo files.
9a8a15 build: Remove fnmatch, malloc, realloc tests.
2dcdd9 build: Make crypto optional.
f23353 build: Make audiod optional.
98b801 build: Build para_client only if crypto lib was found.
17ed11 build: Create a separate section for para_server.
02c1e0 build: Compute $all_errlist_objs.
4ec04c build: Replace $extras by per-executable variable.
39707e build: Remove two dead recipes from Makefile.in.
9fc99c build: Remove check for buggy snprintf().
Andre Noll [Fri, 20 Dec 2013 10:29:58 +0000 (11:29 +0100)]
Rebuild error2.h on Makefile changes.
Re-running configure without a subsequent make clean currently fails if
the set of objects has changed since the last run. This happens for
example if a different cryptolib was requested with --enable-cryptolib,
or if different libraries were detected by configure.
The problem is that error2.h is not updated according to the new
set of objects. Letting error2.h depend on Makefile should fix it,
because configure creates Makefile, so error2.h will be recreated
after reconfiguring.
Andre Noll [Sun, 17 Nov 2013 22:54:44 +0000 (23:54 +0100)]
udp_recv: Fix clang warning.
clang does not seem to like adding to a string literal:
udp_recv.c:51:45: warning: adding 'size_t' (aka 'unsigned long') to a string does not append to the string [-Wstring-plus-int]
if (memcmp(iov[1].iov_base, FEC_EOF_PACKET + iov[0].iov_len,
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
udp_recv.c:51:45: note: use array indexing to silence this warning
That's kind of silly, but if this simple change makes clang happy,
so be it.
Andre Noll [Sun, 17 Nov 2013 22:52:15 +0000 (23:52 +0100)]
aac_afh: Fix clang warning.
Although gcc seems to have no problem with it, clang complains about
illegal characters in string literals of aac_afh.c:
aac_afh.c:114:25: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
if (!atom_cmp(type1, "<A9>ART"))
^~~~
aac_afh.c:116:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>alb"))
^~~~
aac_afh.c:118:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>nam"))
^~~~
aac_afh.c:120:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>cmt"))
^~~~
aac_afh.c:122:30: warning: illegal character encoding in string literal [-Winvalid-source-encoding]
else if (!atom_cmp(type1, "<A9>day"))
This patch encodes the offending value as "\xa9" to make clang happy,
Andre Noll [Sun, 1 Dec 2013 11:11:46 +0000 (12:11 +0100)]
build: Don't insist on curses for CLI support.
On systems without curses headers/libs, support for interactive
cli tools is deactivated and a message is shown which claims that
readline depends on the curses library. This is not true: readline
uses the termcap functions, but does not link with the termcap or
curses library itself. Applications must choose an appropriate
library that provides these functions.
This change should enable readline support on systems that have
libtermcap but no curses library.
Andre Noll [Sun, 15 Sep 2013 02:39:11 +0000 (02:39 +0000)]
build: Split Makefile.in.
This trims down Makefile.in to contain only the initializations of
Make variables with their autoconf counterpart. The new Makefile.real
contains the second part, including all recipes.
With this commit, Makefile.in needs to be changed only when
configure.ac introduces new variables. In this case a full
autoconf, configure, make cycle is necessary anyway. However, if
only Makefile.real changes, a simple make run should be enough to
update everything.
Andre Noll [Sun, 15 Sep 2013 02:18:44 +0000 (02:18 +0000)]
build: Introduce Make variables for objects.
The definition of the various foo_objs variables still refers to the
autoconf variables. Having a make variable for each set of object is
another step towards the separation of autoconf and make.
Andre Noll [Sun, 15 Sep 2013 01:30:27 +0000 (01:30 +0000)]
build: Introduce $prefixed_executables.
Currently $executables contains the full basename of all
executables (para_server, para_client, ...), while the autoconf
variable @executables@ is used for the variants without the "para_"
prefix. This is rather confusing, so introduce $prefixed_executables
and stop using the @executables@ variant in Make recipes.
Andre Noll [Sun, 15 Sep 2013 01:19:50 +0000 (01:19 +0000)]
build: Combine rules for object files.
Currently we have many similar recipes for compiling object files from
.c files that need non-standard CPPFLAGS. All rules are identical
except that different additional options to the $(CC) command are
required to build the object file. These additional options are
provided through various $(foo_cppflags) variables.
This commit avoids this duplication by adding the necessary flags to
CPPFLAGS instead. This way we can use the same rule for all object
files.
Andre Noll [Sun, 15 Sep 2013 00:35:36 +0000 (00:35 +0000)]
build: Define Make variables for cppflags.
As a first step towards separating autoconf output variables and Make
recipes, this commit defines Make variables for all cppflags at the
top of Makefile.in and avoids @variable@ constructs in Make rules.
As an additional benefit, this improves readability of the generated
Makefile.
Andre Noll [Sat, 14 Sep 2013 03:47:56 +0000 (03:47 +0000)]
build: Move relevant parts to fade section.
configure.ac already has a section for para_fade, but the construction
of $fade_errlist_objs was still spread out over the whole file. Move
everything to the existing section and remove @fade_ldflags@.
This also kills the $mixer_summary variable, which was not very useful.
Andre Noll [Sat, 14 Sep 2013 03:35:36 +0000 (03:35 +0000)]
build: Move relevant parts to audiod section.
All of this should be in the audiod section, so move it there. Due
to the cleanups of the previous patches the @audiod_ldflags@ output
variable contained only -lm. Get rid of it by adding -lm to LDFLAGS.
Andre Noll [Sat, 14 Sep 2013 03:05:10 +0000 (03:05 +0000)]
build: Move relevant parts to server section.
Currently $server_errlist_objs is updated whenever a feature that
affects para_server was detected. This mix of feature detection and
build options is hard to maintain and error-prone, so let's move the
definition of $server_errlist_objs to the already existing section
for para_server.
The patch also kills the unused @server_ldflags@ output variable.
Andre Noll [Sat, 14 Sep 2013 02:46:37 +0000 (02:46 +0000)]
build: Create section for para_write.
This moves all parts of configure.ac related to para_write to a
separate section at the bottom and kills @write_ldflags@.
The patch also fixes a minor issue for setups where libao is the only
"real" writer. Previously we used FILE_WRITE as the default writer
in this case. This commit changes it to AO_WRITE.
Andre Noll [Sat, 14 Sep 2013 02:35:14 +0000 (02:35 +0000)]
build: Create section for para_play.
This moves all parts related to para_play to a separate section
at the bottom of configure.ac and gets rid of the output variable
@play_ldflags@ in favor of a simple LDFLAGS setting.
Andre Noll [Sat, 14 Sep 2013 02:08:51 +0000 (02:08 +0000)]
build: Create section for para_recv.
Similar to the previous patch, this moves the creation of
$recv_cmdline_objs and $recv_errlist_objs to a separate section at
the end of configure.ac and gets rid of the now unused @recv_ldflags@
output variable.
Andre Noll [Sat, 14 Sep 2013 01:48:41 +0000 (01:48 +0000)]
build: Create section for para_filter.
Currently, the construction of $filters, $filter_errlist_objs and
$filter_cmdline_objs is spread out over configure.ac as each test
modifies these variables.
The code in configure.ac becomes easier to read if these variables
are set up in a separate section after all tests have been performed.
This patch also gets rid of filter_ldflags. Due to the previous
cleanups, it only contained -lm which is now added in Makefile.in,
along with all other linker flags for para_filter.
Andre Noll [Fri, 13 Sep 2013 06:49:50 +0000 (06:49 +0000)]
build: ldflags conversion: libsocket.
This converts the ldflags needed for the socket/connect system calls
in the usual way. It also drops the check for the connect() system
call, as it should always be either in -lc or -lsocket.
Andre Noll [Fri, 13 Sep 2013 05:47:41 +0000 (05:47 +0000)]
build: ldflags conversion: libfaad.
This adds the linker flags for libfaad to LDFLAGS in Makefile.in
for those targets that need it. This avoids some duplication in
configure.ac. No cppflags conversion in this patch.
Andre Noll [Fri, 13 Sep 2013 05:36:22 +0000 (05:36 +0000)]
build: cppflags/ldflags conversion: libspeex.
This fixes the --with-speex-headers option, which has never worked,
by adding the speex_cppflags output variable and including the given
flags in CPPFLAGS for the three objects that need it.
The straight-forward conversion for speex linker flags is also
performed in this patch.
Andre Noll [Fri, 13 Sep 2013 05:24:07 +0000 (05:24 +0000)]
build: ldflags conversion: libogg.
The next step on the way to the removing the per-executable ldflags
variables. This sets ogg_ldflags in configure.ac, creates an output
variable from it, and adds it to LDFLAGS in Makefile.in for all
executables that need it.
Andre Noll [Fri, 13 Sep 2013 05:12:58 +0000 (05:12 +0000)]
build: cppflags/ldflags conversion: libid3tag
This removes the rule for mp3_afh.o so that this object will instead
be created by means of the generic rule. To make this work, CPPFLAGS is
modified for this target to include suitable cpp options for libid3tag
as determined during configure.
Similarly, the linker flags for libid3tag are removed from
server_ldflags, afh_ldflags, play_ldflags, recv_ldflags and
play_ldflags, and appropriate linker flags are added to LDFLAGS for
all executables that need it.
Andre Noll [Fri, 13 Sep 2013 03:13:38 +0000 (03:13 +0000)]
build: Remove duplicates from $all_objs.
In Makefile.in $all_objs is defined as the concatenation of the
object lists of all executables. This variable is used to determine
the set of dependency files to include. Since the concatenation
contains common objects more than once, we currently include common
dependencies multiple times.
This is not a problem, but it may slow down the build. The make sort
function removes duplicate words, so by sorting $all_objs we make
sure to include each dependency file only once.
Andre Noll [Fri, 13 Sep 2013 01:41:15 +0000 (01:41 +0000)]
build: Replace error2.pl by error2.c.
The C code is much faster than the old perl script. Since the resulting
executable runs on the build system, the compiler for this system
must be called to compile error2.c. The new HOSTCC variable takes
care of this.
With this patch applied, the only remaining dependencies on perl are
help2man and autoconf.
Andre Noll [Sun, 8 Sep 2013 01:11:16 +0000 (01:11 +0000)]
build: Separate curses detection from gui configuration.
It's cleaner to separate feature/library detection from the logic
that decides whether an executable can be built.
This patch creates a separate section for para_gui which contains
the list of all objects for para_gui and sets $build_gui to either
"yes" or "no", depending on whether a usable curses library was found.
Andre Noll [Fri, 6 Sep 2013 01:39:20 +0000 (01:39 +0000)]
build: Move down fade section.
The logic which checks whether an executable can be build on the
given system should come after the tests for features and libraries.
The section for the para_fade executable violates this rule, so move
it down to where it belongs.
Andre Noll [Sun, 8 Sep 2013 01:10:56 +0000 (01:10 +0000)]
build: Add object "cmdline" suffix only once.
This is equivalent, but it is both simpler and less error-prone than
calling add_cmdline() for each check. Change all affected assignments
to the one-line-per-object format while we're at it.
Andre Noll [Fri, 30 Aug 2013 05:02:06 +0000 (05:02 +0000)]
build: Fix make install for cross builds.
make install discards symbols from executables by using the -s option
to the install command. If no install command was detected at configure
time, the install-sh script shipped in the paraslash source tree is
used instead.
This is currently broken for cross-builds because install -s runs the
native strip command by default but the cross-strip is required here.
Both the install script and the install command from gnu coreutils
support custom strip commands, but the syntax for specifying these are
different. A decent install program is available at least on FreeBSD,
NetBSD, MacOS and Linux, so let's just kill the script and use the
--strip-command option of the install program to allow the user to
specify a suitable cross-strip.
Andre Noll [Fri, 30 Aug 2013 00:10:41 +0000 (00:10 +0000)]
build: Generate man pages directly from ggo files.
Currently all man pages are created by help2man which executes the
para_xxx binaries just compiled with the --detailed-help and --version
options given to obtain the input for the man page to create.
The obvious shortcoming of this approach is that it simply does not
work when cross-compiling. There is another disadvantage though: Since
the man page file (para_xxx.1) depends on the executable (para_xxx),
any code change causes all affected man pages to be recreated, even
if nothing has changed that would alter the man page content.
The good news is that gengetopt can create the help output without
generating or compiling any code. The bad news is that help2man
insists on executing a program with --help and --version to get the
output.
This commit teaches Makefile to create a dummy shell script for each
executable which accepts the above options and runs gengetopt on the
.ggo file to obtain the help text.
This makes cross-compiling possible and shortens rebuild times since
with the patch applied, the man page is only recreated when the ggo
file changes.
Andre Noll [Sat, 31 Aug 2013 04:19:53 +0000 (04:19 +0000)]
build: Remove fnmatch, malloc, realloc tests.
These cause more harm than good. When cross-compiling for the arm-based
rpi, weird rpc_malloc link failures showed up. Removing the tests
solves the problem.
Andre Noll [Thu, 29 Aug 2013 22:57:11 +0000 (22:57 +0000)]
build: Make crypto optional.
Now that all three executables that need a crypto library have been
made optional, it is no longer a fatal error if no library was found.
This patch makes the build succeed in this case, albeit para_server,
para_audiod and para_client will not be built.
Andre Noll [Thu, 29 Aug 2013 21:42:43 +0000 (21:42 +0000)]
build: Make audiod optional.
The previous two commits made para_server and para_client depend
on crypto support. This patch does the same thing for para_audiod.
It adds a section that sets $build_audiod to yes or no, depending
on whether a crypto library was detected. This clears the path to
making crypto support optional.
Andre Noll [Thu, 29 Aug 2013 21:09:45 +0000 (21:09 +0000)]
build: Build para_client only if crypto lib was found.
This creates a separate section for para_client, similar to the one
for para_server that was added in the previous patch.
The new section sets $build_client to either yes or no, depending on
whether a crypto library (openssl nor gcrypt) was found by the tests
performed earlier. This test is always true at the moment since we
abort anyway if neither library was detected. But this is about to
change, so..