Convert build system to autotools
Subsystems (2)
v3 cover Convert build system to autotools
This series converts the build system to use autotools and splits the files into lib and utils.
Also patch 5 fixes error handling code.
I can't test Android builds but both cross and native compiling worked for me.
I left AUTHORS, ChangeLog and NEWS files empty. I used the license header to fill COPYING.
Changes in v3:
- fix a typo in PATCH 1 where we compile cplay.c instead of crec.c for crecord app.
- Add mising SOB lines.
Qais Yousef (7):
Convert the build system to autotools
add .gitignore file
makefile.linux: delete as no longer necessary/used Android.mk: Update to use the new location of source files compress.c: fix check for errors from poll(), read() and write() src/lib/utils.c: remove this empty file tinycompress.h: explicitly include required headers
.gitignore | 39 ++++ AUTHORS | 0 Android.mk | 6 +- COPYING | 51 +++++ ChangeLog | 0 INSTALL | 365 ++++++++++++++++++++++++++++++++++++ Makefile.am | 3 + NEWS | 0 autogen.sh | 6 + configure.ac | 32 ++++ include/Makefile.am | 6 + include/tinycompress/tinycompress.h | 3 + m4/.place_holder | 0 makefile.linux | 41 ---- src/Makefile.am | 1 + src/lib/Makefile.am | 5 + compress.c => src/lib/compress.c | 22 ++- src/utils/Makefile.am | 11 ++ cplay.c => src/utils/cplay.c | 0 crec.c => src/utils/crec.c | 0 utils.c | 62 ------ 21 files changed, 537 insertions(+), 116 deletions(-) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 include/Makefile.am create mode 100644 m4/.place_holder delete mode 100644 makefile.linux create mode 100644 src/Makefile.am create mode 100644 src/lib/Makefile.am rename compress.c => src/lib/compress.c (98%) create mode 100644 src/utils/Makefile.am rename cplay.c => src/utils/cplay.c (100%) rename crec.c => src/utils/crec.c (100%) delete mode 100644 utils.c
Signature · 1 line
2.1.0
PATCH v3 1/7 Convert the build system to autotools
Hopefully this should make tinycompress a more robust package. This change splits the source into utils and lib.
No functional changes was introduced.
use autogen.sh to generate configure then run ./configure as with other packages.
---
changes in v3:
- fix a typo in src/utils/Makefile.am to compile the correct crec.c file
AUTHORS | 0 COPYING | 51 ++++++ ChangeLog | 0 INSTALL | 365 +++++++++++++++++++++++++++++++++++++++ Makefile.am | 3 + NEWS | 0 autogen.sh | 6 + configure.ac | 32 ++++ include/Makefile.am | 6 + m4/.place_holder | 0 src/Makefile.am | 1 + src/lib/Makefile.am | 5 + compress.c => src/lib/compress.c | 0 utils.c => src/lib/utils.c | 0 src/utils/Makefile.am | 11 ++ cplay.c => src/utils/cplay.c | 0 crec.c => src/utils/crec.c | 0 17 files changed, 480 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 include/Makefile.am create mode 100644 m4/.place_holder create mode 100644 src/Makefile.am create mode 100644 src/lib/Makefile.am rename compress.c => src/lib/compress.c (100%) rename utils.c => src/lib/utils.c (100%) create mode 100644 src/utils/Makefile.am rename cplay.c => src/utils/cplay.c (100%) rename crec.c => src/utils/crec.c (100%)
AUTHORS new file +0 -0
COPYING new file +51 -0
51 lines not on this page · raw message
ChangeLog new file +0 -0
INSTALL new file +365 -0
365 lines not on this page · raw message
Makefile.am new file +3 -0
@@ -0,0 +1,3 @@ +SUBDIRS = include src + +ACLOCAL_AMFLAGS = -I m4
NEWS new file +0 -0
autogen.sh new file +6 -0
@@ -0,0 +1,6 @@ +#!/bin/sh + +autoreconf --verbose --force --install || { + echo 'autogen.sh failed'; + exit 1; +}
configure.ac new file +32 -0
@@ -0,0 +1,32 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.63]) +AC_INIT([tinycompress], [0.2.0]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE(1.10) +LT_INIT(disable-static) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AM_PROG_CC_C_O + +# Checks for libraries. + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([ +Makefile +include/Makefile +src/Makefile +src/lib/Makefile +src/utils/Makefile]) +AC_OUTPUT
include/Makefile.am new file +6 -0
@@ -0,0 +1,6 @@ +nobase_include_HEADERS = tinycompress/tinycompress.h + +noinst_HEADERS = sound/compress_offload.h \ + sound/compress_params.h \ + tinycompress/version.h \ + tinycompress/tinymp3.h
m4/.place_holder new file +0 -0
src/Makefile.am new file +1 -0
@@ -0,0 +1 @@ +SUBDIRS = lib utils
src/lib/Makefile.am new file +5 -0
@@ -0,0 +1,5 @@ +tinycompressdir = $(libdir) + +tinycompress_LTLIBRARIES = libtinycompress.la +libtinycompress_la_SOURCES = compress.c utils.c +libtinycompress_la_CFLAGS = -I $(top_builddir)/include
src/lib/compress.c renamed from compress.c +0 -0
src/lib/utils.c renamed from utils.c +0 -0
src/utils/Makefile.am new file +11 -0
@@ -0,0 +1,11 @@ +bin_PROGRAMS = cplay crecord + +cplay_SOURCES = cplay.c +crecord_SOURCES = crec.c + +cplay_CFLAGS = -I$(top_builddir)/include +crecord_CFLAGS = -I$(top_builddir)/include + + +cplay_LDADD = $(top_builddir)/src/lib/libtinycompress.la +crecord_LDADD = $(top_builddir)/src/lib/libtinycompress.la
src/utils/cplay.c renamed from cplay.c +0 -0
src/utils/crec.c renamed from crec.c +0 -0
Signature · 1 line
2.1.0
PATCH v3 2/7 add .gitignore file
In reply to Qais Yousef--- .gitignore | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitignore
.gitignore new file +39 -0
@@ -0,0 +1,39 @@ +.* +*.o +*.so +*.la +*.lo +*~ +configure +config.log +config.cache +config.status +config.guess +config.sub +config.h +config.h.in +Makefile +Makefile.in +libtool +depcomp +ltmain.sh +aclocal.m4 +autom4te.cache +compile +install-sh +missing +stamp-h1 +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 + +# binary ignores +cplay +crecord + +# other ignores +*.patch +cscope.* +tags
Signature · 1 line
2.1.0
PATCH v3 3/7 makefile.linux: delete as no longer necessary/used
In reply to Qais YousefNow autotools takes care of generating Makefiles.
--- makefile.linux | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 makefile.linux
makefile.linux deleted +0 -41
@@ -1,41 +0,0 @@ -LIB = libtinycompress -VER = 0.1 -LIBSRC = compress.c -PLAYBIN = cplay -RECBIN = crec -PLAYSRC = cplay.c utils.c -RECSRC = crec.c utils.c -LIBOBJ = ${LIBSRC:.c=.o} -PLAYOBJ = ${PLAYSRC:.c=.o} -RECOBJ = ${RECSRC:.c=.o} - -CROSS_COMPILE ?= -CC ?= ${CROSS_COMPILE}gcc - -CFLAGS += -std=c99 -Wall -Wextra -Wunused -DVERSION=\"${VER}\" -I./include -LDFLAGS += -L. -ltinycompress -LIBLDFLAGS = -lasound - -all: libtinycompress cplay crec - -$(LIB): ${LIBOBJ} - @echo " LD "$@ - @${CC} ${CFLAGS} -shared -Wl,-soname,[email protected] -o [email protected] ${LIBOBJ} ${LIBLDFLAGS} - -$(PLAYBIN): ${PLAYOBJ} ${LIB} - @echo " LD "$@ - @${CC} ${CFLAGS} -o $@ ${PLAYOBJ} ${LDFLAGS} - -$(RECBIN): ${RECOBJ} ${LIB} - @echo " LD "$@ - @${CC} ${CFLAGS} -o $@ ${RECOBJ} ${LDFLAGS} - -%.o: %.c - @echo " CC "$< - @${CC} ${CFLAGS} -c -fPIC -o $@ $< - -clean: - @rm -rf ${BIN} ${PLAYOBJ} ${RECOBJ} ${LIB}.so ${LIBOBJ} - - -.PHONY: all clean
Signature · 1 line
2.1.0
PATCH v3 4/7 Android.mk: Update to use the new location of source files
In reply to Qais Yousef--- Android.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Android.mk +3 -3
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include -LOCAL_SRC_FILES:= compress.c utils.c +LOCAL_SRC_FILES:= src/lib/compress.c src/lib/utils.c LOCAL_MODULE := libtinycompress LOCAL_SHARED_LIBRARIES:= libcutils libutils LOCAL_MODULE_TAGS := optional
@@ -13,7 +13,7 @@ include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include -LOCAL_SRC_FILES:= cplay.c +LOCAL_SRC_FILES:= src/utils/cplay.c LOCAL_MODULE := cplay LOCAL_SHARED_LIBRARIES:= libcutils libutils libtinycompress LOCAL_MODULE_TAGS := optional
@@ -23,7 +23,7 @@ include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include -LOCAL_SRC_FILES:= crec.c +LOCAL_SRC_FILES:= src/utils/crec.c LOCAL_MODULE := crec LOCAL_SHARED_LIBRARIES:= libcutils libutils libtinycompress LOCAL_MODULE_TAGS := optional
Signature · 1 line
2.1.0
PATCH v3 5/7 compress.c: fix check for errors from poll(), read() and write()
In reply to Qais YousefWhen these functions fail they return -1 and set errno. Fix error checks accordingly.
--- src/lib/compress.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
src/lib/compress.c +12 -10
@@ -383,7 +383,7 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size }/* A pause will cause -EBADFD or zero. * This is not an error, just stop writing */ -if ((ret ==0 ) || (ret == -EBADFD )) +if ((ret ==0 ) || (ret <0 && errno ==EBADFD ))break ;if (ret <0 )return oops (compress, errno,"poll error" );
@@ -397,11 +397,12 @@ int compress_write(struct compress *compress, const void *buf, unsigned int sizeelse to_write = size; written =write (compress->fd, cbuf, to_write); -/* If play was paused the write returns -EBADFD */ -if (written == -EBADFD ) -break ; -if (written <0 ) +if (written <0 ) { +/* If play was paused the write returns -EBADFD */ +if (errno ==EBADFD ) +break ;return oops (compress, errno,"write failed!" ); + } size -= written; cbuf += written;
@@ -443,7 +444,7 @@ int compress_read(struct compress *compress, void *buf, unsigned int size) }/* A pause will cause -EBADFD or zero. * This is not an error, just stop reading */ -if ((ret ==0 ) || (ret == -EBADFD )) +if ((ret ==0 ) || (ret <0 && errno ==EBADFD ))break ;if (ret <0 )return oops (compress, errno,"poll error" );
@@ -457,11 +458,12 @@ int compress_read(struct compress *compress, void *buf, unsigned int size)else to_read = size; num_read =read (compress->fd, cbuf, to_read); -/* If play was paused the read returns -EBADFD */ -if (num_read == -EBADFD ) -break ; -if (num_read <0 ) +if (num_read <0 ) { +/* If play was paused the read returns -EBADFD */ +if (errno ==EBADFD ) +break ;return oops (compress, errno,"read failed!" ); + } size -= num_read; cbuf += num_read;
Signature · 1 line
2.1.0
PATCH v3 6/7 src/lib/utils.c: remove this empty file
In reply to Qais Yousefutils.c isn't implementing anything so delete it
--- Android.mk | 2 +- src/lib/Makefile.am | 2 +- src/lib/utils.c | 62 ----------------------------------------------------- 3 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 src/lib/utils.c
Android.mk +1 -1
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_C_INCLUDES:= $(LOCAL_PATH)/include -LOCAL_SRC_FILES:= src/lib/compress.c src/lib/utils.c +LOCAL_SRC_FILES:= src/lib/compress.c LOCAL_MODULE := libtinycompress LOCAL_SHARED_LIBRARIES:= libcutils libutils LOCAL_MODULE_TAGS := optional
src/lib/Makefile.am +1 -1
@@ -1,5 +1,5 @@ tinycompressdir = $(libdir) tinycompress_LTLIBRARIES = libtinycompress.la -libtinycompress_la_SOURCES = compress.c utils.c +libtinycompress_la_SOURCES = compress.c libtinycompress_la_CFLAGS = -I $(top_builddir)/include
src/lib/utils.c deleted +0 -62
62 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v3 7/7 tinycompress.h: explicitly include required headers
In reply to Qais Youseftinycompress.h was relying on other files to include linux/types.h and stdbool.h which are required by it. Explicitly include it to fix compile errors when external program tries to include this header.
--- include/tinycompress/tinycompress.h | 3 +++ 1 file changed, 3 insertions(+)
include/tinycompress/tinycompress.h +3 -0
@@ -53,6 +53,9 @@ #ifndef __TINYCOMPRESS_H #define __TINYCOMPRESS_H +#include <linux/types.h> +#include <stdbool.h> + #if defined(__cplusplus) extern "C" { #endif
Signature · 1 line
2.1.0
Quoted 8 lines · Qais Yousef
This series converts the build system to use autotools and splits the files into lib and utils.
Also patch 5 fixes error handling code.
I can't test Android builds but both cross and native compiling worked for me.
I left AUTHORS, ChangeLog and NEWS files empty. I used the license header to fill COPYING.
Okay I have filled the first two and nothing in NEWS :)
Applied this with below changes
This was autgenerated...
----><8----------------
commit 8d68c1aa7b99beb7774eb7a05349d3b00a635d1b
Author: Vinod Koul <[email protected]> Date: Fri May 8 15:48:06 2015 +0530
autotool: update the INSTALL file
toolchains are updating the INSTALL file so take the updated changes
INSTALL +9 -4
@@ -1,8 +1,8 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008, 2009 Free Software Foundation, Inc. +Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, +Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright
@@ -12,8 +12,8 @@ without warranty of any kind. Basic Installation ================== - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following + Briefly, the shell command `./configure && make && make install' +should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented
@@ -226,6 +226,11 @@ order to use an ANSI C compiler: and if that doesn't work, install pre-built binaries of GCC for HP-UX. + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `<wchar.h>' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended
@@ -304,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler
(unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
-an Autoconf bug. Until the bug is fixed you can use this workaround:
+an Autoconf limitation. Until the limitation is lifted, you can use +this workaround:
- CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@@ -362,4 +368,3 @@ operates.
configure' also accepts some other, not widely useful, options. Run configure --help' for more details.
--
Populated Changelog with:
--><8--------------
[vkoul@vkoul-udesk7 tinycompress (master)]$ git show HEAD~2 commit 4bc24fc5635f934584f59fc6f0fb12653a034ce9
Author: Vinod Koul <[email protected]> Date: Fri May 8 15:49:05 2015 +0530
Changelog: update to git log
we dont use changelog file as git is a very good log of what we are changing, so point to git log
ChangeLog +3 -0
@@ -0,0 +1,3 @@ +For changelog please see the git log of the project + +$ git log
--
Populated author info
----><8------------
commit 4d89264422ce8f06c4b8c5e9e96719743911c65e
Author: Vinod Koul <[email protected]> Date: Fri May 8 15:53:06 2015 +0530
Authors: add information about how to find authors
AUTHORS +4 -0
@@ -0,0 +1,4 @@ +To see author of various changes in this project, please run the below git +command + +$ git log --format='%aN'| sort -u
--
Then saw this warn when compiling so fixed it
-------><8-----
commit 50c2b03b3d7be9bdf6f7cfdbf730665e3b596086
Author: Vinod Koul <[email protected]> Date: Fri May 8 16:00:02 2015 +0530
cplay: check the values of fread
This fixes the following warning:
cplay.c: In function ‘play_samples’:
cplay.c:219:7: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(&header, sizeof(header), 1, file);
src/utils/cplay.c +0 -0
@@ -207,6 +207,7 @@ void play_samples(char *name, unsigned int card,
unsigned int device,
char *buffer;
int size, num_read, wrote;
unsigned int channels, rate, bits;+ size_t read;
if (verbose)
printf("%s: entry\n", __func__);
@@ -216,7 +217,12 @@ void play_samples(char *name, unsigned int card,
unsigned int device,
exit(EXIT_FAILURE);
}- fread(&header, sizeof(header), 1, file);
+ read = fread(&header, sizeof(header), 1, file);
+ if (read != sizeof(header)) {
+ fprintf(stderr, "Unable to read header \n");
+ fclose(file);
+ exit(EXIT_FAILURE);+ }
if (parse_mp3_header(&header, &channels, &rate, &bits) == -1) {
fclose(file);Signature · 6 lines
~Vinod _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel