Rev 1506: Merge support for building on Windows. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Wed Jul 30 11:42:56 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1506
revision-id: jelmer at samba.org-20080730104253-fchnfv7tga398nfo
parent: jelmer at samba.org-20080730032541-eugf7bz2o0qgwhl9
parent: mhammond at skippinet.com.au-20080730071540-q2i79kfxz87bzp24
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2008-07-30 12:42:53 +0200
message:
Merge support for building on Windows.
added:
stdbool.h stdbool.h-20080727235015-yn3xnbkxaaluvzd0-1
modified:
AUTHORS AUTHORS-20060508114718-4c90c0062645106d
setup.py setup.py-20060502115218-86950492da22353f
------------------------------------------------------------
revno: 1434.1.8
revision-id: mhammond at skippinet.com.au-20080730071540-q2i79kfxz87bzp24
parent: mhammond at skippinet.com.au-20080730071417-yughl4b5supq8t0s
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Wed 2008-07-30 17:15:40 +1000
message:
revert how stdbool is included in the .c and add our dir to include paths
modified:
wc.c wc.pyx-20080313142018-10l8l23vha2j9e6b-1
------------------------------------------------------------
revno: 1434.1.7
revision-id: mhammond at skippinet.com.au-20080730071417-yughl4b5supq8t0s
parent: mhammond at skippinet.com.au-20080730071051-w9w9bkhs59ge02l8
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Wed 2008-07-30 17:14:17 +1000
message:
remove unneeded file.
removed:
build.ps1 build.ps1-20080727235002-df8vqlrek3sgfg6j-1
------------------------------------------------------------
revno: 1434.1.6
revision-id: mhammond at skippinet.com.au-20080730071051-w9w9bkhs59ge02l8
parent: mhammond at skippinet.com.au-20080730055122-tiahvnln1j5p53ro
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Wed 2008-07-30 17:10:51 +1000
message:
reduce the size of the patch against the original and keeping in the
style of the original.
modified:
setup.py setup.py-20060502115218-86950492da22353f
------------------------------------------------------------
revno: 1434.1.5
revision-id: mhammond at skippinet.com.au-20080730055122-tiahvnln1j5p53ro
parent: mhammond at skippinet.com.au-20080729063238-d070q3luu7i85bkx
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Wed 2008-07-30 15:51:22 +1000
message:
revert how stdbool is included in the .c and add our dir to include paths
modified:
client.c client.pyx-20080313235339-wbyjbw2namuiql8f-1
editor.c editor.c-20080602191336-frj7az1sdk13o1tw-1
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
repos.c repos.pyx-20080314114432-g2b5lqe776tkbl4k-1
setup.py setup.py-20060502115218-86950492da22353f
util.c util.c-20080531154025-s8ef6ej9tytsnkkw-1
------------------------------------------------------------
revno: 1434.1.4
revision-id: mhammond at skippinet.com.au-20080729063238-d070q3luu7i85bkx
parent: mhammond at skippinet.com.au-20080729034454-0os7ks9zcwq322fh
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Tue 2008-07-29 16:32:38 +1000
message:
define WIN32 macro for C compiler, use environment variables to locate
apr libs etc and install apr binaries next to .pyd files.
modified:
setup.py setup.py-20060502115218-86950492da22353f
------------------------------------------------------------
revno: 1434.1.3
revision-id: mhammond at skippinet.com.au-20080729034454-0os7ks9zcwq322fh
parent: jelmer at samba.org-20080724184634-5frrera3vygh2m6m
parent: adrian.wilkins at gmail.com-20080727235052-hnn91tve6ej3zqow
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr-svn-win32binary
timestamp: Tue 2008-07-29 13:44:54 +1000
message:
Merge from Andrew's bundle
added:
build.ps1 build.ps1-20080727235002-df8vqlrek3sgfg6j-1
stdbool.h stdbool.h-20080727235015-yn3xnbkxaaluvzd0-1
modified:
client.c client.pyx-20080313235339-wbyjbw2namuiql8f-1
editor.c editor.c-20080602191336-frj7az1sdk13o1tw-1
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
repos.c repos.pyx-20080314114432-g2b5lqe776tkbl4k-1
setup.py setup.py-20060502115218-86950492da22353f
util.c util.c-20080531154025-s8ef6ej9tytsnkkw-1
wc.c wc.pyx-20080313142018-10l8l23vha2j9e6b-1
------------------------------------------------------------
revno: 1434.2.1
revision-id: adrian.wilkins at gmail.com-20080727235052-hnn91tve6ej3zqow
parent: jelmer at samba.org-20080724184634-5frrera3vygh2m6m
committer: Adrian Wilkins <adrian.wilkins at gmail.com>
branch nick: svn
timestamp: Mon 2008-07-28 00:50:52 +0100
message:
Kludges for Windows
added:
build.ps1 build.ps1-20080727235002-df8vqlrek3sgfg6j-1
stdbool.h stdbool.h-20080727235015-yn3xnbkxaaluvzd0-1
modified:
client.c client.pyx-20080313235339-wbyjbw2namuiql8f-1
editor.c editor.c-20080602191336-frj7az1sdk13o1tw-1
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
repos.c repos.pyx-20080314114432-g2b5lqe776tkbl4k-1
setup.py setup.py-20060502115218-86950492da22353f
util.c util.c-20080531154025-s8ef6ej9tytsnkkw-1
wc.c wc.pyx-20080313142018-10l8l23vha2j9e6b-1
=== modified file 'AUTHORS'
--- a/AUTHORS 2008-07-07 14:57:06 +0000
+++ b/AUTHORS 2008-07-30 10:42:53 +0000
@@ -17,6 +17,7 @@
Mirko Friedenhagen
Martin von Gagern
Guillermo Gonzalez
+Mark Hammond
Wouter van Heyst
Michael Hudson
David James
=== modified file 'setup.py'
--- a/setup.py 2008-07-16 14:53:24 +0000
+++ b/setup.py 2008-07-30 10:42:53 +0000
@@ -4,8 +4,27 @@
from distutils.core import setup
from distutils.extension import Extension
+from distutils.command.install_lib import install_lib
+from distutils import log
+import sys
import os
+# Build instructions for Windows:
+# * Install the SVN dev kit ZIP for Windows from
+# http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
+# At time of writing, this was svn-win32-1.4.6_dev.zip
+# * Find the SVN binary ZIP file with the binaries for your dev kit.
+# At time of writing, this was svn-win32-1.4.6.zip
+# Unzip this in the *same directory* as the dev kit - README.txt will be
+# overwritten, but that is all. This is the default location the .ZIP file
+# will suggest (ie, the directory embedded in both .zip files are the same)
+# * Set SVN_DEV to point at this directory.
+# * Install the APR BDB and INTL packages - see README.txt from the devkit
+# * Set SVN_BDB and SVN_LIBINTL to point at these dirs.
+#
+# To install into a particular bzr location, use:
+# % python setup.py install --install-lib=c:\root\of\bazaar
+
class CommandException(Exception):
"""Encapsulate exit status of apr-config execution"""
def __init__(self, msg, cmd, arg, status, val):
@@ -71,18 +90,114 @@
for basedir in basedirs:
includedir = os.path.join(basedir, "include/subversion-1")
if os.path.isdir(includedir):
- return (includedir, os.path.join(basedir, "lib"))
+ return ([includedir], [os.path.join(basedir, "lib")], [])
raise Exception("Subversion development files not found")
+# Windows versions - we use environment variables to locate the directories
+# and hard-code a list of libraries.
+if os.name == "nt":
+ # just clobber the functions above we can't use
+ # for simplicitly, everything is done in the 'svn' one
+ def apr_build_data():
+ return '.', ''
+
+ def svn_build_data():
+ # environment vars for the directories we need.
+ svn_dev_dir = os.environ.get("SVN_DEV")
+ if not svn_dev_dir or not os.path.isdir(svn_dev_dir):
+ raise Exception(
+ "Please set SVN_DEV to the location of the svn development "
+ "packages.\nThese can be downloaded from:\n"
+ "http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91")
+ svn_bdb_dir = os.environ.get("SVN_BDB")
+ if not svn_bdb_dir or not os.path.isdir(svn_bdb_dir):
+ raise Exception(
+ "Please set SVN_BDB to the location of the svn BDB packages "
+ "- see README.txt in the SV_DEV dir")
+ svn_libintl_dir = os.environ.get("SVN_LIBINTL")
+ if not svn_libintl_dir or not os.path.isdir(svn_libintl_dir):
+ raise Exception(
+ "Please set SVN_LIBINTL to the location of the svn libintl "
+ "packages - see README.txt in the SV_DEV dir")
+
+ includes = [
+ # apr dirs.
+ os.path.join(svn_dev_dir, r"include\apr"),
+ os.path.join(svn_dev_dir, r"include\apr-utils"),
+ os.path.join(svn_dev_dir, r"include\apr-iconv"),
+ # svn dirs.
+ os.path.join(svn_dev_dir, "include"),
+ ]
+ lib_dirs = [
+ os.path.join(svn_dev_dir, "lib"),
+ os.path.join(svn_dev_dir, "lib", "apr"),
+ os.path.join(svn_dev_dir, "lib", "apr-iconv"),
+ os.path.join(svn_dev_dir, "lib", "apr-util"),
+ os.path.join(svn_dev_dir, "lib", "neon"),
+ os.path.join(svn_bdb_dir, "lib"),
+ os.path.join(svn_libintl_dir, "lib"),
+ ]
+ libs = """libapr libapriconv libaprutil libneon
+ libsvn_subr-1 libsvn_client-1 libsvn_ra-1
+ libsvn_ra_dav-1 libsvn_ra_local-1 libsvn_ra_svn-1
+ libsvn_repos-1 libsvn_wc-1 libsvn_delta-1 libsvn_diff-1
+ libsvn_fs-1 libsvn_repos-1 libsvn_fs_fs-1 libsvn_fs_base-1
+ intl3_svn
+ libdb44 xml
+ advapi32 shell32 ws2_32 zlibstat
+ """.split()
+
+ return includes, lib_dirs, libs,
+
(apr_includedir, apr_ldflags) = apr_build_data()
-(svn_includedir, svn_libdir) = svn_build_data()
+(svn_includedirs, svn_libdirs, extra_libs) = svn_build_data()
def SvnExtension(name, *args, **kwargs):
- kwargs["include_dirs"] = [apr_includedir, svn_includedir]
- kwargs["library_dirs"] = [svn_libdir]
+ kwargs["include_dirs"] = [apr_includedir] + svn_includedirs
+ kwargs["library_dirs"] = svn_libdirs
kwargs["extra_link_args"] = apr_ldflags
+ if os.name == 'nt':
+ # on windows, just ignore and overwrite the libraries!
+ kwargs["libraries"] = extra_libs
+ # APR needs WIN32 defined.
+ kwargs["define_macros"] = [("WIN32", None)]
return Extension("bzrlib.plugins.svn.%s" % name, *args, **kwargs)
+# On Windows, we install the apr binaries too.
+class install_lib_with_dlls(install_lib):
+ def _get_dlls(self):
+ # return a list of of (FQ-in-name, relative-out-name) tuples.
+ ret = []
+ apr_bins = "libaprutil.dll libapriconv.dll libapr.dll".split()
+ look_dirs = os.environ.get("PATH","").split(os.pathsep)
+ look_dirs.insert(0, os.path.join(os.environ["SVN_DEV"], "bin"))
+
+ for bin in apr_bins:
+ for look in look_dirs:
+ f = os.path.join(look, bin)
+ if os.path.isfile(f):
+ target = os.path.join(self.install_dir, "bzrlib",
+ "plugins", "svn", bin)
+ ret.append((f, target))
+ break
+ else:
+ log.warn("Could not find required DLL %r to include", bin)
+ log.debug("(looked in %s)", look_dirs)
+ return ret
+
+ def run(self):
+ install_lib.run(self)
+ # the apr binaries.
+ if os.name == 'nt':
+ # On Windows we package up the apr dlls with the plugin.
+ for s, d in self._get_dlls():
+ self.copy_file(s, d)
+
+ def get_outputs(self):
+ ret = install_lib.get_outputs()
+ if os.name == 'nt':
+ ret.extend([info[1] for info in self._get_dlls()])
+ return ret
setup(name='bzr-svn',
description='Support for Subversion branches in Bazaar',
@@ -108,5 +223,6 @@
SvnExtension("ra", ["ra.c", "util.c", "editor.c"], libraries=["svn_ra-1", "svn_delta-1", "svn_subr-1"]),
SvnExtension("repos", ["repos.c", "util.c"], libraries=["svn_repos-1", "svn_subr-1"]),
SvnExtension("wc", ["wc.c", "util.c", "editor.c"], libraries=["svn_wc-1", "svn_subr-1"]),
- ]
+ ],
+ cmdclass = { 'install_lib': install_lib_with_dlls },
)
=== added file 'stdbool.h'
--- a/stdbool.h 1970-01-01 00:00:00 +0000
+++ b/stdbool.h 2008-07-27 23:50:52 +0000
@@ -0,0 +1,7 @@
+#ifndef _STDBOOL_H_
+#define _STDBOOL_H_
+
+typedef enum { false, true } bool;
+
+#endif
+
More information about the bazaar-commits
mailing list