From ed118e254bde4c6321c41fb1f5ad574f75b815e7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 16 Sep 2019 14:10:46 +0200 Subject: new package --- php-scssphp-scssphp.spec | 161 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 php-scssphp-scssphp.spec (limited to 'php-scssphp-scssphp.spec') diff --git a/php-scssphp-scssphp.spec b/php-scssphp-scssphp.spec new file mode 100644 index 0000000..8aabc5f --- /dev/null +++ b/php-scssphp-scssphp.spec @@ -0,0 +1,161 @@ +# remirepo/fedora spec file for php-scssphp-scssphp +# +# Copyright (c) 2019 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +# For compatibility with SCL +#undefine __brp_mangle_shebangs + +%global with_tests 0%{!?_without_tests:1} +# Github +%global gh_commit 7c292c66db52ede3afbfd6566c8872f3c5b32267 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner scssphp +%global gh_project scssphp +# Packagist +%global pk_vendor %{gh_owner} +%global pk_project %{gh_project} +# Namespace +%global ns_vendor ScssPhp +%global ns_project ScssPhp +%global major %nil + +Name: php-%{pk_vendor}-%{pk_project}%{major} +Version: 1.0.4 +Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist} +Summary: Compiler for SCSS written + +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: %{name}-%{version}-%{?gh_short}.tgz +# Create a git snapshot with test suite +Source1: makesrc.sh + +# Use our autoloader +Patch0: %{name}-rpm.patch + +BuildArch: noarch +BuildRequires: php(language) >= 5.6.0 +BuildRequires: php-cli +%if %{with_tests} +BuildRequires: php-ctype +BuildRequires: php-date +BuildRequires: php-json +BuildRequires: php-mbstring +BuildRequires: php-pcre +BuildRequires: php-spl +# For tests, from composer.json "require-dev": { +# "squizlabs/php_codesniffer": "~2.5", +# "phpunit/phpunit": ">=4.8.36", +# "twbs/bootstrap": "~4.3", +# "zurb/foundation": "~6.5" +# remirepo:1 +%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8 +BuildRequires: phpunit8 +%global phpunit %{_bindir}/phpunit8 +# remirepo:4 +%else +BuildRequires: php-composer(phpunit/phpunit) >= 4.8.36 +%global phpunit %{_bindir}/phpunit +%endif +%endif +# For autoloader +BuildRequires: php-fedora-autoloader-devel + +# From composer.json, "require": { +# "php": ">=5.6.0", +# "ext-json": "*", +# "ext-ctype": "*" +Requires: php(language) >= 5.6.0 +Requires: php-cli +Requires: php-ctype +Requires: php-json +# From phpcompatinfo report for 1.0.4 +Requires: php-date +Requires: php-mbstring +Requires: php-pcre +Requires: php-spl +# For generated autoloader +Requires: php-composer(fedora/autoloader) + +# Composer +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} + + +%description +%{name} is a compiler for SCSS written in PHP. + +Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 -b .rpm + +mv LICENSE.md LICENSE + + +%build +: Create autoloader +%{_bindir}/phpab -t fedora -o src/autoload.php src + + +%install +: Library +mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor} +cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major} + +: Command +mkdir -p %{buildroot}%{_bindir} +install -pm 0755 bin/pscss %{buildroot}%{_bindir}/%{name} + + +%check +php -r ' + require "%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php"; + printf("Project version: %s\n", ScssPhp\ScssPhp\Version::VERSION); + exit(ScssPhp\ScssPhp\Version::VERSION === "v%{version}" ? 0 : 1); +' + +%if %{with_tests} +mkdir -p vendor/composer/ +cat << 'EOF' | tee vendor/composer/autoload_real.php + - 1.0.4-1 +- initial package -- cgit