summaryrefslogtreecommitdiffhomepage
path: root/patches/tdnf-2.0.0-alpha.1_pre.local.patch
blob: bfacd87b3fff8cb4af59bcdd44caeb9b2c6ba150 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From f2fe2c648454bc5885366c93d4075ca5777ddbda Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sun, 29 Apr 2018 15:52:26 -0400
Subject: [PATCH] Fix TDNF build configuration to use pkgconfig data to find
 dependencies

With the notable exception of identifying that we're using rpm.org rpm,
all the configuration of how to use dependencies to compile and link
TDNF and its libraries should come from pkgconfig. That way, TDNF
will reliably build across more platforms.

In addition, trivial changes to drop -Werror and specify that -std=gnu99
is required for the build are included so that it will compile properly
on compilers that do not default to newer C standards and not make
assumptions about what is coerced from a warning to an error by default.
---
 client/Makefile.am  |  5 ++---
 configure.ac        | 25 +++++++++++++------------
 solv/Makefile.am    |  4 ++--
 tdnf-cli-libs.pc.in |  2 +-
 tdnf.pc.in          |  2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/client/Makefile.am b/client/Makefile.am
index 9bd3deb..6857c3f 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -26,6 +26,5 @@ libtdnf_la_LIBADD =  \
     @top_builddir@/solv/libtdnfsolv.la \
     $(top_builddir)/common/libcommon.la \
     @LIBCURL_LIBS@ \
-    -lrpm  \
-    -lsolv \
-    -lsolvext
+    @RPM_LIBS@ \
+    @LIBSOLVEXT_LIBS@
diff --git a/configure.ac b/configure.ac
index d78bb8c..d5c4a51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_INIT(tdnf, 2.0.0)
 AC_MSG_NOTICE([tdnf configuration])
 
 AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AM_INIT_AUTOMAKE([-Wall foreign])
 
 AC_CONFIG_TESTDIR(tests)
 
@@ -15,29 +15,30 @@ AC_PROG_LIBTOOL
 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE -fPIC"
 
 AM_CPPFLAGS="$AM_CPPFLAGS -I${top_srcdir}/include"
-AM_CFLAGS="$AM_CFLAGS -Wall -Werror -fno-strict-aliasing"
+AM_CFLAGS="$AM_CFLAGS -std=gnu99 -Wall -fno-strict-aliasing"
 
 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_GNU_SOURCE -fPIC"
 AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(AM_CFLAGS)
 
 #libsolv
-echo "Looking for libsolv headers"
-AC_CHECK_HEADERS(solv/pool.h)
+PKG_CHECK_MODULES([LIBSOLV], [libsolv], [have_libsolv=yes], [have_libsolv=no])
+PKG_CHECK_MODULES([LIBSOLVEXT], [libsolvext], [have_libsolvext=yes], [have_libsolvext=no])
+AM_CONDITIONAL([LIBSOLV],  [test "$have_libsolv" = "yes"])
+AM_CONDITIONAL([LIBSOLVEXT],  [test "$have_libsolvext" = "yes"])
 
-echo "Looking for libsolv libs"
-AC_CHECK_LIB(solv, pool_create)
-
-#licurl
+#libcurl
 PKG_CHECK_MODULES([LIBCURL], [libcurl], [have_libcurl=yes], [have_libcurl=no])
 AM_CONDITIONAL([LIBCURL],  [test "$have_libcurl" = "yes"])
 
 #rpm
-echo "Looking for librpm headers"
-AC_CHECK_HEADERS(rpm/rpmlib.h)
+PKG_CHECK_MODULES([RPM], [rpm], [have_rpm=yes], [have_rpm=no])
+AM_CONDITIONAL([RPM], [test "$have_rpm" = "yes"])
+
+# test to prove rpm.org rpm
+echo "Looking for rpm.org librpm headers"
+AC_CHECK_HEADERS(rpm/header.h)
 
-echo "Looking for librpm libs"
-AC_CHECK_LIB(rpm, rpmtsCreate)
 
 #makefiles
 AC_CONFIG_FILES([Makefile
diff --git a/solv/Makefile.am b/solv/Makefile.am
index 6625b3b..ef546a9 100644
--- a/solv/Makefile.am
+++ b/solv/Makefile.am
@@ -10,5 +10,5 @@ libtdnfsolv_la_SOURCES = \
     
 libtdnfsolv_la_LDFLAGS =  \
     -static \
-    -lrpm  \
-    -lsolv
+    @RPM_LIBS@ \
+    @LIBSOLV_LIBS@
diff --git a/tdnf-cli-libs.pc.in b/tdnf-cli-libs.pc.in
index 0912b68..4523e4d 100644
--- a/tdnf-cli-libs.pc.in
+++ b/tdnf-cli-libs.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@/tdnf
 Name: tdnf-cli-libs
 Description: tdnf cli libs
 Version: @VERSION@
-Requires:
+Requires: tdnf
 Libs: -L${libdir} -ltdnfcli
 Cflags: -I${includedir}
diff --git a/tdnf.pc.in b/tdnf.pc.in
index 811568d..4ad7a07 100644
--- a/tdnf.pc.in
+++ b/tdnf.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@/tdnf
 Name: tdnf
 Description: tiny dandified yum
 Version: @VERSION@
-Requires:libsolv rpm
+Requires: libsolv libsolvext rpm libcurl
 Libs: -L${libdir} -ltdnf
 Cflags: -I${includedir}
-- 
2.17.0