4
# Licensed to the Apache Software Foundation (ASF) under one
5
# or more contributor license agreements. See the NOTICE file
6
# distributed with this work for additional information
7
# regarding copyright ownership. The ASF licenses this file
8
# to you under the Apache License, Version 2.0 (the
9
# "License"); you may not use this file except in compliance
10
# with the License. You may obtain a copy of the License at
12
# http://www.apache.org/licenses/LICENSE-2.0
14
# Unless required by applicable law or agreed to in writing,
15
# software distributed under the License is distributed on an
16
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
# KIND, either express or implied. See the License for the
18
# specific language governing permissions and limitations
23
# Helper script to generate the ctypesgen wrappers
29
EXTRA_CTYPES_LDFLAGS="$3"
40
cp_relpath="subversion/bindings/ctypes-python"
41
output="$cp_relpath/svn_all.py"
43
# Avoid build path in csvn/core/functions.py
44
if test "$abs_builddir" = "$abs_srcdir"; then
45
svn_includes="subversion/include"
47
mkdir -p "$cp_relpath/csvn/core"
48
svn_includes="$abs_srcdir/subversion/include"
51
### most of this should be done at configure time and passed in
52
apr_cppflags="`$apr_config --includes --cppflags`"
53
apr_include_dir="`$apr_config --includedir`"
54
apr_ldflags="`$apr_config --ldflags --link-ld`"
56
apu_cppflags="`$apu_config --includes`" # no --cppflags
57
apu_include_dir="`$apu_config --includedir`"
58
apu_ldflags="`$apu_config --ldflags --link-ld`"
60
cpp="`$apr_config --cpp`"
63
cppflags="$apr_cppflags $apu_cppflags -I$svn_includes"
64
ldflags="-L$svn_libdir $apr_ldflags $apu_ldflags $EXTRA_CTYPES_LDFLAGS"
67
# This order is important. The resulting stubs will load libraries in
68
# this particular order.
69
### maybe have gen-make do this for us
70
for lib in subr diff delta fs repos wc ra client ; do
71
ldflags="$ldflags -lsvn_$lib-1"
74
includes="$svn_includes/svn_*.h $apr_include_dir/ap[ru]_*.h"
75
if test "$apr_include_dir" != "$apu_include_dir" ; then
76
includes="$includes $apu_include_dir/ap[ru]_*.h"
79
# Remove some whitespace in csvn/core/functions.py
80
CPPFLAGS="`echo $CPPFLAGS`"
81
cppflags="`echo $cppflags`"
83
echo $LT_EXECUTE $PYTHON $CTYPESGEN --cpp "$cpp $CPPFLAGS $cppflags" $ldflags $includes -o $output --no-macro-warnings --strip-build-path=$abs_srcdir
84
$LT_EXECUTE $PYTHON $CTYPESGEN --cpp "$cpp $CPPFLAGS $cppflags" $ldflags $includes -o $output --no-macro-warnings --strip-build-path=$abs_srcdir
86
(cat $abs_srcdir/$cp_relpath/csvn/core/functions.py.in; \
87
sed -e '/^FILE =/d' $output | \
88
perl -pe 's{(\s+\w+)\.restype = POINTER\(svn_error_t\)}{\1.restype = POINTER(svn_error_t)\n\1.errcheck = _svn_errcheck}' \
89
) > $abs_srcdir/$cp_relpath/csvn/core/functions.py