Package init

This commit is contained in:
overweight 2019-09-30 11:10:02 -04:00
commit 591899afb5
5 changed files with 301 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# HG changeset patch
# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
# Date 1549579831 25200
# Thu Feb 07 15:50:31 2019 -0700
# Node ID 753fe0f7964c3faef5e4410ed7e0c965df7b180b
# Parent 5f4fed68d661de81638c8e1f108aff075a33d46e
diff --git a/pr/include/prbit.h b/pr/include/prbit.h
--- a/nspr/pr/include/prbit.h
+++ b/nspr/pr/include/prbit.h
@@ -14,7 +14,8 @@
** functions.
*/
#if defined(_WIN32) && (_MSC_VER >= 1300) && \
- (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM))
+ (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM) || \
+ defined(_M_ARM64))
# include <intrin.h>
# pragma intrinsic(_BitScanForward,_BitScanReverse)
__forceinline static int __prBitScanForward32(unsigned int val)
@@ -33,7 +34,8 @@
# define pr_bitscan_clz32(val) __prBitScanReverse32(val)
# define PR_HAVE_BUILTIN_BITSCAN32
#elif ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && \
- (defined(__i386__) || defined(__x86_64__) || defined(__arm__))
+ (defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
+ defined(__aarch64__))
# define pr_bitscan_ctz32(val) __builtin_ctz(val)
# define pr_bitscan_clz32(val) __builtin_clz(val)
# define PR_HAVE_BUILTIN_BITSCAN32
@@ -136,7 +138,7 @@
*/
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \
- defined(_M_X64) || defined(_M_ARM))
+ defined(_M_X64) || defined(_M_ARM) || defined(_M_ARM64))
#include <stdlib.h>
#pragma intrinsic(_rotl, _rotr)
#define PR_ROTATE_LEFT32(a, bits) _rotl(a, bits)

BIN
nspr-4.20.tar.gz Normal file

Binary file not shown.

37
nspr-config-pc.patch Normal file
View File

@ -0,0 +1,37 @@
diff -up a/nspr/config/nspr-config.in.flags b/nspr/config/nspr-config.in
--- a/nspr/config/nspr-config.in.flags 2013-05-29 13:46:34.147971410 -0700
+++ b/nspr/config/nspr-config.in 2013-05-29 14:17:10.990838914 -0700
@@ -102,7 +102,7 @@ if test -z "$includedir"; then
includedir=@includedir@
fi
if test -z "$libdir"; then
- libdir=@libdir@
+ libdir=`pkg-config --variable=libdir nspr`
fi
if test "$echo_prefix" = "yes"; then
@@ -136,12 +136,12 @@ if test "$echo_libs" = "yes"; then
if test -n "$lib_nspr"; then
libdirs="$libdirs -lnspr${major_version}"
fi
- os_ldflags="@LDFLAGS@"
+ os_ldflags=`pkg-config --variable=ldflags nspr`
for i in $os_ldflags ; do
if echo $i | grep \^-L >/dev/null; then
libdirs="$libdirs $i"
fi
done
- echo $libdirs @OS_LIBS@
+ echo $libdirs `pkg-config --variable=os_libs nspr`
fi
diff -up a/nspr/config/nspr.pc.in.flags b/nspr/config/nspr.pc.in
--- a/nspr/config/nspr.pc.in.flags 2013-05-29 13:48:15.026643570 -0700
+++ b/nspr/config/nspr.pc.in 2013-05-29 13:49:47.795202949 -0700
@@ -6,5 +6,5 @@ includedir=@includedir@
Name: NSPR
Description: The Netscape Portable Runtime
Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@
-Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@
+Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ @OS_LIBS@
Cflags: -I@includedir@

127
nspr-config.xml Normal file
View File

@ -0,0 +1,127 @@
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY date SYSTEM "date.xml">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="nspr-config">
<refentryinfo>
<date>&date;</date>
<title>Netscape Portable Runtime</title>
<productname>nspr</productname>
<productnumber>&version;</productnumber>
</refentryinfo>
<refmeta>
<refentrytitle>nspr-config</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>nspr-config</refname>
<refpurpose>Return meta information about nspr libraries</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>nspr-config</command>
<arg><option>--prefix</option></arg>
<arg><option>--exec-prefix</option></arg>
<arg><option>--includedir</option></arg>
<arg><option>--libs</option></arg>
<arg><option>--cflags</option></arg>
<arg><option>--libdir</option></arg>
<arg><option>--version</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection id="description">
<title>Description</title>
<para><command>nspr-config</command> is a shell script which can be used to obtain gcc options for building client pacakges of nspr.</para>
</refsection>
<refsection>
<title>Options</title>
<variablelist>
<varlistentry>
<term><option>--prefix</option></term>
<listitem><simpara>Returns the top level system directory under which the nspr libraries are installed.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--exec-prefix</option></term>
<listitem><simpara>Returns the top level system directory under which any nspr binaries would be installed.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--includedir</option> <replaceable>count</replaceable></term>
<listitem><simpara>Returns the path to the directory were the nspr headers are installed.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem><simpara>Returns the upstream version of nspr in the form major_version-minor_version-patch_version.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--libs</option></term>
<listitem><simpara>Returns the compiler linking flags.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--cflags</option></term>
<listitem><simpara>Returns the compiler include flags.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><option>--libdir</option></term>
<listitem><simpara>Returns the path to the directory were the nspr libraries are installed.</simpara></listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Examples</title>
<para>The following example will query for both include path and linkage flags:
<programlisting>
/usr/bin/nspr-config --cflags --libs
</programlisting>
</para>
</refsection>
<refsection>
<title>Files</title>
<para><filename>/usr/bin/nspr-config</filename></para>
</refsection>
<refsection>
<title>See also</title>
<para>pkg-config(1)</para>
</refsection>
<refsection id="authors">
<title>Authors</title>
<para>The NSPR liraries were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google.</para>
<para>
Authors: Elio Maldonado &lt;emaldona@redhat.com>.
</para>
</refsection>
<!-- don't change -->
<refsection id="license">
<title>LICENSE</title>
<para>Licensed under the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
</para>
</refsection>
</refentry>

99
nspr.spec Normal file
View File

@ -0,0 +1,99 @@
%global nspr_version 4.20
Name: nspr
Version: 4.20.0
Release: 2
Summary: Netscape Portable Runtime
License: MPLv2.0
URL: http://www.mozilla.org/projects/nspr
BuildRequires: gcc git
Source0: %{name}-%{nspr_version}.tar.gz
Source1: nspr-config.xml
Patch1: nspr-config-pc.patch
Patch6000: 6000-Bug-1525173-prbith-should-use-builtin-function-on-aarch64.patch
%description
NetScape Portable Runtime (NSPR) provides platform independence for non-GUI
operating system facilities. These facilities include threads, thread
synchronization, normal file and network I/O, interval timing and calendar
time, basic memory management (malloc and free) and shared library linking.
%package devel
Summary: Development libraries for the Netscape Portable Runtime
BuildRequires: xmlto
Requires: nspr = %{version}-%{release}
Requires: pkgconfig
%description devel
Development package for nspr.
%prep
%autosetup -n %{name}-%{nspr_version} -p1 -Sgit
cp ./nspr/config/nspr-config.in ./nspr/config/nspr-config-pc.in
%build
%define _configure ./nspr/configure
%configure \
--includedir=%{_includedir}/nspr4 \
--enable-64bit \
--enable-optimize="$RPM_OPT_FLAGS"
%make_build
date +"%e %B %Y" | tr -d '\n' > date.xml
echo -n %{version} > version.xml
cp %{SOURCE1} .
xmlto man nspr-config.xml
%check
perl ./nspr/pr/tests/runtests.pl 2>&1 | tee output.log
TEST_FAILURES=`grep -c FAILED ./output.log` || :
if [ $TEST_FAILURES -ne 0 ]; then
echo "error: test suite returned failure(s)"
exit 1
fi
echo "test suite completed"
%install
rm -rf $RPM_BUILD_ROOT
%make_install
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pkgconfig
NSPR_LIBS=`./config/nspr-config --libs`
NSPR_CFLAGS=`./config/nspr-config --cflags`
NSPR_VERSION=`./config/nspr-config --version`
install -c -m 644 nspr-config.1 $RPM_BUILD_ROOT%{_mandir}/man1/nspr-config.1
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%{_libdir}/libnspr4.so
%{_libdir}/libplc4.so
%{_libdir}/libplds4.so
%exclude %{_bindir}/compile-et.pl
%exclude %{_bindir}/prerr.properties
%exclude %{_libdir}/libnspr4.a
%exclude %{_libdir}/libplc4.a
%exclude %{_libdir}/libplds4.a
%exclude %{_datadir}/aclocal/nspr.m4
%exclude %{_includedir}/nspr4/md
%license nspr/LICENSE
%files devel
%{_bindir}/nspr-config
%{_libdir}/pkgconfig/nspr.pc
%{_includedir}/nspr4
%{_mandir}/man*/*
%changelog
* Fri Apr 19 2019 liusirui<liusirui@huawei.com> - 4.20.0-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:backport patches from https://hg.mozilla.org/projects/nspr
* Mon Sep 10 2018 openEuler Buildteam <buildteam@openeuler.org> - 4.20.0-1
- Package init