summaryrefslogtreecommitdiff
path: root/debian/patches/0004-use-system-wide-pcre.patch
blob: 54e8a806d0af564aad0de27288b9b93a310a5582 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
From: Antonin Kral <a.kral@bobek.cz>
Date: Thu, 15 Dec 2011 11:22:43 +0100
Subject: use system-wide pcre

---
 SConstruct |   98 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 53 insertions(+), 45 deletions(-)

diff --git a/SConstruct b/SConstruct
index 3bf6aca..15bd3f5 100644
--- a/SConstruct
+++ b/SConstruct
@@ -48,7 +48,11 @@ def getThirdPartyShortNames():
     for x in os.listdir( "third_party" ):
         if not x.endswith( ".py" ) or x.find( "#" ) >= 0:
             continue
-         
+
+        #use system-wide pcre
+        if x.find('pcre') >= 0:
+            continue
+
         lst.append( _rpartition( x, "." )[0] )
     return lst
 
@@ -64,7 +68,7 @@ def add_option( name, help , nargs , contibutesToVariantDir , dest=None ):
     if dest is None:
         dest = name
 
-    AddOption( "--" + name , 
+    AddOption( "--" + name ,
                dest=dest,
                type="string",
                nargs=nargs,
@@ -72,9 +76,9 @@ def add_option( name, help , nargs , contibutesToVariantDir , dest=None ):
                help=help )
 
     options[name] = { "help" : help ,
-                      "nargs" : nargs , 
+                      "nargs" : nargs ,
                       "contibutesToVariantDir" : contibutesToVariantDir ,
-                      "dest" : dest } 
+                      "dest" : dest }
 
 def get_option( name ):
     return GetOption( name )
@@ -99,16 +103,16 @@ def has_option( name ):
 
 
 def get_variant_dir():
-    
+
     a = []
-    
+
     for name in options:
         o = options[name]
         if not has_option( o["dest"] ):
             continue
         if not o["contibutesToVariantDir"]:
             continue
-        
+
         if o["nargs"] == 0:
             a.append( name )
         else:
@@ -119,9 +123,9 @@ def get_variant_dir():
     if len(a) > 0:
         a.sort()
         s += "/".join( a ) + "/"
-        
+
     return s
-        
+
 
 
 # installation/packaging
@@ -230,16 +234,16 @@ msarch = None
 if force64:
     msarch = "amd64"
 
-force32 = has_option( "force32" ) 
+force32 = has_option( "force32" )
 release = has_option( "release" )
 static = has_option( "static" )
 
-debugBuild = has_option( "debugBuild" ) or has_option( "debugBuildAndLogging" ) 
+debugBuild = has_option( "debugBuild" ) or has_option( "debugBuildAndLogging" )
 debugLogging = has_option( "debugBuildAndLogging" )
-noshell = has_option( "noshell" ) 
+noshell = has_option( "noshell" )
 
 usesm = has_option( "usesm" )
-usev8 = has_option( "usev8" ) 
+usev8 = has_option( "usev8" )
 
 asio = has_option( "asio" )
 
@@ -325,7 +329,7 @@ class InstallSetup:
 
     def __init__(self):
         self.default()
-    
+
     def default(self):
         self.binaries = True
         self.libraries = False
@@ -343,7 +347,7 @@ class InstallSetup:
         self.bannerDir = "distsrc/client/"
         self.headerRoot = ""
         self.clientTestsDir = "client/examples/"
-        
+
 installSetup = InstallSetup()
 env["installSetup"] = installSetup
 if distBuild:
@@ -359,19 +363,19 @@ if has_option( "full" ):
 commonFiles = Split( "pch.cpp buildinfo.cpp db/indexkey.cpp db/jsobj.cpp bson/oid.cpp db/json.cpp db/lasterror.cpp db/nonce.cpp db/queryutil.cpp db/querypattern.cpp db/projection.cpp shell/mongo.cpp" )
 commonFiles += [ "util/background.cpp" , "util/util.cpp" , "util/file_allocator.cpp" ,
                  "util/assert_util.cpp" , "util/log.cpp" , "util/ramlog.cpp" , "util/md5main.cpp" , "util/base64.cpp", "util/concurrency/vars.cpp", "util/concurrency/task.cpp", "util/debug_util.cpp",
-                 "util/concurrency/thread_pool.cpp", "util/password.cpp", "util/version.cpp", "util/signal_handlers.cpp",  
+                 "util/concurrency/thread_pool.cpp", "util/password.cpp", "util/version.cpp", "util/signal_handlers.cpp",
                  "util/histogram.cpp", "util/concurrency/spin_lock.cpp", "util/text.cpp" , "util/stringutils.cpp" ,
                  "util/concurrency/synchronization.cpp" ]
 commonFiles += [ "util/net/sock.cpp" , "util/net/httpclient.cpp" , "util/net/message.cpp" , "util/net/message_port.cpp" , "util/net/listen.cpp" ]
-commonFiles += Glob( "util/*.c" ) 
+commonFiles += Glob( "util/*.c" )
 commonFiles += Split( "client/connpool.cpp client/dbclient.cpp client/dbclient_rs.cpp client/dbclientcursor.cpp client/model.cpp client/syncclusterconnection.cpp client/distlock.cpp s/shardconnection.cpp" )
 
 #mmap stuff
 
 coreDbFiles = [ "db/commands.cpp" ]
-coreServerFiles = [ "util/net/message_server_port.cpp" , 
-                    "client/parallel.cpp" , "db/common.cpp", 
-                    "util/net/miniwebserver.cpp" , "db/dbwebserver.cpp" , 
+coreServerFiles = [ "util/net/message_server_port.cpp" ,
+                    "client/parallel.cpp" , "db/common.cpp",
+                    "util/net/miniwebserver.cpp" , "db/dbwebserver.cpp" ,
                     "db/matcher.cpp" , "db/dbcommands_generic.cpp" , "db/dbmessage.cpp",
                     "db/security_common.cpp", "db/security_commands.cpp",
                   ]
@@ -440,7 +444,7 @@ for x in os.listdir( "db/modules/" ):
     if os.path.exists( modBuildFile ):
         myModule = imp.load_module( "module_" + x , open( modBuildFile , "r" ) , modBuildFile , ( ".py" , "r" , imp.PY_SOURCE  ) )
         modules.append( myModule )
-        
+
     if myModule and "customIncludes" in dir(myModule) and myModule.customIncludes:
         pass
     else:
@@ -523,6 +527,10 @@ elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
     linux = True
     platform = "linux"
 
+    # use system-wide pcre
+    env.Append( CPPPATH=["/usr/include"] )
+    env.Append( LIBS=["pcrecpp", "pcre"] )
+
     if os.uname()[4] == "x86_64" and not force32:
         linux64 = True
         nixLibPrefix = "lib"
@@ -576,7 +584,7 @@ elif "win32" == os.sys.platform:
 	env['ENV'] = dict(os.environ)
 
     def find_boost():
-        for x in ('', ' (x86)'):	
+        for x in ('', ' (x86)'):
             boostDir = "C:/Program Files" + x + "/boost/latest"
             if os.path.exists( boostDir ):
                 return boostDir
@@ -617,12 +625,12 @@ elif "win32" == os.sys.platform:
 
     # some warnings we don't like:
     env.Append( CPPFLAGS=" /wd4355 /wd4800 /wd4267 /wd4244 " )
-    
+
     # PSAPI_VERSION relates to process api dll Psapi.dll.
     env.Append( CPPDEFINES=["_CONSOLE","_CRT_SECURE_NO_WARNINGS","PSAPI_VERSION=1" ] )
 
-    # this would be for pre-compiled headers, could play with it later  
-    #env.Append( CPPFLAGS=' /Yu"pch.h" ' ) 
+    # this would be for pre-compiled headers, could play with it later
+    #env.Append( CPPFLAGS=' /Yu"pch.h" ' )
 
     # docs say don't use /FD from command line (minimal rebuild)
     # /Gy function level linking
@@ -634,11 +642,11 @@ elif "win32" == os.sys.platform:
         # TODO: this has caused some linking problems :
         # /GL whole program optimization
         # /LTCG link time code generation
-        env.Append( CPPFLAGS= " /GL " ) 
+        env.Append( CPPFLAGS= " /GL " )
         env.Append( LINKFLAGS=" /LTCG " )
     else:
         # /Od disable optimization
-        # /ZI debug info w/edit & continue 
+        # /ZI debug info w/edit & continue
         # /TP it's a c++ file
         # RTC1 /GZ (Enable Stack Frame Run-Time Error Checking)
         env.Append( CPPFLAGS=" /RTC1 /MDd /Z7 /TP /errorReport:none " )
@@ -647,7 +655,7 @@ elif "win32" == os.sys.platform:
         if debugBuild:
             env.Append( LINKFLAGS=" /debug " )
             env.Append( CPPFLAGS=" /Od " )
-            
+
         if debugLogging:
             env.Append( CPPDEFINES=[ "_DEBUG" ] )
 
@@ -672,7 +680,7 @@ elif "win32" == os.sys.platform:
     winLibString = "ws2_32.lib kernel32.lib advapi32.lib Psapi.lib"
 
     if force64:
-        
+
         winLibString += ""
         #winLibString += " LIBCMT LIBCPMT "
 
@@ -698,8 +706,8 @@ if nix:
 
     if has_option( "distcc" ):
         env["CXX"] = "distcc " + env["CXX"]
-        
-    # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. 
+
+    # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
     env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" )
     # env.Append( " -Wconversion" ) TODO: this doesn't really work yet
     if linux:
@@ -729,7 +737,7 @@ if nix:
         #env.Append( LINKFLAGS=" -fprofile-generate" )
         # then:
         #env.Append( CPPFLAGS=" -fprofile-use" )
-        #env.Append( LINKFLAGS=" -fprofile-use" )        
+        #env.Append( LINKFLAGS=" -fprofile-use" )
 
     if debugLogging:
         env.Append( CPPFLAGS=" -D_DEBUG" );
@@ -789,14 +797,14 @@ if not windows:
         os.chmod( keyfile , stat.S_IWUSR|stat.S_IRUSR )
 
 moduleFiles = {}
-for shortName in getThirdPartyShortNames():    
+for shortName in getThirdPartyShortNames():
     path = "third_party/%s.py" % shortName
     myModule = imp.load_module( "third_party_%s" % shortName , open( path , "r" ) , path , ( ".py" , "r" , imp.PY_SOURCE ) )
     fileLists = { "commonFiles" : commonFiles , "serverOnlyFiles" : serverOnlyFiles , "scriptingFiles" : scriptingFiles }
-    
+
     options_topass["windows"] = windows
     options_topass["nix"] = nix
-    
+
     if has_option( "use-system-" + shortName ) or has_option( "use-system-all" ):
         print( "using system version of: " + shortName )
         myModule.configureSystem( env , fileLists , options_topass )
@@ -1003,7 +1011,7 @@ def doConfigure( myenv , shell=False ):
             if not found:
                 raise "can't find a static %s" % l
 
-    # 'tcmalloc' needs to be the last library linked. Please, add new libraries before this 
+    # 'tcmalloc' needs to be the last library linked. Please, add new libraries before this
     # point.
     if has_option( "heapcheck" ) and not shell:
         if ( not debugBuild ) and ( not debugLogging ):
@@ -1018,7 +1026,7 @@ def doConfigure( myenv , shell=False ):
         myenv.Append( CPPDEFINES=[ "HEAP_CHECKING" ] )
         myenv.Append( CPPFLAGS="-fno-omit-frame-pointer" )
 
-    # FIXME doConfigure() is being called twice, in the case of the shell. So if it is called 
+    # FIXME doConfigure() is being called twice, in the case of the shell. So if it is called
     # with shell==True, it'd be on its second call and it would need to rearrange the libraries'
     # order. The following removes tcmalloc from the LIB's list and reinserts it at the end.
     if has_option( "heapcheck" ) and shell:
@@ -1128,7 +1136,7 @@ checkErrorCodes()
 # main db target
 mongodOnlyFiles = [ "db/db.cpp", "db/compact.cpp" ]
 if windows:
-    mongodOnlyFiles.append( "util/ntservice.cpp" ) 
+    mongodOnlyFiles.append( "util/ntservice.cpp" )
 mongod = env.Program( "mongod" , commonFiles + coreDbFiles + coreServerFiles + serverOnlyFiles + mongodOnlyFiles )
 Default( mongod )
 
@@ -1215,7 +1223,7 @@ elif not onlyServer:
     coreShellFiles.append( "third_party/linenoise/linenoise.cpp" )
 
     shellEnv.Prepend( LIBPATH=[ "." ] )
-        
+
     shellEnv = doConfigure( shellEnv , shell=True )
 
     shellEnv.Prepend( LIBS=[ "mongoshellfiles"] )
@@ -1364,14 +1372,14 @@ env.AlwaysBuild("docs")
 #  ---- astyle ----
 
 def doStyling( env , target , source ):
-    
+
     res = utils.execsys( "astyle --version" )
     res = " ".join(res)
     if res.count( "2." ) == 0:
         print( "astyle 2.x needed, found:" + res )
         Exit(-1)
 
-    files = utils.getAllSourceFiles() 
+    files = utils.getAllSourceFiles()
     files = filter( lambda x: not x.endswith( ".c" ) , files )
     files.remove( "./shell/mongo_vstudio.cpp" )
 
@@ -1396,7 +1404,7 @@ def getSystemInstallName():
         n += "-debugsymbols"
     if nix and os.uname()[2].startswith( "8." ):
         n += "-tiger"
-        
+
     if len(moduleNames) > 0:
         n += "-" + "-".join( moduleNames )
 
@@ -1408,7 +1416,7 @@ def getSystemInstallName():
     except:
         pass
 
-        
+
     dn = GetOption( "distmod" )
     if dn and len(dn) > 0:
         n = n + "-" + dn
@@ -1521,7 +1529,7 @@ if installSetup.clientSrc:
 #lib
 if installSetup.libraries:
     env.Install( installDir + "/" + nixLibPrefix, clientLibName )
-    if has_option( "sharedclient" ): 
+    if has_option( "sharedclient" ):
         env.Install( installDir + "/" + nixLibPrefix, sharedClientLibName )
 
 
@@ -1603,7 +1611,7 @@ def s3push( localName , remoteName=None , remotePrefix=None , fixName=True , pla
         name = name.lower()
     else:
         name = remoteName
-        
+
     if isDriverBuild():
         name = "cxx-driver/" + name
     elif platformDir: