You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

132 lines
4.7 KiB

##
## corenlp.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2022 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 version
%define V_base 3.9.2
%define V_date 2018-10-05
# package information
Name: corenlp
Summary: Natural Language Processing (NLP) Toolkit
URL: http://stanfordnlp.github.io/CoreNLP/
Vendor: Stanford University
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: Algorithm
License: GPL
Version: %{V_base}
Release: 20181006
# list of sources
Source0: http://nlp.stanford.edu/software/stanford-corenlp-full-%{V_date}.zip
Source1: corenlp.sh
Source2: rc.corenlp
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101
PreReq: OpenPKG, openpkg >= 20160101
%description
Stanford CoreNLP provides a set of natural language analysis tools.
It can give the base forms of words, their parts of speech, whether
they are names of companies, people, etc., normalize dates, times,
and numeric quantities, and mark up the structure of sentences
in terms of phrases and word dependencies, indicate which noun
phrases refer to the same entities, indicate sentiment, extract
open-class relations between mentions, etc. Choose Stanford CoreNLP
if you need: An integrated toolkit with a good range of grammatical
analysis tools; Fast, reliable analysis of arbitrary texts; The
overall highest quality text analytics; Support for a number of
major (human) languages; Interfaces available for various major
modern programming languages.
%track
prog corenlp = {
version = %{V_date}
url = http://stanfordnlp.github.io/CoreNLP/download.html
regex = stanford-corenlp-full-(\d+-\d+-\d+)\.zip
}
%prep
%setup -q -n stanford-corenlp-full-%{V_date}
%build
# remove unnecessary files
rm -f LIBRARY-LICENSES LICENSE.txt Makefile README.txt
rm -f SemgrexDemo.java ShiftReduceDemo.java StanfordCoreNlpDemo.java StanfordDependenciesManual.pdf build.xml
rm -f corenlp.sh
rm -f ejml-0.23-src.zip
rm -f input.txt input.txt.out input.txt.xml
rm -f javax.json-api-1.0-sources.jar
rm -f joda-time-2.9-sources.jar
rm -f jollyday-0.4.7-sources.jar
rm -f pom.xml
rm -f stanford-corenlp-*-javadoc.jar
rm -f stanford-corenlp-*-sources.jar
rm -f xom-1.2.10-src.jar
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/lib/corenlp \
$RPM_BUILD_ROOT%{l_prefix}/var/corenlp/log \
$RPM_BUILD_ROOT%{l_prefix}/var/corenlp/run
# install package
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE corenlp.sh} \
$RPM_BUILD_ROOT%{l_prefix}/bin/corenlp
cp -rp * \
$RPM_BUILD_ROOT%{l_prefix}/lib/corenlp
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.corenlp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/corenlp/*'
%files -f files
%clean
%post
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} corenlp status 2>/dev/null`
[ ".$corenlp_active" = .yes ] && %{l_rc} corenlp restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} corenlp stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/corenlp/log/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/corenlp/run/* >/dev/null 2>&1 || true
exit 0