summaryrefslogtreecommitdiffstats
path: root/php-scssphp-scssphp.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-scssphp-scssphp.spec')
-rw-r--r--php-scssphp-scssphp.spec161
1 files changed, 161 insertions, 0 deletions
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
+<?php
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', dirname(__DIR__).'/tests');
+EOF
+
+: Ignore tests for non-packaged frameworks
+rm tests/FrameworkTest.php
+
+ret=0
+for cmdarg in "php %{phpunit}" "php71 %{_bindir}/phpunit7" php72 php73 php74; do
+ if which $cmdarg; then
+ set $cmdarg
+ $1 ${2:-%{_bindir}/phpunit8} --no-coverage --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+# remirepo:1
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc *.md
+%{_bindir}/%{name}
+%dir %{_datadir}/php/%{ns_vendor}
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%changelog
+* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 1.0.4-1
+- initial package