json/json.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 303
2bd9bf3f6f03
child 694
5bd730820c5b
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

     1 ##
     2 ##  json.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package version
    25 %define       V_api_c   0.9
    26 %define       V_api_c2  1.1.0
    27 %define       V_api_c3  0.3
    28 %define       V_api_pl1 2.16
    29 %define       V_api_pl2 0.39
    30 %define       V_api_pl3 2.26
    31 %define       V_api_pl4 0.011
    32 %define       V_api_js1 20090929
    33 %define       V_api_js2 20090929
    35 #   package information
    36 Name:         json
    37 Summary:      JavaScript Object Notation (JSON)
    38 URL:          http://www.json.org/
    39 Vendor:       D. Crockford et al.
    40 Packager:     OpenPKG Foundation e.V.
    41 Distribution: OpenPKG Community
    42 Class:        PLUS
    43 Group:        Language
    44 License:      Open Source
    45 Version:      %{V_api_js2}
    46 Release:      20091120
    48 #   list of sources
    49 Source0:      http://oss.metaparadigm.com/json-c/json-c-%{V_api_c}.tar.gz
    50 Source1:      http://switch.dl.sourceforge.net/zzjson/zzjson-%{V_api_c2}.tar.gz
    51 Source2:      http://projects.snarc.org/libjson/download/libjson-%{V_api_c3}.tar.bz2
    52 Source3:      http://www.cpan.org/authors/id/M/MA/MAKAMAKA/JSON-%{V_api_pl1}.tar.gz
    53 Source4:      http://www.cpan.org/authors/id/D/DO/DOWENS/JSON-DWIW-%{V_api_pl2}.tar.gz
    54 Source5:      http://www.cpan.org/authors/id/M/ML/MLEHMANN/JSON-XS-%{V_api_pl3}.tar.gz
    55 Source6:      http://www.cpan.org/authors/id/P/PE/PERLER/JavaScript-Dumper-%{V_api_pl4}.tar.gz
    56 Source7:      ftp://ftp.openpkg.org/sources/CPY/VERSIONED/json/json-%{V_api_js1}.js
    57 Source8:      ftp://ftp.openpkg.org/sources/CPY/VERSIONED/json/json2-%{V_api_js2}.js
    58 Source9:      http://www.ietf.org/rfc/rfc4627.txt
    59 Patch0:       json.patch
    61 #   build information
    62 Prefix:       %{l_prefix}
    63 BuildRoot:    %{l_buildroot}
    64 BuildPreReq:  OpenPKG, openpkg >= 20040130, perl, perl-openpkg, make
    65 PreReq:       OpenPKG, openpkg >= 20040130, perl
    66 AutoReq:      no
    67 AutoReqProv:  no
    69 %description
    70     JSON (JavaScript Object Notation) is a lightweight data-interchange
    71     format. It is easy for humans to read and write. It is easy for
    72     machines to parse and generate. It is based on a subset of the
    73     JavaScript Programming Language, Standard ECMA-262 3rd Edition.
    74     JSON is a text format that is completely language independent but
    75     uses conventions that are familiar to programmers of the C-family
    76     of languages. These properties make JSON an ideal data-interchange
    77     language.
    79 %track
    80     prog json:json-c = {
    81         version   = %{V_api_c}
    82         url       = http://oss.metaparadigm.com/json-c/
    83         regex     = json-c-(__VER__)\.tar\.gz
    84     }
    85     prog json:json-c2 = {
    86         version   = %{V_api_c2}
    87         url       = http://sourceforge.net/projects/zzjson/files/
    88         regex     = zzjson-(__VER__)\.tar\.gz
    89     }
    90     prog json:json-c3 = {
    91         version   = %{V_api_c3}
    92         url       = http://projects.snarc.org/libjson/download/
    93         regex     = libjson-(__VER__)\.tar\.bz2
    94     }
    95     prog json:json-pl1 = {
    96         version   = %{V_api_pl1}
    97         url       = http://www.cpan.org/authors/id/M/MA/MAKAMAKA/
    98         regex     = JSON-(__VER__)\.tar\.gz
    99     }
   100     prog json:json-pl2 = {
   101         version   = %{V_api_pl3}
   102         url       = http://www.cpan.org/authors/id/D/DO/DOWENS/
   103         regex     = JSON-DWIW-(__VER__)\.tar\.gz
   104     }
   105     prog json:json-pl3 = {
   106         version   = %{V_api_pl4}
   107         url       = http://www.cpan.org/authors/id/M/ML/MLEHMANN/
   108         regex     = JSON-XS-(__VER__)\.tar\.gz
   109     }
   110     prog json:json-pl4 = {
   111         version   = %{V_api_pl5}
   112         url       = http://www.cpan.org/authors/id/P/PE/PERLER/
   113         regex     = JavaScript-Dumper-(__VER__)\.tar\.gz
   114     }
   115     prog json:json-js1 = {
   116         version   = %{V_api_js1}
   117         url       = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/json/
   118         regex     = json-(__VER__)\.js
   119     }
   120     prog json:json-js2 = {
   121         version   = %{V_api_js2}
   122         url       = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/json/
   123         regex     = json2-(__VER__)\.js
   124     }
   126 %prep
   127     %setup -q -c
   128     %setup -q -T -D -a 1
   129     %setup -q -T -D -a 2
   130     %setup -q -T -D -a 3
   131     %setup -q -T -D -a 4
   132     %setup -q -T -D -a 5
   133     %setup -q -T -D -a 6
   134     cp %{SOURCE json-%{V_api_js1}.js} json.js
   135     cp %{SOURCE json2-%{V_api_js2}.js} json2.js
   136     %patch -p0
   137     %{l_shtool} subst \
   138         -e 's;\(AM_CFLAGS *=.*\)-Werror *;\1;' \
   139         json-c-%{V_api_c}/Makefile.in
   141 %build
   142     ( cd json-c-%{V_api_c}
   143       CC="%{l_cc}" \
   144       CFLAGS="%{l_cflags -O}" \
   145       ./configure \
   146           --prefix=%{l_prefix} \
   147           --disable-shared
   148       %{l_make} %{l_mflags -O}
   149     ) || exit $?
   150     ( cd zzjson-%{V_api_c2}
   151       CC="%{l_cc}" \
   152       %{l_bash} ./buildstatic.sh
   153     ) || exit $?
   154     ( cd libjson-%{V_api_c3}
   155       %{l_make} %{l_mflags} \
   156           CC="%{l_cc}" \
   157           CFLAGS="%{l_cflags -O}" \
   158           libjson.a
   159     ) || exit $?
   160     %{l_prefix}/bin/perl-openpkg prepare
   161     %{l_prefix}/bin/perl-openpkg -d JSON-%{V_api_pl1} configure build
   162     %{l_prefix}/bin/perl-openpkg -d JSON-DWIW-%{V_api_pl2} configure build
   163     %{l_prefix}/bin/perl-openpkg -d JSON-XS-%{V_api_pl3} configure build
   164     %{l_prefix}/bin/perl-openpkg -d JavaScript-Dumper-%{V_api_pl4} configure build
   166 %install
   167     rm -rf $RPM_BUILD_ROOT
   168     ( cd json-c-%{V_api_c}
   169       %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   170     ) || exit $?
   171     ( cd zzjson-%{V_api_c2}
   172       %{l_shtool} install -c -m 644 \
   173           include/zzjson.h $RPM_BUILD_ROOT%{l_prefix}/include/
   174       %{l_shtool} install -c -m 644 \
   175           lib/libzzjson.a $RPM_BUILD_ROOT%{l_prefix}/lib/
   176     ) || exit $?
   177     ( cd libjson-%{V_api_c3}
   178       %{l_shtool} install -c -m 644 \
   179           json.h $RPM_BUILD_ROOT%{l_prefix}/include/
   180       %{l_shtool} install -c -m 644 \
   181           libjson.a $RPM_BUILD_ROOT%{l_prefix}/lib/
   182     ) || exit $?
   183     %{l_shtool} mkdir -f -p -m 755 \
   184         $RPM_BUILD_ROOT%{l_prefix}/share/json
   185     %{l_shtool} install -c -m 644 \
   186         json.js json2.js $RPM_BUILD_ROOT%{l_prefix}/share/json/
   187     %{l_shtool} install -c -m 644 \
   188         %{SOURCE rfc4627.txt} $RPM_BUILD_ROOT%{l_prefix}/share/json/
   189     %{l_shtool} mkdir -f -p -m 755 \
   190         $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d
   191     ( echo "Alias /openpkg-json/ %{l_prefix}/share/json/"
   192       echo "<Directory %{l_prefix}/share/json/>"
   193       echo "    Options       Indexes"
   194       echo "    AllowOverride none"
   195       echo "    Order         allow,deny"
   196       echo "    Allow         from all"
   197       echo "</Directory>"
   198     ) >json.conf
   199     %{l_shtool} install -c -m 644 \
   200         json.conf $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
   201     %{l_prefix}/bin/perl-openpkg -d JSON-%{V_api_pl1} install
   202     %{l_prefix}/bin/perl-openpkg -d JSON-DWIW-%{V_api_pl2} install
   203     %{l_prefix}/bin/perl-openpkg -d JSON-XS-%{V_api_pl3} install
   204     %{l_prefix}/bin/perl-openpkg -d JavaScript-Dumper-%{V_api_pl4} install
   205     %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
   206     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   207         %{l_files_std} `cat perl-openpkg-files` \
   208         '%config %{l_prefix}/etc/apache/apache.d/*'
   210 %files -f files
   212 %clean
   213     rm -rf $RPM_BUILD_ROOT

mercurial