Skip to content

Commit

Permalink
[build] Switch to internal sqlite for NSS, to avoid build problems. J…
Browse files Browse the repository at this point in the history
…B#36034
  • Loading branch information
Andrew Branson committed Mar 5, 2019
1 parent c915719 commit 7500360
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 41 deletions.
91 changes: 91 additions & 0 deletions Rename-sqlite-library-to-avoid-clashing-with-system.patch
@@ -0,0 +1,91 @@
From 44c4c045cb725643b4fd4a4bd6c049a8797687b1 Mon, 4 Mar 2019 17:53:46 +0100
From: Andrew Branson <andrew.branson@jollamobile.com>
Date: Mon, 4 Mar 2019 16:17:04 +0100
Subject: [PATCH] Rename sqlite library to avoid clashing with system

diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
index 5813787..f1b79ba 100644
--- a/nss/coreconf/config.gypi
+++ b/nss/coreconf/config.gypi
@@ -81,7 +81,7 @@
'nspr_lib_dir%': '<(nspr_lib_dir)',
'nspr_include_dir%': '<(nspr_include_dir)',
'use_system_sqlite%': '<(use_system_sqlite)',
- 'sqlite_libs%': ['-lsqlite3'],
+ 'sqlite_libs%': ['-lnsssqlite3'],
'dll_prefix': '<(dll_prefix)',
'dll_suffix': '<(dll_suffix)',
'freebl_name': '<(freebl_name)',
diff --git a/nss/coreconf/location.mk b/nss/coreconf/location.mk
index b11558a..943122d 100644
--- a/nss/coreconf/location.mk
+++ b/nss/coreconf/location.mk
@@ -72,7 +72,7 @@
endif

ifndef SQLITE_LIB_NAME
- SQLITE_LIB_NAME = sqlite3
+ SQLITE_LIB_NAME = nsssqlite3
endif

MK_LOCATION = included
diff --git a/nss/lib/sqlite/manifest.mn b/nss/lib/sqlite/manifest.mn
index 022749b..b2b5191 100644
--- a/nss/lib/sqlite/manifest.mn
+++ b/nss/lib/sqlite/manifest.mn
@@ -6,7 +6,7 @@

MODULE = nss

-LIBRARY_NAME = sqlite
+LIBRARY_NAME = nsssqlite
LIBRARY_VERSION = 3
MAPFILE = $(OBJDIR)/sqlite.def
DEFINES += -DSQLITE_THREADSAFE=1
diff --git a/nss/lib/sqlite/nsssqlite.def b/nss/lib/sqlite/nsssqlite.def
new file mode 120000
index 0000000..f8cd2b2
--- /dev/null
+++ b/nss/lib/sqlite/nsssqlite.def
@@ -0,0 +1 @@
+sqlite.def
\ No newline at end of file
diff --git a/nss/lib/sqlite/sqlite.def b/nss/lib/sqlite/sqlite.def
index 00fa623..3de3051 100644
--- a/nss/lib/sqlite/sqlite.def
+++ b/nss/lib/sqlite/sqlite.def
@@ -17,7 +17,7 @@
;+# directives are hidden behind ";", ";+", and ";-"
;+SQLITE_3 {
;+ global:
-LIBRARY sqlite3 ;-
+LIBRARY nsssqlite3 ;-
EXPORTS ;-
sqlite3_aggregate_context;
sqlite3_aggregate_count;
diff --git a/nss/lib/sqlite/sqlite.gyp b/nss/lib/sqlite/sqlite.gyp
index 6969893..a4c7cad 100644
--- a/nss/lib/sqlite/sqlite.gyp
+++ b/nss/lib/sqlite/sqlite.gyp
@@ -27,7 +27,7 @@
]
},
{
- 'target_name': 'sqlite3',
+ 'target_name': 'nsssqlite3',
'type': 'shared_library',
'dependencies': [
'sqlite'
diff --git a/nss/nss.gyp b/nss/nss.gyp
index 3ec33fd..17ddb59 100644
--- a/nss/nss.gyp
+++ b/nss/nss.gyp
@@ -19,7 +19,7 @@
'dependencies': [
'lib/nss/nss.gyp:nss3',
'lib/smime/smime.gyp:smime3',
- 'lib/sqlite/sqlite.gyp:sqlite3',
+ 'lib/sqlite/sqlite.gyp:nsssqlite3',
'lib/ssl/ssl.gyp:ssl3',
'lib/util/util.gyp:nssutil3',
],
34 changes: 0 additions & 34 deletions nss-nolocalsql.patch

This file was deleted.

11 changes: 4 additions & 7 deletions nss.spec
Expand Up @@ -25,7 +25,6 @@ Requires: nspr >= %{nspr_version}
Requires: nss-system-init
Requires: p11-kit-trust
BuildRequires: nspr-devel >= %{nspr_version}
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig
BuildRequires: gawk
Expand All @@ -50,7 +49,6 @@ Source14: nss-pem-1.0.4.tar.xz
Source15: nss-pem.cmake
Source16: nss-prelink.conf

Patch1: nss-nolocalsql.patch
Patch2: add-relro-linker-option.patch
Patch3: renegotiate-transitional.patch
Patch8: nss-sysinit-userdb-first.patch
Expand All @@ -73,6 +71,7 @@ Patch50: iquote.patch
# Local patch for TLS_ECDHE_{ECDSA|RSA}_WITH_3DES_EDE_CBC_SHA ciphers
Patch58: rhbz1185708-enable-ecc-3des-ciphers-by-default.patch
Patch62: nss-skip-util-gtest.patch
Patch63: Rename-sqlite-library-to-avoid-clashing-with-system.patch

%description
Network Security Services (NSS) is a set of libraries designed to
Expand Down Expand Up @@ -169,7 +168,6 @@ PEM file reader for Network Security Services (NSS), implemented as a PKCS#11 mo
%setup -q -n %{name}-%{nss_archive_version}
%setup -q -T -D -n %{name}-%{nss_archive_version} -a 14

%patch1 -p0 -b .nolocalsql
%patch2 -p0 -b .relro
%patch3 -p0 -b .transitional
%patch8 -p0 -b .userdbfirst
Expand All @@ -180,6 +178,7 @@ PEM file reader for Network Security Services (NSS), implemented as a PKCS#11 mo
pushd nss
%patch62 -p1 -b .skip_util_gtest
popd
%patch63 -p1 -b .rename_sqlite3

%build

Expand Down Expand Up @@ -226,9 +225,6 @@ export NSPR_LIB_DIR
export NSSUTIL_INCLUDE_DIR=`/usr/bin/pkg-config --cflags-only-I nss-util | sed 's/-I//'`
export NSSUTIL_LIB_DIR=%{_libdir}

NSS_USE_SYSTEM_SQLITE=1
export NSS_USE_SYSTEM_SQLITE

export NSS_ALLOW_SSLKEYLOGFILE=1

export NSS_DISABLE_GTESTS=1
Expand Down Expand Up @@ -498,7 +494,7 @@ echo "test suite completed"
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/doc/nss-tools

# Copy the binary libraries we want
for file in libnss3.so libnsssysinit.so libsmime3.so libssl3.so libsoftokn3.so libsoftokn3.chk libnssdbm3.so libnssdbm3.chk libfreebl3.so libfreebl3.chk libfreeblpriv3.so libfreeblpriv3.chk libnssutil3.so
for file in libnss3.so libnsssysinit.so libsmime3.so libssl3.so libsoftokn3.so libsoftokn3.chk libnssdbm3.so libnssdbm3.chk libfreebl3.so libfreebl3.chk libfreeblpriv3.so libfreeblpriv3.chk libnsssqlite3.so libnssutil3.so
do
%{__install} -p -m 755 dist/*.OBJ/lib/$file $RPM_BUILD_ROOT/%{_libdir}
done
Expand Down Expand Up @@ -601,6 +597,7 @@ ln -s -f setup-nsssysinit.sh $RPM_BUILD_ROOT/%{_bindir}/setup-nsssysinit
%{_libdir}/libfreebl3.chk
%{_libdir}/libfreeblpriv3.so
%{_libdir}/libfreeblpriv3.chk
%{_libdir}/libnsssqlite3.so
%dir %{_sysconfdir}/pki/nssdb
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/pki/nssdb/cert8.db
%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/pki/nssdb/key3.db
Expand Down

0 comments on commit 7500360

Please sign in to comment.