dev-libs/StringiFor: new package

A KISS pure Fortran library providing astrings (class) manipulator
for modern (2003+) Fortran projects.

From developer's page (https://github.com/szaghi/StringiFor):

What is StringiFor?
Modern Fortran standards (2003+) have introduced a better support
for characters variables, but Fortraners still do not have the power
on dealing with strings of other more-rich-programmers, e.g. Pythoners.

Allocatable deferred length character variables are now quantum-leap
with respect the old inflexible Fortran characters,
but it is still not enough for many Fortraners.

Moreover, Fortran does not provide builtin methods
for widely used strings manipulations offered by other languages,
e.g. UPPER/lowercase transformation, tokenization, etc...
StringiFor attempts to fill this lack.

Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
This commit is contained in:
Sergey Torokhov 2020-04-19 17:01:04 +03:00
parent aa9ddfff2b
commit 9228029843
No known key found for this signature in database
GPG Key ID: 6787AA71304915E3
5 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,4 @@
DIST BeFoR64-1.1.4.tar.gz 32928 BLAKE2B ef5ca349508525c48843c613ef945f33e165069d2ade3f98acf25810daa22617d8c5fe45c4127d3eef36a5358cc1052237e6d94fce0ab4ae289a28a0d9c99b48 SHA512 26b0fa2cb754fa0f3809f5de29136073fdd399d0b192a5d97b67759a1a9f68fd59894f5fa9a805c7626732b63f18990922d88b110bd6d4ccdd5218fd330a4c81
DIST FACE-1.1.2.tar.gz 159747 BLAKE2B 007c6bfc4148649a28f322f451f665750dc7cca515fae3c3d9b96694ea20ed0586471b9def43c92039bdf9450a1ebf9a927e5d50e8df4ea829284f41c331464e SHA512 e9eb336923780bf1a1b37a5f897a72181599bf843e91f118d4d418aebf26489bdeaedbd9025b8abda446b7bdb5e97746346e68ff6357d159a675d0aca3a3ee4c
DIST PENF-1.2.2.tar.gz 143245 BLAKE2B d59353195c7502514091ad0a4dae42d9c3d5e8b383160f46e512ce42ed242539347683c5d79ae6a2093feee428af6137f6ecf8673c54ac15dc13a7029984dcf2 SHA512 12086abad9bdf552a9f41f862819a9fe6d91b18827515473f3ec36722fcd593cdb5d01a6769567dbc91238233d706ae4f2520e7767556e17b0dcb42e10999571
DIST StringiFor-1.1.1.tar.gz 80098 BLAKE2B d42774323703550355b90ce706e62356a30cb4a27a37622841c28bbff9f9504ce7da8997222f6a0bb1e5ec56894ffdd679dc1a5b2a8f8bb353580491554fbce7 SHA512 14639dbb62e2b1ccb9cdb3c8100da7da8ff7d2a06d304bce2a9e8574e52adbd2f589f0017498ce7489f4977acdc99cfc889a5a752bc8efd58da41cea104c0712

View File

@ -0,0 +1,101 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
FORTRAN_STANDARD=2003
inherit fortran-2 toolchain-funcs
# Unfortunately the releases don't have appropriate release-tags
# so there commits sha-1 checksum are used
StringiFor_sha="7f73f2682372201721f0fd670cf9c772d11b5268" # StringiFor-1.1.1 (27 jan 2020)
BeFoR64_sha="d2be41faa804c5b1b811351c5384cdb6c58ce431" # BeFoR-1.1.4 (11 sep 2019)
FACE_sha="e3700566a18e145f0f90ba6c89570b690526845b" # FACE-1.1.2 (11 sep 2019)
PENF_sha="d2b27d5652f48584b9468ebd0b11dd44b5fb1638" # PENF-1.2.2 (11 sep 2019)
DESCRIPTION="StringiFor, Strings Fortran Manipulator, yet another strings Fortran module"
HOMEPAGE="https://github.com/szaghi/StringiFor"
SRC_URI="
https://github.com/szaghi/${PN}/archive/"${StringiFor_sha}".tar.gz -> ${P}.tar.gz
https://github.com/szaghi/FACE/archive/"${FACE_sha}".tar.gz -> FACE-1.1.2.tar.gz
https://github.com/szaghi/PENF/archive/"${PENF_sha}".tar.gz -> PENF-1.2.2.tar.gz
https://github.com/szaghi/BeFoR64/archive/"${BeFoR64_sha}".tar.gz -> BeFoR64-1.1.4.tar.gz
"
S="${WORKDIR}/${PN}-${StringiFor_sha}"
# For FOSS projects: GPL-3
# For closed source/commercial projects: BSD 2-Clause, BSD 3-Clause, MIT
LICENSE="GPL-3 BSD-2 BSD MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="static-libs test"
RESTRICT="!test? ( test )"
DEPEND="dev-util/FoBiS"
PATCHES=(
"${FILESDIR}/stringifor-1.1.1_fobos_soname.patch"
"${FILESDIR}/stringifor-1.1.1_fix_tests.patch"
)
set_build_mode() {
case $(tc-getFC) in
*gfortran* )
BUILD_MODE_SHARED="-mode stringifor-shared-gnu"
BUILD_MODE_STATIC="-mode stringifor-static-gnu"
BUILD_MODE_TESTS="-mode tests-gnu" ;;
ifort )
BUILD_MODE_SHARED="-mode stringifor-shared-intel"
BUILD_MODE_STATIC="-mode stringifor-static-intel"
BUILD_MODE_TESTS="-mode tests-intel" ;;
* )
die "Sorry, GNU gfortran or Intel ifort are currently supported in the ebuild" ;;
esac
}
pkg_setup() {
fortran-2_pkg_setup
set_build_mode
}
src_prepare() {
mv -T "${WORKDIR}"/BeFoR64-"${BeFoR64_sha}" "${S}"/src/third_party/BeFoR64
mv -T "${WORKDIR}"/FACE-"${FACE_sha}" "${S}"/src/third_party/FACE
mv -T "${WORKDIR}"/PENF-"${PENF_sha}" "${S}"/src/third_party/PENF
default
if [ "${FFLAGS}" ] ; then
sed -i -e 's:\$OPTIMIZE = -O2:\$OPTIMIZE = '"${FFLAGS}"':' fobos || die
fi
}
src_compile() {
FoBiS.py build -verbose ${BUILD_MODE_SHARED}
use static-libs && FoBiS.py build -verbose ${BUILD_MODE_STATIC}
}
src_test() {
FoBiS.py build ${BUILD_MODE_TESTS}
for e in $( find ./exe/ -type f -executable -print ); do
if [ "$e" != "./exe/stringifor_test_parse_large_csv" ] ; then
echo " run test $e :" && $e
else
# The output of this test is too huge so it's cutted here
echo " run test $e :" && $e | tail -n 10
fi
done
}
src_install() {
mv lib/mod lib/stringifor
doheader -r lib/stringifor/
mv lib/libstringifor.so{,.1}
dosym libstringifor.so.1 /usr/$(get_libdir)/libstringifor.so
dolib.so lib/libstringifor.so.1
use static-libs && dolib.a lib/libstringifor.a
}

View File

@ -0,0 +1,48 @@
diff -Naur a/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 b/src/tests/stringifor/stringifor_test_csv_naive_parser.f90
--- a/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 2020-01-27 20:28:35.000000000 +0300
+++ b/src/tests/stringifor/stringifor_test_csv_naive_parser.f90 2020-04-17 03:48:42.000000000 +0300
@@ -49,8 +49,7 @@
print "(A)", 'A markdown-formatted table'
print "(A)", ''
print "(A)", '|'//csv%join(array=cells(:, 1), sep='|')//'|'
-columns = '----' ! re-use columns for printing separators
-print "(A)", '|'//csv%join(array=columns, sep='|')//'|'
+print "(A)", '|'//repeat('----|', size(columns)) ! printing separators
do r=2, rows_number
print "(A)", '|'//csv%join(array=cells(:, r), sep='|')//'|'
enddo
diff -Naur a/src/tests/stringifor/stringifor_test_parse_large_csv.f90 b/src/tests/stringifor/stringifor_test_parse_large_csv.f90
--- a/src/tests/stringifor/stringifor_test_parse_large_csv.f90 2020-01-27 20:28:35.000000000 +0300
+++ b/src/tests/stringifor/stringifor_test_parse_large_csv.f90 2020-04-17 16:23:57.000000000 +0300
@@ -30,8 +30,7 @@
print "(A)", 'A markdown-formatted table'
print "(A)", ''
print "(A)", '|'//csv%join(array=cells(:, 1), sep='|')//'|'
-columns = '----' ! re-use columns for printing separators
-print "(A)", '|'//csv%join(array=columns, sep='|')//'|'
+print "(A)", '|'//repeat('----|', size(columns)) ! printing separators
do r=2, rows_number
print "(A)", '|'//csv%join(array=cells(:, r), sep='|')//'|'
enddo
diff -Naur a/src/third_party/FACE/src/tests/face_test_ucs4.F90 b/src/third_party/FACE/src/tests/face_test_ucs4.F90
--- a/src/third_party/FACE/src/tests/face_test_ucs4.F90 2019-09-11 19:00:21.000000000 +0300
+++ b/src/third_party/FACE/src/tests/face_test_ucs4.F90 2020-04-19 15:40:35.000000000 +0300
@@ -2,9 +2,10 @@
program face_test_ucs4
!< FACE test.
use face
+use iso_fortran_env
implicit none
-#ifdef UCS4_SUPPORTED
+
character(kind=UCS4, len=:), allocatable :: string_1 !< A string.
character(kind=UCS4, len=:), allocatable :: string_2 !< A string.
character(kind=UCS4, len=:), allocatable :: string_3 !< A string.
@@ -13,5 +14,5 @@
string_2 = colorize(UCS4_' ÜÇŞ4', color_fg='red')
string_3 = colorize(' World', color_fg='blue')
print '(A)', string_1//string_2//string_3
-#endif
+
endprogram face_test_ucs4

View File

@ -0,0 +1,12 @@
diff -Nur a/fobos b/fobos
--- a/fobos 2020-01-27 20:28:35.000000000 +0300
+++ b/fobos 2020-02-18 13:45:52.000000000 +0300
@@ -7,7 +7,7 @@
[common-variables]
$CSHARED_GNU = -c -fPIC -frealloc-lhs -std=f2008 -fall-intrinsics
$CSHARED_INT = -c -fPIC -assume realloc_lhs -standard-semantics -std08
-$LSHARED = -shared
+$LSHARED = -shared -Wl,-soname=libstringifor.so.1
$CSTATIC_GNU = -c -frealloc-lhs -std=f2008 -fall-intrinsics
$CSTATIC_INT = -c -assume realloc_lhs -standard-semantics -std08
$DEBUG_GNU = -Og -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<!-- maintainer needed -->
<longdescription>
A KISS pure Fortran library providing astrings (class) manipulator for modern (2003+) Fortran projects
</longdescription>
<upstream>
<remote-id type="github">szaghi/StringiFor</remote-id>
</upstream>
</pkgmetadata>