summaryrefslogtreecommitdiffstats
path: root/source-builder/config/swig-4-1.cfg
blob: 6c101146e8b919189c77e993afce7a4ec49c2e1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#
# SWIG 4.xx Version 1.
#
# This configuration file configure's, make's and install's m4
#
# Warning: this package is only for bootstrapping within a build.
#


Name:      swig-%{swig_version}-%{_host}-%{release}
Summary:   SWIG v%{swig_version} for host %{_host}
Version:   %{swig_version}
Release:   %{release}
URL: 	   http://www.swig.org/

#
# Source
#
%source set swig --rsb-file=swig-rel-%{swig_version}.tar.gz https://github.com/swig/swig/archive/rel-%{swig_version}.tar.gz
%source set pcre https://ftp.pcre.org/pub/pcre/pcre-%{pcre_version}.tar.bz2

#
# See if a special swig prefix is provided
#
%if %{defined swig_prefix}
  %define _disable_collecting yes
  %define _disable_packaging  yes
  %define _disable_reporting  yes
  %define _disable_installing yes
%endif

#
# Prepare the source code.
#
%prep
  build_top=$(pwd)

  source_dir_swig="swig-rel-%{swig_version}"

  %source setup swig -q -n swig-rel-%{swig_version}
  %source download pcre

  %patch setup swig -p1

  # SWIG does not ship from github with it's generated files. We
  # need to generate them.
  # Add the path to the internal autoconf tools
  SWIG_XPATH=$PATH
  %if %{defined _internal_autotools_path}
    export PATH=%{_internal_autotools_path}/bin:$PATH
  %endif
  ./autogen.sh
  export PATH=$SWIG_XPATH

  cd ${build_top}

%build
  build_top=$(pwd)

  %{build_directory}

  mkdir -p ${build_dir}
  cd ${build_dir}

  %{host_build_flags}

  # build PCRE using the SWIG script as it is a static link
  %{__cp} %{_sourcedir}/pcre-%{pcre_version}.tar.bz2 pcre-%{pcre_version}.tar.bz2
  ../${source_dir_swig}/Tools/pcre-build.sh

  %if %{defined swig_prefix}
   prefix=%{swig_prefix}
  %else
   prefix=%{_prefix}
  %endif

  ../${source_dir_swig}/configure \
    --host=%{_host} \
    --prefix=${prefix}

  %{__make} %{?_smp_mflags}

  cd ${build_top}

%install
  build_top=$(pwd)

  %{__rmdir} ${SB_BUILD_ROOT}

  cd ${build_dir}
  %if %{!defined swig_prefix}
   %define destdir DESTDIR=${SB_BUILD_ROOT}
  %else
   %define destdir %{nil}
  %endif
  %{__make} %{destdir} install
  cd ${build_top}