From c5d951846d6b803909cbd7cfeac643f5feb42911 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:26:35 -0400 Subject: buildsys: use pkg-config for openssl detection Signed-off-by: Dave Reisner --- lib/libalpm/Makefile.am | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 61dcb877..8d1be908 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -64,6 +64,13 @@ libalpm_la_SOURCES += \ endif libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ -libalpm_la_LIBADD = $(LTLIBINTL) + +libalpm_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(LIBSSL_CFLAGS) + +libalpm_la_LIBADD = \ + $(LTLIBINTL) \ + $(LIBSSL_LIBS) # vim:set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b From 059c572ca5c0f3ac9d90c53f0c0bdc8e4fb0336f Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:30:08 -0400 Subject: buildsys: use pkg-config for libarchive detection This also introduces a versioned dependency of >=2.8.0. Signed-off-by: Dave Reisner --- lib/libalpm/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 8d1be908..3773f2df 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -67,10 +67,12 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ + $(LIBARCHIVE_CFLAGS) \ $(LIBSSL_CFLAGS) libalpm_la_LIBADD = \ $(LTLIBINTL) \ + $(LIBARCHIVE_LIBS) \ $(LIBSSL_LIBS) # vim:set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b From b2226ed11bca158ab32199b5899802a78a42f5aa Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:37:06 -0400 Subject: buildsys: use pkg-config for libcurl detection Signed-off-by: Dave Reisner --- lib/libalpm/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 3773f2df..c34079c7 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -63,16 +63,18 @@ libalpm_la_SOURCES += \ base64.h base64.c endif -libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ +libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ $(LIBARCHIVE_CFLAGS) \ + $(LIBCURL_CFLAGS) \ $(LIBSSL_CFLAGS) libalpm_la_LIBADD = \ $(LTLIBINTL) \ $(LIBARCHIVE_LIBS) \ + $(LIBCURL_LIBS) \ $(LIBSSL_LIBS) # vim:set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b From cb5b66367ddf4af05953a9486bddaaf105fb4f38 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 23:08:31 -0400 Subject: buildsys: cleanup gpgme compile time check - handle gpgme libs and cflags separately rather than appending to CFLAGS and LDFLAGS - be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is irrelephant since we don't actually run) - be consistent with usage of "have" and "with" variables (this actually ends up reducing SLOC) - when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS - when requested support fails the version check, complain about the min version. Signed-off-by: Dave Reisner --- lib/libalpm/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index c34079c7..31de62e3 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -67,12 +67,14 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ + $(GPGME_CFLAGS) \ $(LIBARCHIVE_CFLAGS) \ $(LIBCURL_CFLAGS) \ $(LIBSSL_CFLAGS) libalpm_la_LIBADD = \ $(LTLIBINTL) \ + $(GPGME_LIBS) \ $(LIBARCHIVE_LIBS) \ $(LIBCURL_LIBS) \ $(LIBSSL_LIBS) -- cgit v1.2.3-24-g4f1b From 793eff37047dbceedaf3443311bc826566685181 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 23:26:32 -0400 Subject: buildsys: define warning CFLAGS in separate var Continue the trend of not touching the environment CFLAGS, ensuring that the user always has the final say. Signed-off-by: Dave Reisner --- lib/libalpm/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 31de62e3..0781d5d8 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -10,7 +10,7 @@ DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@ AM_CPPFLAGS = \ -imacros $(top_builddir)/config.h -AM_CFLAGS = -pedantic -D_GNU_SOURCE +AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS) if ENABLE_VISIBILITY_CC if DARWIN -- cgit v1.2.3-24-g4f1b From a8a1b093eb23450244418232c9e30c4be035fc0b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 7 Apr 2012 13:01:13 -0500 Subject: Various tweaks to support building with excessive GCC warning flags This fixes a bunch of small issues in order to enable a clean successful build with a crazy number of GCC warning flags. A lot of these changes are covered by -Wshadow, -Wformat-security, and -Wstrict-overflow=5. Signed-off-by: Dan McGee --- lib/libalpm/deps.c | 10 ++++++---- lib/libalpm/trans.c | 7 +++++-- lib/libalpm/util.c | 17 ++++++++++------- lib/libalpm/util.h | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 6069f5e6..98519bd0 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -158,15 +158,17 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, else if(nextchild->state == -1) { alpm_pkg_t *vertexpkg = vertex->data; alpm_pkg_t *childpkg = nextchild->data; - const char *message; _alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n")); if(reverse) { - message =_("%s will be removed after its %s dependency\n"); + _alpm_log(handle, ALPM_LOG_WARNING, + _("%s will be removed after its %s dependency\n"), + vertexpkg->name, childpkg->name); } else { - message =_("%s will be installed before its %s dependency\n"); + _alpm_log(handle, ALPM_LOG_WARNING, + _("%s will be installed before its %s dependency\n"), + vertexpkg->name, childpkg->name); } - _alpm_log(handle, ALPM_LOG_WARNING, message, vertexpkg->name, childpkg->name); } } if(!found) { diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 4309c07e..08f70dd7 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -276,8 +276,8 @@ static int grep(const char *fn, const char *needle) int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath, const char *script, const char *ver, const char *oldver, int is_archive) { - char cmdline[PATH_MAX]; - char *argv[] = { SCRIPTLET_SHELL, "-c", cmdline, NULL }; + char arg0[64], arg1[3], cmdline[PATH_MAX]; + char *argv[] = { arg0, arg1, cmdline, NULL }; char *tmpdir, *scriptfn = NULL, *scriptpath; int retval = 0; size_t len; @@ -293,6 +293,9 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath, return 0; } + strcpy(arg0, SCRIPTLET_SHELL); + strcpy(arg1, "-c"); + /* create a directory in $root/tmp/ for copying/extracting the scriptlet */ len = strlen(handle->root) + strlen("tmp/alpm_XXXXXX") + 1; MALLOC(tmpdir, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 22e9e359..a392c773 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -621,7 +621,9 @@ int _alpm_ldconfig(alpm_handle_t *handle) if(access(line, F_OK) == 0) { snprintf(line, PATH_MAX, "%ssbin/ldconfig", handle->root); if(access(line, X_OK) == 0) { - char *argv[] = { "ldconfig", NULL }; + char arg0[32]; + char *argv[] = { arg0, NULL }; + strcpy(arg0, "ldconfig"); return _alpm_run_chroot(handle, "/sbin/ldconfig", argv); } } @@ -676,7 +678,8 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle) { struct stat buf; alpm_list_t *i; - char *cachedir, *tmpdir; + char *cachedir; + const char *tmpdir; /* Loop through the cache dirs until we find a usable directory */ for(i = handle->cachedirs; i; i = i->next) { @@ -995,13 +998,13 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b) } if(needed > b->line_size) { /* need to realloc + copy data to fit total length */ - char *new; - CALLOC(new, needed, sizeof(char), b->ret = -ENOMEM; goto cleanup); - memcpy(new, b->line, b->line_size); + char *new_line; + CALLOC(new_line, needed, sizeof(char), b->ret = -ENOMEM; goto cleanup); + memcpy(new_line, b->line, b->line_size); b->line_size = needed; - b->line_offset = new + (b->line_offset - b->line); + b->line_offset = new_line + (b->line_offset - b->line); free(b->line); - b->line = new; + b->line = new_line; } } diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index e6747827..e35e35b9 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -87,7 +87,7 @@ #endif #define OPEN(fd, path, flags) do { fd = open(path, flags | O_BINARY); } while(fd == -1 && errno == EINTR) -#define CLOSE(fd) do { int ret; do { ret = close(fd); } while(ret == -1 && errno == EINTR); } while(0) +#define CLOSE(fd) do { int _ret; do { _ret = close(fd); } while(_ret == -1 && errno == EINTR); } while(0) /** * Used as a buffer/state holder for _alpm_archive_fgets(). -- cgit v1.2.3-24-g4f1b