[pacman-dev] [PATCH 2/4] Create a convenience library for reused functionality

Dave Reisner dreisner at archlinux.org
Thu Jul 5 14:42:42 UTC 2018


This is shared between pacman and pacman-conf (and might be used by
other binaries in the future) -- no need to compile it once for each
consumer.
---
 src/pacman/.gitignore  |  3 ++-
 src/pacman/Makefile.am | 37 +++++++++++++++++++------------------
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/pacman/.gitignore b/src/pacman/.gitignore
index 24e11ed3..9889c35e 100644
--- a/src/pacman/.gitignore
+++ b/src/pacman/.gitignore
@@ -1,6 +1,7 @@
 .deps
 .libs
+*.l[ao]
 pacman
 pacman.exe
 pacman-conf
-pacman-conf.exe
\ No newline at end of file
+pacman-conf.exe
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 2344daff..15cf20ce 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -8,6 +8,19 @@ hookdir   = ${sysconfdir}/pacman.d/hooks/
 cachedir  = ${localstatedir}/cache/pacman/pkg/
 logfile   = ${localstatedir}/log/pacman.log
 
+noinst_LTLIBRARIES = \
+	libbasic.la
+
+libbasic_la_SOURCES = \
+	conf.h conf.c \
+	ini.h ini.c \
+	callback.h callback.c \
+	util.h util.c \
+	util-common.h util-common.c
+
+libbasic_la_LIBADD = \
+	$(top_builddir)/lib/libalpm/.libs/libalpm.la
+
 bin_PROGRAMS = pacman pacman-conf
 
 AM_CPPFLAGS = \
@@ -31,37 +44,25 @@ endif
 
 pacman_SOURCES = \
 	check.h check.c \
-	conf.h conf.c \
 	database.c \
 	deptest.c \
 	files.c \
-	ini.h ini.c \
 	package.h package.c \
 	pacman.h pacman.c \
 	query.c \
 	remove.c \
 	sighandler.h sighandler.c \
 	sync.c \
-	callback.h callback.c \
-	upgrade.c \
-	util.h util.c \
-	util-common.h util-common.c
+	upgrade.c
 
 pacman_LDADD = \
 	$(LTLIBINTL) \
+	libbasic.la \
 	$(top_builddir)/lib/libalpm/.libs/libalpm.la \
 	$(LIBARCHIVE_LIBS)
 
-pacman_conf_SOURCES = pacman-conf.c \
-	util.h \
-	util.c \
-	ini.h \
-	ini.c \
-	util-common.h \
-	util-common.c \
-	callback.h \
-	callback.c \
-	conf.h \
-	conf.c
+pacman_conf_SOURCES = pacman-conf.c
 
-pacman_conf_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la
+pacman_conf_LDADD = \
+	libbasic.la \
+	$(top_builddir)/lib/libalpm/.libs/libalpm.la
-- 
2.18.0


More information about the pacman-dev mailing list