Skip to content

Commit 7c547a7

Browse files
committed
macos: build Berkeley DB and _dbm extension module
We use version 6.0.19 because it is the last version before Oracle switched the license to GNU AGPL v3.
1 parent 234426f commit 7c547a7

File tree

8 files changed

+175
-4
lines changed

8 files changed

+175
-4
lines changed

Diff for: README.rst

+10
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,13 @@ readline, which are both licensed under GPL Version 3.
130130

131131
**It is important to understand the licensing requirements when integrating
132132
the output of this project into derived works.**
133+
134+
Dependency Notes
135+
================
136+
137+
Python has the option of building its ``_dbm`` extension against
138+
NDBM, GDBM, and Berkeley DB. Both NDBM and GDBM are GNU GPL Version 3.
139+
Modern versions of Berkeley DB are GNU AGPL v3. Versions 6.0.19 and
140+
older are licensed under the Sleepycat License. The Sleepycat License
141+
is more permissive. So we build the ``_dbm`` extension against BDB
142+
6.0.19.

Diff for: cpython-linux/build.py

+1
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def build_cpython(client, image, platform):
377377
with run_container(client, image) as container:
378378
copy_toolchain(container, platform=platform)
379379
install_tools_archive(container, BUILD / ('bzip2-%s.tar' % platform))
380+
# TODO build against Berkeley DB to avoid GPLv3.
380381
install_tools_archive(container, BUILD / ('gdbm-%s.tar' % platform))
381382
install_tools_archive(container, BUILD / ('libffi-%s.tar' % platform))
382383
install_tools_archive(container, BUILD / ('ncurses-%s.tar' % platform))

Diff for: cpython-macos/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PLATFORM := macos
99

1010
default: $(OUTDIR)/cpython-macos.tar
1111

12+
$(OUTDIR)/bdb-macos.tar: $(HERE)/build-bdb.sh
13+
$(BUILD) bdb
14+
1215
$(OUTDIR)/bzip2-macos.tar: $(HERE)/build-bzip2.sh
1316
$(BUILD) bzip2
1417

@@ -36,6 +39,7 @@ $(OUTDIR)/zlib-macos.tar: $(HERE)/build-zlib.sh
3639
PYTHON_DEPENDS := \
3740
$(HERE)/static-modules \
3841
$(HERE)/build-cpython.sh \
42+
$(OUTDIR)/bdb-macos.tar \
3943
$(OUTDIR)/bzip2-macos.tar \
4044
$(OUTDIR)/libffi-macos.tar \
4145
$(OUTDIR)/ncurses-macos.tar \

Diff for: cpython-macos/build-bdb.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
set -ex
7+
8+
ROOT=`pwd`
9+
10+
export CC=clang
11+
export CXX=clang++
12+
13+
tar -xf db-${BDB_VERSION}.tar.gz
14+
pushd db-${BDB_VERSION}/build_unix
15+
16+
../dist/configure --prefix / --enable-dbm
17+
18+
make -j ${NUM_CPUS}
19+
make -j ${NUM_CPUIS} install DESTDIR=${ROOT}/out

Diff for: cpython-macos/build.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
MACOSX_DEPLOYMENT_TARGET = '10.14'
3232

3333
DISABLED_STATIC_MODULES = {
34-
# Not yet supported.
34+
# We don't support GDBM because it is GPL v3.
3535
b'_gdbm',
3636
# Not yet supported.
3737
b'_scproxy',
@@ -124,6 +124,7 @@ def build_cpython():
124124
deps_dir = td / 'deps'
125125
deps_dir.mkdir()
126126

127+
extract_tar_to_directory(BUILD / 'bdb-macos.tar', deps_dir)
127128
extract_tar_to_directory(BUILD / 'bzip2-macos.tar', deps_dir)
128129
extract_tar_to_directory(BUILD / 'libffi-macos.tar', deps_dir)
129130
extract_tar_to_directory(BUILD / 'ncurses-macos.tar', deps_dir)
@@ -181,7 +182,7 @@ def main():
181182
with log_path.open('wb') as log_fh:
182183
LOG_FH[0] = log_fh
183184

184-
if action in ('bzip2', 'libffi', 'openssl', 'ncurses', 'sqlite', 'uuid', 'xz', 'zlib'):
185+
if action in ('bdb', 'bzip2', 'libffi', 'openssl', 'ncurses', 'sqlite', 'uuid', 'xz', 'zlib'):
185186
simple_build(action)
186187

187188
elif action == 'cpython':

Diff for: cpython-macos/static-modules

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ _curses_panel _curses_panel.c -lpanel -lncurses
1010
_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/darwin/dlfcn_simple.c _ctypes/malloc_closure.c _ctypes/stgdict.c _ctypes/cfield.c -DMACOSX -I_ctypes/darwin -lffi -ldl
1111
_ctypes_test _ctypes/_ctypes_test.c -lm
1212
_decimal _decimal/_decimal.c _decimal/libmpdec/basearith.c _decimal/libmpdec/constants.c _decimal/libmpdec/context.c _decimal/libmpdec/convolute.c _decimal/libmpdec/crt.c _decimal/libmpdec/difradix2.c _decimal/libmpdec/fnt.c _decimal/libmpdec/fourstep.c _decimal/libmpdec/io.c _decimal/libmpdec/memory.c _decimal/libmpdec/mpdecimal.c _decimal/libmpdec/numbertheory.c _decimal/libmpdec/sixstep.c _decimal/libmpdec/transpose.c -DUNIVERSAL=1 -IModules/_decimal/libmpdec
13-
#_dbm _dbmmodule.c -DHAVE_NDBM_H -I/tools/deps/include -L/tools/deps/lib -lgdbm_compat
13+
_dbm _dbmmodule.c -DHAVE_BERKDB_H -DDB_DBM_HSEARCH -ldb
1414
_elementtree _elementtree.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat
15-
#_gdbm _gdbmmodule.c -DHAVE_NDBM_H -I/tools/deps/include -L/tools/deps/lib -lgdbm
1615
_hashlib _hashopenssl.c -lssl -lcrypto
1716
_json _json.c
1817
_lsprof _lsprof.c rotatingtree.c

Diff for: python-licenses.rst

+130
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,136 @@ Licenses
55
This document describes the licenses of all software distributed with the
66
bundled application.
77

8+
Berkeley DB
9+
===========
10+
11+
The following is the license that applies to this copy of the Berkeley DB
12+
software. For a license to use the Berkeley DB software under conditions
13+
other than those described here, or to purchase support for this software,
14+
please contact Oracle at [email protected].
15+
16+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
17+
/*
18+
* Copyright (c) 1990, 2013 Oracle and/or its affiliates. All rights reserved.
19+
*
20+
* Redistribution and use in source and binary forms, with or without
21+
* modification, are permitted provided that the following conditions
22+
* are met:
23+
* 1. Redistributions of source code must retain the above copyright
24+
* notice, this list of conditions and the following disclaimer.
25+
* 2. Redistributions in binary form must reproduce the above copyright
26+
* notice, this list of conditions and the following disclaimer in the
27+
* documentation and/or other materials provided with the distribution.
28+
* 3. Redistributions in any form must be accompanied by information on
29+
* how to obtain complete source code for the DB software and any
30+
* accompanying software that uses the DB software. The source code
31+
* must either be included in the distribution or be available for no
32+
* more than the cost of distribution plus a nominal fee, and must be
33+
* freely redistributable under reasonable conditions. For an
34+
* executable file, complete source code means the source code for all
35+
* modules it contains. It does not include source code for modules or
36+
* files that typically accompany the major components of the operating
37+
* system on which the executable file runs.
38+
*
39+
* THIS SOFTWARE IS PROVIDED BY ORACLE ``AS IS'' AND ANY EXPRESS OR
40+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41+
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
42+
* NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL ORACLE BE LIABLE
43+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
44+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
45+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
46+
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
47+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
48+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
49+
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50+
*/
51+
/*
52+
* Copyright (c) 1990, 1993, 1994, 1995
53+
* The Regents of the University of California. All rights reserved.
54+
*
55+
* Redistribution and use in source and binary forms, with or without
56+
* modification, are permitted provided that the following conditions
57+
* are met:
58+
* 1. Redistributions of source code must retain the above copyright
59+
* notice, this list of conditions and the following disclaimer.
60+
* 2. Redistributions in binary form must reproduce the above copyright
61+
* notice, this list of conditions and the following disclaimer in the
62+
* documentation and/or other materials provided with the distribution.
63+
* 3. Neither the name of the University nor the names of its contributors
64+
* may be used to endorse or promote products derived from this software
65+
* without specific prior written permission.
66+
*
67+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
68+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
69+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
70+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
71+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
72+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
73+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
74+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
75+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
76+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
77+
* SUCH DAMAGE.
78+
*/
79+
/*
80+
* Copyright (c) 1995, 1996
81+
* The President and Fellows of Harvard University. All rights reserved.
82+
*
83+
* Redistribution and use in source and binary forms, with or without
84+
* modification, are permitted provided that the following conditions
85+
* are met:
86+
* 1. Redistributions of source code must retain the above copyright
87+
* notice, this list of conditions and the following disclaimer.
88+
* 2. Redistributions in binary form must reproduce the above copyright
89+
* notice, this list of conditions and the following disclaimer in the
90+
* documentation and/or other materials provided with the distribution.
91+
* 3. Neither the name of the University nor the names of its contributors
92+
* may be used to endorse or promote products derived from this software
93+
* without specific prior written permission.
94+
*
95+
* THIS SOFTWARE IS PROVIDED BY HARVARD AND ITS CONTRIBUTORS ``AS IS'' AND
96+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
97+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
98+
* ARE DISCLAIMED. IN NO EVENT SHALL HARVARD OR ITS CONTRIBUTORS BE LIABLE
99+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
100+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
101+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
102+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
103+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
104+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
105+
* SUCH DAMAGE.
106+
*/
107+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
108+
/***
109+
* ASM: a very small and fast Java bytecode manipulation framework
110+
* Copyright (c) 2000-2005 INRIA, France Telecom
111+
* All rights reserved.
112+
*
113+
* Redistribution and use in source and binary forms, with or without
114+
* modification, are permitted provided that the following conditions
115+
* are met:
116+
* 1. Redistributions of source code must retain the above copyright
117+
* notice, this list of conditions and the following disclaimer.
118+
* 2. Redistributions in binary form must reproduce the above copyright
119+
* notice, this list of conditions and the following disclaimer in the
120+
* documentation and/or other materials provided with the distribution.
121+
* 3. Neither the name of the copyright holders nor the names of its
122+
* contributors may be used to endorse or promote products derived from
123+
* this software without specific prior written permission.
124+
*
125+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
126+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
127+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
128+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
129+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
130+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
131+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
132+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
133+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
134+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
135+
* THE POSSIBILITY OF SUCH DAMAGE.
136+
*/
137+
8138
bzip2
9139
=====
10140

Diff for: pythonbuild/downloads.py

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

55
DOWNLOADS = {
6+
# 6.0.19 is the last version licensed under the Sleepycat license.
7+
'bdb': {
8+
'url': 'https://ftp.tw.freebsd.org/distfiles/bdb/db-6.0.19.tar.gz',
9+
'size': 36541923,
10+
'sha256': '2917c28f60903908c2ca4587ded1363b812c4e830a5326aaa77c9879d13ae18e',
11+
'version': '6.0.19',
12+
},
613
'binutils': {
714
'url': 'ftp://ftp.gnu.org/gnu/binutils/binutils-2.31.tar.xz',
815
'size': 20445772,

0 commit comments

Comments
 (0)