# Build recipe for libxml2 (Python2 module).
#
# Copyright (C) 2018, 2019 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

program=libxml2
version=2.9.9
release=1

pkgname=libxml2_python2

# Set 'outdir' for a nice and well-organized output directory
outdir="${outdir}/${arch}/modules/python"

tarname=${program}-${version}.tar.gz

# Remote source(s)
fetch=http://xmlsoft.org/sources/$tarname

description="
libxml2 modules for Python version 2.

This package contains modules for the version 2 of Python,
required by other packages.
"

homepage=http://xmlsoft.org
license=MIT

# The source has a custom directory
srcdir="${program}-${version%-*}"

build()
{
    set -e

    unpack "${tardir}/$tarname"

    cd "$srcdir"

    # Set sane permissions
    chmod -R u+w,go-w,a+rX-s .

    # Installation of libxml2 Python2 module

    cd python
    python2 setup.py build
    python2 setup.py install --prefix=/usr --root="$destdir" --optimize=1
}

