File: ldflags.patch

package info (click to toggle)
cadical 2.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,204 kB
  • sloc: cpp: 36,901; ansic: 4,521; sh: 1,770; makefile: 91
file content (151 lines) | stat: -rw-r--r-- 5,032 bytes parent folder | download
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
Description: Add support for setting CPPFLAGS and LDFLAGS (for hardening)
Author: Scott Talbert <swt@techie.net>
Forwarded: https://github.com/arminbiere/cadical/pull/88

--- a/configure
+++ b/configure
@@ -274,6 +274,8 @@ fi
 
 [ x"$CXX" = x ] && CXX=g++
 [ x"$CXXFLAGS" = x ] || CXXFLAGS="$CXXFLAGS "
+[ x"$CPPFLAGS" = x ] || CPPFLAGS="$CPPFLAGS "
+[ x"$LDFLAGS" = x ] || LDFLAGS="$LDFLAGS "
 
 case x"$CXX" in
   x*g++*|x*clang++*) CXXFLAGS="${CXXFLAGS}-Wall -Wextra";;
@@ -548,6 +550,8 @@ sed \
 # This 'makefile' is generated from '../makefile.in'." \
 -e "s,@CXX@,$CXX," \
 -e "s#@CXXFLAGS@#$CXXFLAGS#" \
+-e "s#@CPPFLAGS@#$CPPFLAGS#" \
+-e "s#@LDFLAGS@#$LDFLAGS#" \
 -e "s#@LIBS@#$libs#" \
 -e "s#@CONTRIB@#$contrib#" \
 -e "s#@IPASIR@#$ipasir#" \
--- a/makefile.in
+++ b/makefile.in
@@ -9,6 +9,8 @@
 
 CXX=@CXX@
 CXXFLAGS=@CXXFLAGS@
+CPPFLAGS=@CPPFLAGS@
+LDFLAGS=@LDFLAGS@
 
 LIBS=@LIBS@
 CONTRIB=@CONTRIB@
@@ -34,7 +36,7 @@ OBJ_CONTRIB=$(FILT_CONTRIB:.cpp=.o)
 # generated build header 'build.hpp'.
 
 DIR=../$(shell pwd|sed -e 's,.*/,,')
-COMPILE=$(CXX) $(CXXFLAGS) -I$(DIR) -I../src
+COMPILE=$(CXX) $(CXXFLAGS) $(CPPFLAGS) -I$(DIR) -I../src
 
 #--------------------------------------------------------------------------#
 
@@ -53,10 +55,10 @@ all: libcadical.a cadical mobical
 # tester 'mobical') and the library are the main build targets.
 
 cadical: cadical.o libcadical.a makefile
-	$(COMPILE) -o $@ $< -L. -lcadical $(LIBS)
+	$(COMPILE) -o $@ $< $(LDFLAGS) -L. -lcadical $(LIBS)
 
 mobical: mobical.o libcadical.a makefile $(LIBS)
-	$(COMPILE) -o $@ $< -L. -lcadical
+	$(COMPILE) -o $@ $< $(LDFLAGS) -L. -lcadical
 
 libcadical.a: $(OBJ_SOLVER) $(OBJ_CONTRIB) makefile
 	ar rc $@ $(OBJ_SOLVER) $(OBJ_CONTRIB)
--- a/test/api/run.sh
+++ b/test/api/run.sh
@@ -47,9 +47,13 @@ makefile=$CADICALBUILD/makefile
 
 CXX=`grep '^CXX=' "$makefile"|sed -e 's,CXX=,,'`
 CXXFLAGS=`grep '^CXXFLAGS=' "$makefile"|sed -e 's,CXXFLAGS=,,'`
+CPPFLAGS=`grep '^CPPFLAGS=' "$makefile"|sed -e 's,CPPFLAGS=,,'`
+LDFLAGS=`grep '^LDFLAGS=' "$makefile"|sed -e 's,LDFLAGS=,,'`
 
 msg "using CXX=$CXX"
 msg "using CXXFLAGS=$CXXFLAGS"
+msg "using CPPFLAGS=$CPPFLAGS"
+msg "using LDFLAGS=$LDFLAGS"
 
 tests=../test/api
 
@@ -73,12 +77,12 @@ run () {
   then
     src=$tests/$1.c
     language=" -x c"
-    COMPILE="$CXX `echo $CXXFLAGS|sed -e 's,-std=c++11,-std=c11,'`"
+    COMPILE="$CXX `echo $CXXFLAGS|sed -e 's,-std=c++11,-std=c11,'` $CPPFLAGS"
   elif [ -f $tests/$1.cpp ]
   then
     src=$tests/$1.cpp
     language=""
-    COMPILE="$CXX $CXXFLAGS"
+    COMPILE="$CXX $CXXFLAGS $CPPFLAGS"
     [ x"$1" = xparcompwrite ] && COMPILE="$COMPILE -pthread"
   else
     die "can not find '$tests.c' nor '$tests.cpp'"
@@ -87,7 +91,7 @@ run () {
   rm -f $name.log $name.o $name
   status=0
   cmd $COMPILE$language -o $name.o -c $src
-  cmd $COMPILE -o $name $name.o -L$CADICALBUILD -lcadical
+  cmd $COMPILE -o $name $name.o $LDFLAGS -L$CADICALBUILD -lcadical
   cmd $name
   if test $status = 0
   then
--- a/test/cnf/run.sh
+++ b/test/cnf/run.sh
@@ -25,6 +25,9 @@ die "needs to be called from a top-level
 
 [ x"$CADICALBUILD" = x ] && CADICALBUILD="../build"
 
+[ -f "$CADICALBUILD/makefile" ] || \
+  die "can not find '$CADICALBUILD/makefile' (run 'configure' first)"
+
 [ -x "$CADICALBUILD/cadical" ] || \
   die "can not find '$CADICALBUILD/cadical' (run 'make' first)"
 
@@ -47,12 +50,22 @@ lratchecker=$CADICALBUILD/lrat-trim
 solutionchecker=$CADICALBUILD/precochk
 makefile=$CADICALBUILD/makefile
 
+CXX=`grep '^CXX=' "$makefile"|sed -e 's,CXX=,,'`
+CXXFLAGS=`grep '^CXXFLAGS=' "$makefile"|sed -e 's,CXXFLAGS=,,'`
+CPPFLAGS=`grep '^CPPFLAGS=' "$makefile"|sed -e 's,CPPFLAGS=,,'`
+LDFLAGS=`grep '^LDFLAGS=' "$makefile"|sed -e 's,LDFLAGS=,,'`
+
+msg "using CXX=$CXX"
+msg "using CXXFLAGS=$CXXFLAGS"
+msg "using CPPFLAGS=$CPPFLAGS"
+msg "using LDFLAGS=$LDFLAGS"
+
 if [ ! -f $solutionchecker -o ! -f $dratchecker -o ! -f $lratchecker ]
 then
 
   if [ ! -f $solutionchecker -o ../test/cnf/precochk.c -nt $solutionchecker ]
   then
-    cmd="cc -O -o $solutionchecker ../test/cnf/precochk.c -lz"
+    cmd="cc -O `echo $CXXFLAGS|sed -e 's,-std=c++11,-std=c11,'` $CPPFLAGS -o $solutionchecker ../test/cnf/precochk.c -lz $LDFLAGS"
     cecho "$cmd"
     if $cmd 2>/dev/null
     then
@@ -66,7 +79,7 @@ then
 
   if [ ! -f $dratchecker -o ../test/cnf/drat-trim.c -nt $dratchecker ]
   then
-    cmd="cc -O -o $dratchecker ../test/cnf/drat-trim.c"
+    cmd="cc -O `echo $CXXFLAGS|sed -e 's,-std=c++11,-std=c11,'` $CPPFLAGS -o $dratchecker ../test/cnf/drat-trim.c $LDFLAGS"
     if $cmd 2>/dev/null
     then
       msg "external proof checking with '$dratchecker'"
@@ -79,7 +92,7 @@ then
 
   if [ ! -f $lratchecker -o ../test/cnf/lrat-trim.c -nt $lratchecker ]
   then
-    cmd="cc -O -o $lratchecker ../test/cnf/lrat-trim.c"
+    cmd="cc -O `echo $CXXFLAGS|sed -e 's,-std=c++11,-std=c11,'` $CPPFLAGS -o $lratchecker ../test/cnf/lrat-trim.c $LDFLAGS"
     if $cmd 2>/dev/null
     then
       msg "external proof checking with '$lratchecker'"