diff options
author | Remi Collet <remi@remirepo.net> | 2019-09-16 14:10:46 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-09-16 14:10:46 +0200 |
commit | ed118e254bde4c6321c41fb1f5ad574f75b815e7 (patch) | |
tree | e9073b0a76f85fafcb0b42c3701f10885f159525 |
new package
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 51 | ||||
-rwxr-xr-x | makesrc.sh | 28 | ||||
-rw-r--r-- | php-scssphp-scssphp-rpm.patch | 12 | ||||
-rw-r--r-- | php-scssphp-scssphp.spec | 161 |
6 files changed, 264 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../common/Makefile + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..884ddb6 --- /dev/null +++ b/composer.json @@ -0,0 +1,51 @@ +{ + "name": "scssphp/scssphp", + "type": "library", + "description": "scssphp is a compiler for SCSS written in PHP.", + "keywords": ["css", "stylesheet", "scss", "sass", "less"], + "homepage": "http://scssphp.github.io/scssphp/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthon Pang", + "email": "apang@softwaredevelopment.ca", + "homepage": "https://github.com/robocoder" + }, + { + "name": "Cédric Morin", + "email": "cedric@yterium.com", + "homepage": "https://github.com/Cerdic" + } + ], + "autoload": { + "psr-4": { "ScssPhp\\ScssPhp\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "ScssPhp\\ScssPhp\\Tests\\": "tests/" } + }, + "require": { + "php": ">=5.6.0", + "ext-json": "*", + "ext-ctype": "*" + }, + "require-dev": { + "squizlabs/php_codesniffer": "~2.5", + "phpunit/phpunit": ">=4.8.36", + "twbs/bootstrap": "~4.3", + "zurb/foundation": "~6.5" + }, + "minimum-stability": "dev", + "bin": ["bin/pscss"], + "archive": { + "exclude": [ + "/Makefile", + "/.gitattributes", + "/.gitignore", + "/.travis.yml", + "/phpunit.xml.dist", + "/tests" + ] + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..7d752c6 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n" + +echo "Cloning..." +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." + diff --git a/php-scssphp-scssphp-rpm.patch b/php-scssphp-scssphp-rpm.patch new file mode 100644 index 0000000..ff150c7 --- /dev/null +++ b/php-scssphp-scssphp-rpm.patch @@ -0,0 +1,12 @@ +diff -up ./bin/pscss.rpm ./bin/pscss +--- ./bin/pscss.rpm 2019-09-16 13:42:28.627488779 +0200 ++++ ./bin/pscss 2019-09-16 13:42:36.072460508 +0200 +@@ -16,7 +16,7 @@ if (version_compare(PHP_VERSION, '5.6') + die('Requires PHP 5.6 or above'); + } + +-include __DIR__ . '/../scss.inc.php'; ++include '/usr/share/php/ScssPhp/ScssPhp/autoload.php'; + + use ScssPhp\ScssPhp\Compiler; + use ScssPhp\ScssPhp\Parser; 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 |