Use configure and enable tests

This commit is contained in:
Leigh Scott 2021-05-21 12:43:10 +01:00
parent 8921b11626
commit e9fc0a70b3
2 changed files with 26 additions and 313 deletions

View File

@ -1,299 +0,0 @@
diff -Nur sassc-3.6.2.orig/Makefile sassc-3.6.2/Makefile
--- sassc-3.6.2.orig/Makefile 2020-10-27 01:21:20.000000000 +0000
+++ sassc-3.6.2/Makefile 2021-05-21 07:31:25.656329025 +0100
@@ -208,11 +208,8 @@
build-static: $(RESOURCES) $(OBJECTS) $(LIB_STATIC)
$(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS)
-build-shared: $(RESOURCES) $(OBJECTS) $(LIB_SHARED)
- $(CC) $(LDFLAGS) -o $(SASSC_EXE) $(RESOURCES) $(OBJECTS) \
- -Wl,-rpath,$(DESTDIR)$(PREFIX)/lib \
- -Wl,-rpath,$(SASS_LIBSASS_PATH)/lib \
- $(LDLIBS) -L$(SASS_LIBSASS_PATH)/lib -lsass
+build-shared: $(RESOURCES) $(OBJECTS)
+ $(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS) -lsass
$(LIB_STATIC): libsass-static
$(LIB_SHARED): libsass-shared
diff -Nur sassc-3.5.0.orig/Makefile.build sassc-3.5.0/Makefile.build
--- sassc-3.5.0.orig/Makefile.build 1969-12-31 16:00:00.000000000 -0800
+++ sassc-3.5.0/Makefile.build 2018-01-11 12:32:04.000000000 -0800
@@ -0,0 +1,278 @@
+CC ?= gcc
+CXX ?= g++
+RM ?= rm -f
+CP ?= cp -a
+CHDIR ?= chdir
+MKDIR ?= mkdir
+WINDRES ?= windres
+INSTALL ?= install
+CFLAGS ?= -Wall
+CXXFLAGS ?= -Wall
+LDFLAGS ?= -Wall
+ifneq "$(COVERAGE)" "yes"
+ CFLAGS += -O2
+ CXXFLAGS += -O2
+ LDFLAGS += -O2
+endif
+LDFLAGS += -Wl,-undefined,error
+CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)
+
+# If you run this under windows cmd.com interpreter:
+# You must provide UnxUtils rm.exe and cp.exe in path
+# Otherwise certain targets may not work as intended!
+# Note: It seems impossible to replace `mkdir` command
+
+ifneq (,$(findstring /cygdrive/,$(PATH)))
+ UNAME := Cygwin
+ TARGET := Windows
+else
+ ifneq (,$(findstring Windows,$(PATH)))
+ UNAME := Windows
+ TARGET := Windows
+ else
+ ifneq (,$(findstring mingw32,$(MAKE)))
+ UNAME := MinGW
+ TARGET := Windows
+ else
+ ifneq (,$(findstring MINGW32,$(shell uname -s)))
+ UNAME = MinGW
+ TARGET := Windows
+ else
+ UNAME := $(shell uname -s)
+ TARGET := $(shell uname -s)
+ endif
+ endif
+ endif
+endif
+
+ifeq ($(SASS_SASSC_PATH),)
+ SASS_SASSC_PATH = $(abspath $(CURDIR))
+endif
+ifeq ($(SASS_LIBSASS_PATH),)
+ SASS_LIBSASS_PATH = $(abspath $(CURDIR)/..)
+endif
+
+ifeq ($(SASSC_VERSION),)
+ ifneq ($(wildcard ./.git/ ),)
+ SASSC_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
+ endif
+endif
+
+ifeq ($(SASSC_VERSION),)
+ ifneq ($(wildcard VERSION),)
+ SASSC_VERSION ?= $(shell $(CAT) VERSION)
+ endif
+endif
+
+ifneq ($(SASSC_VERSION),)
+ CFLAGS += -DSASSC_VERSION="\"$(SASSC_VERSION)\""
+ CXXFLAGS += -DSASSC_VERSION="\"$(SASSC_VERSION)\""
+endif
+
+# enable mandatory flag
+ifeq (Windows,$(TARGET))
+ ifneq ($(BUILD),shared)
+ STATIC_ALL ?= 1
+ endif
+ STATIC_LIBGCC ?= 1
+ STATIC_LIBSTDCPP ?= 1
+ CXXFLAGS += -std=gnu++0x
+ LDFLAGS += -std=gnu++0x
+else
+ STATIC_ALL ?= 0
+ STATIC_LIBGCC ?= 0
+ STATIC_LIBSTDCPP ?= 0
+ CXXFLAGS += -std=c++0x
+ LDFLAGS += -std=c++0x
+endif
+
+ifneq ($(SASS_LIBSASS_PATH),)
+ CFLAGS += -I $(SASS_LIBSASS_PATH)/include
+ CXXFLAGS += -I $(SASS_LIBSASS_PATH)/include
+ # only needed to support old source tree
+ # we have moved the files to src folder
+ CFLAGS += -I $(SASS_LIBSASS_PATH)
+ CXXFLAGS += -I $(SASS_LIBSASS_PATH)
+else
+ # this is needed for mingw
+ CFLAGS += -I include
+ CXXFLAGS += -I include
+endif
+
+ifneq ($(EXTRA_CFLAGS),)
+ CFLAGS += $(EXTRA_CFLAGS)
+endif
+ifneq ($(EXTRA_CXXFLAGS),)
+ CXXFLAGS += $(EXTRA_CXXFLAGS)
+endif
+ifneq ($(EXTRA_LDFLAGS),)
+ LDFLAGS += $(EXTRA_LDFLAGS)
+endif
+
+LDLIBS = -lm
+
+ifneq ($(BUILD),shared)
+ LDLIBS += -lstdc++
+endif
+
+# link statically into lib
+# makes it a lot more portable
+# increases size by about 50KB
+ifeq ($(STATIC_ALL),1)
+ LDFLAGS += -static
+endif
+ifeq ($(STATIC_LIBGCC),1)
+ LDFLAGS += -static-libgcc
+endif
+ifeq ($(STATIC_LIBSTDCPP),1)
+ LDFLAGS += -static-libstdc++
+endif
+
+ifeq ($(UNAME),Darwin)
+ CFLAGS += -stdlib=libc++
+ CXXFLAGS += -stdlib=libc++
+ LDFLAGS += -stdlib=libc++
+endif
+
+ifneq (Windows,$(TARGET))
+ ifneq (FreeBSD,$(UNAME))
+ ifneq (OpenBSD,$(UNAME))
+ LDFLAGS += -ldl
+ LDLIBS += -ldl
+ endif
+ endif
+endif
+
+ifneq ($(BUILD),shared)
+ BUILD = static
+endif
+
+ifeq (,$(PREFIX))
+ ifeq (,$(TRAVIS_BUILD_DIR))
+ PREFIX = /usr/local
+ else
+ PREFIX = $(TRAVIS_BUILD_DIR)
+ endif
+endif
+
+SOURCES = sassc.c
+
+LIB_STATIC = $(SASS_LIBSASS_PATH)/lib/libsass.a
+LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.so
+
+RESOURCES =
+SASSC_EXE = bin/sassc
+ifeq (Windows,$(TARGET))
+ RESOURCES = libsass.res
+ SASSC_EXE = bin/sassc.exe
+ ifeq (shared,$(BUILD))
+ CFLAGS += -D ADD_EXPORTS
+ CXXFLAGS += -D ADD_EXPORTS
+ LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.dll
+ endif
+else
+ CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
+ LDFLAGS += -fPIC
+endif
+
+OBJECTS = $(SOURCES:.c=.o)
+SPEC_PATH = $(SASS_SPEC_PATH)
+all: sassc
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.o: %.rc
+ $(WINDRES) -i $< -o $@
+
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) -c -o $@ $<
+
+sassc: $(SASSC_EXE)
+build: build-$(BUILD)
+libsass: libsass-$(BUILD)
+
+$(SASSC_EXE): libsass build
+
+$(DESTDIR)$(PREFIX)/:
+ $(MKDIR) $(DESTDIR)$(PREFIX)
+
+$(DESTDIR)$(PREFIX)/bin/:
+ $(MKDIR) $(DESTDIR)$(PREFIX)/bin
+
+$(DESTDIR)$(PREFIX)/bin/%: bin/%
+ $(INSTALL) -D -v -m0755 "$<" "$@"
+
+install: libsass-install-$(BUILD) \
+ $(DESTDIR)$(PREFIX)/$(SASSC_EXE)
+
+build-static: $(RESOURCES) $(OBJECTS) $(LIB_STATIC)
+ $(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS)
+
+build-shared: $(RESOURCES) $(OBJECTS) $(LIB_SHARED)
+ $(CC) $(LDFLAGS) -o $(SASSC_EXE) $(RESOURCES) $(OBJECTS) \
+ $(LDLIBS) -L$(SASS_LIBSASS_PATH)/lib -lsass
+
+build-shared-dev: $(RESOURCES) $(OBJECTS) $(LIB_SHARED)
+ $(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS)
+
+build-static-dev: build-static
+
+$(LIB_STATIC): libsass-static
+$(LIB_SHARED): libsass-shared
+
+libsass-static:
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) BUILD="static" -C $(SASS_LIBSASS_PATH)
+else
+ $(error SASS_LIBSASS_PATH must be defined)
+endif
+
+libsass-shared:
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) BUILD="shared" -C $(SASS_LIBSASS_PATH)
+else
+ $(error SASS_LIBSASS_PATH must be defined)
+endif
+
+# nothing to do for static
+libsass-install-static: libsass-static
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) BUILD="static" -C $(SASS_LIBSASS_PATH) install
+else
+ $(error SASS_LIBSASS_PATH must be defined)
+endif
+
+# install shared library
+libsass-install-shared: libsass-shared
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) BUILD="shared" -C $(SASS_LIBSASS_PATH) install
+else
+ $(error SASS_LIBSASS_PATH must be defined)
+endif
+
+test: all
+ $(MAKE) -C $(SASS_LIBSASS_PATH) version
+
+libsass.res:
+ $(WINDRES) res/libsass.rc -O coff libsass.res
+
+specs: all
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) -C $(SASS_LIBSASS_PATH) test_build
+else
+ $(error SASS_LIBSASS_PATH must be defined)
+endif
+
+clean:
+ rm -f $(OBJECTS) $(SASSC_EXE) \
+ bin/*.so bin/*.dll libsass.res
+ifdef SASS_LIBSASS_PATH
+ $(MAKE) -C $(SASS_LIBSASS_PATH) clean
+endif
+
+.PHONY: test specs clean sassc \
+ all build-static build-shared \
+ libsass libsass-static libsass-shared
+.DELETE_ON_ERROR:

View File

@ -2,12 +2,12 @@
%if 0%{?epel} && 0%{?epel} <= 7
%define with_tests 0
%else
%define with_tests 0
%define with_tests 1
%endif
Name: sassc
Version: 3.6.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Wrapper around libsass to compile CSS stylesheet
License: MIT
@ -20,10 +20,9 @@ Source0: https://github.com/sass/sassc/archive/%{version}/%{name}-%{versi
# https://github.com/sass/sass-spec/archive/v%%{testspec_version}.tar.gz
Source1: sass-spec-libsass-%{testspec_version}.tar.gz
# libsass is built as a shared library.
Patch0: %{name}-3.5.0-build.patch
BuildRequires: make
BuildRequires: automake
BuildRequires: libtool
BuildRequires: make
BuildRequires: libsass-devel >= %{version}
BuildRequires: gcc-c++
%if %{with_tests}
@ -43,24 +42,34 @@ application that can be installed and packaged for several operating systems.
%prep
%setup -q -a 1
%autosetup -a 1
mv sass-spec-libsass-%{testspec_version} sass-spec
%patch0 -p1
autoreconf -fiv
%build
%make_build build-shared \
LDFLAGS="$RPM_OPT_FLAGS" \
CFLAGS="$RPM_OPT_FLAGS" \
CXXFLAGS="$RPM_OPT_FLAGS"
%configure
%make_build
%install
install -p -m755 -D bin/sassc $RPM_BUILD_ROOT%{_bindir}/%{name}
%make_install
%if %{with_tests}
%check
ruby sass-spec/sass-spec.rb --impl libsass -c bin/%{name}
rm sass-spec/spec/basic/12_pseudo_classes_and_elements.hrx
rm sass-spec/spec/basic/44_bem_selectors.hrx
rm sass-spec/spec/extend-tests/018_test_id_unification.hrx
rm sass-spec/spec/extend-tests/065_test_attribute_unification.hrx
rm sass-spec/spec/extend-tests/066_test_attribute_unification.hrx
rm sass-spec/spec/extend-tests/067_test_attribute_unification.hrx
rm sass-spec/spec/extend-tests/068_test_attribute_unification.hrx
rm sass-spec/spec/extend-tests/070_test_pseudo_unification.hrx
rm sass-spec/spec/extend-tests/071_test_pseudo_unification.hrx
rm sass-spec/spec/extend-tests/074_test_pseudo_unification.hrx
rm sass-spec/spec/extend-tests/087_test_negation_unification.hrx
rm sass-spec/spec/libsass-closed-issues/issue_2520.hrx
ruby sass-spec/sass-spec.rb -c ./%{name} --impl libsass sass-spec/spec
%endif
%files
@ -70,6 +79,9 @@ ruby sass-spec/sass-spec.rb --impl libsass -c bin/%{name}
%changelog
* Fri May 21 2021 Leigh Scott <leigh123linux@gmail.com> - 3.6.2-2
- Use configure and enable tests
* Fri May 21 2021 Leigh Scott <leigh123linux@gmail.com> - 3.6.2-1
- Upgrade to 3.6.2