##
##  regexp9.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         regexp9
Summary:      Plan9 Regular Expression Library
URL:          http://swtch.com/plan9port/unix/
Vendor:       Rob Pike et al.
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        RegExp
License:      MIT-style
Version:      20080906
Release:      20080906

#   list of sources
Source0:      http://swtch.com/plan9port/unix/libregexp9.tgz
Source1:      http://swtch.com/plan9port/unix/libfmt.tgz
Source2:      http://swtch.com/plan9port/unix/libutf.tgz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101
PreReq:       OpenPKG, openpkg >= 20160101

%description
    Libregexp9 is a port of Plan 9's Unicode-capable regular expression
    library. It is small and simple and provides the traditional
    extended regular expressions (without modern complications like {}
    and various \x character classes). It supports Unicode via wide
    character or UTF-8 encoding.

%track
    prog regexp9 = {
        disabled
        version   = %{version}
        url       = http://swtch.com/plan9port/unix/
        regex     = libregexp9-(__VER__)\.tar\.gz
    }

%prep
    %setup -q -c
    %setup -q -T -D -a 1
    %setup -q -T -D -a 2

%build
    ( cd libutf
      %{l_make} %{l_mflags} CC="%{l_cc}"
    ) || exit $?
    ( cd libfmt
      %{l_make} %{l_mflags} CC="%{l_cc}"
    ) || exit $?
    ( cd libregexp
      %{l_make} %{l_mflags} CC="%{l_cc}"
    ) || exit $?
    ar cr libregexp9.a libutf/*.o libfmt/*.o libregexp/*.o

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/include/regexp9 \
        $RPM_BUILD_ROOT%{l_prefix}/lib
    %{l_shtool} install -c -m 644 \
        libregexp/*.h $RPM_BUILD_ROOT%{l_prefix}/include/regexp9/
    %{l_shtool} install -c -m 644 \
        libregexp9.a $RPM_BUILD_ROOT%{l_prefix}/lib/
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

