File tailwind-oxide.spec of Package tailwind-oxide

#
# spec file for package tailwind-oxide
#
# Copyright (c) 2025 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#




%global __provides_exclude ^lib.*\\.so.*$


Name:           tailwind-oxide
Version:        4.1.7
Release:        0
Summary:        Build tooling for tailwind JS (do not install or use)
License:        (Apache-2.0 OR MIT) AND (Apache-2.0 OR CC0-1.0 OR MIT) AND MIT AND (MIT OR Unlicense) AND MPL-2.0
Group:          Development/Languages/NodeJS
Url:            https://github.com/tailwindlabs/tailwindcss
#
Source0:        https://github.com/tailwindlabs/tailwindcss/archive/refs/tags/v%{version}.tar.gz
Source1:        vendor.tar.zst
Source999:      prepare_vendor.sh



#
BuildRequires:  cargo
%if 0%{?fedora}
BuildRequires:  rust-srpm-macros
%else
BuildRequires:  cargo-packaging >= 1.2.0+3
BuildRequires:  cargo-auditable
%endif
#For tests
BuildRequires:  git-core
BuildRequires:  zstd
#




%description
NodeJS native module for tailwind builds.
This is intended for building signal-desktop and is of no use to the end user.

%prep
%autosetup -p1 -a1 -n tailwindcss-%version



%build

export CC=gcc
export CXX=g++
export AR=gcc-ar
export NM=gcc-nm
export RANLIB=gcc-ranlib
%if 0%{?suse_version} && 0%{?suse_version} <= 1500
export CC=gcc-13
export CXX=g++-13
export AR=gcc-ar-13
export NM=gcc-nm-13
export RANLIB=gcc-ranlib-13
#/suse_version <= 1500
%endif

export RUSTFLAGS="%{build_rustflags} --verbose"
export RUSTC_LOG='rustc_codegen_ssa::back::link=info'
export RUST_BACKTRACE=1
export CARGO_TERM_VERBOSE=true
# https://github.com/Firstyear/cargo-packaging/pull/10
export CARGO_INCREMENTAL=0

%if 0%{?suse_version}
auditable='auditable -vv'
%endif


export RUSTC_BOOTSTRAP=1

export CFLAGS="%{optflags} -fpic -fno-semantic-interposition -fno-fat-lto-objects -fvisibility=hidden"
export CXXFLAGS="%{optflags} -fpic -fno-semantic-interposition -fno-fat-lto-objects -fvisibility=hidden"
export MAKEFLAGS="%{_smp_mflags}"

export LDFLAGS="%{?build_ldflags}"

cargo -vv $auditable rustc --package tailwind-oxide --lib --offline --release --crate-type cdylib

%install
install -pvDm755 target/release/libtailwind_oxide.so \
%{buildroot}%{_libdir}/tailwind_oxide.node

%check

#detect underlinking — compare electron_check_native macro 
! ldd -d -r %{buildroot}%{_libdir}/tailwind_oxide.node | \
    grep    '^undefined symbol' | \
    grep -v '^undefined symbol: napi_' | \
    grep -v '^undefined symbol: uv_'

export CC=gcc
export CXX=g++
export AR=gcc-ar
export NM=gcc-nm
export RANLIB=gcc-ranlib
%if 0%{?suse_version} && 0%{?suse_version} <= 1500
export CC=gcc-13
export CXX=g++-13
export AR=gcc-ar-13
export NM=gcc-nm-13
export RANLIB=gcc-ranlib-13
%endif
export RUSTFLAGS="%{build_rustflags} --verbose"
export RUSTC_LOG='rustc_codegen_ssa::back::link=info'
export RUST_BACKTRACE=1
export CARGO_TERM_VERBOSE=true
export CARGO_INCREMENTAL=0
%if 0%{?suse_version}
auditable='auditable -vv'
%endif
export RUSTC_BOOTSTRAP=1
export CFLAGS="%{optflags} -fpic -fno-semantic-interposition -fno-fat-lto-objects -fvisibility=hidden"
export CXXFLAGS="%{optflags} -fpic -fno-semantic-interposition -fno-fat-lto-objects -fvisibility=hidden"
export MAKEFLAGS="%{_smp_mflags}"
export LDFLAGS="%{?build_ldflags}"

cargo -vv $auditable test --release --no-fail-fast --workspace

%files
%defattr(-,root,root)
%license LICENSE
%{_libdir}/tailwind_oxide.node

%changelog
openSUSE Build Service is sponsored by