summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-06-05 10:03:04 +0800
committerGitHub <[email protected]>2023-06-05 10:03:04 +0800
commit01d9cc1646c628f8435615b2ad151f93edecf707 (patch)
treebe2183ee748f3bf65ee95060dee2620871ed5fe4
parent9d86054a09b6697b5490cd373848f030e6194eb0 (diff)
parent4e53ce544879e99994eaaf50c16e8a214b1fc51e (diff)
Merge pull request #3809 from mcha-forks/master
scripts/rpmbuild: refactor specfile for Fedora
-rw-r--r--.gitignore6
-rw-r--r--scripts/rpmbuild/0001-use-static-libsv-and-tbox.patch27
-rw-r--r--scripts/rpmbuild/0002-pkgconfig-unversioned-lua.patch15
-rw-r--r--scripts/rpmbuild/SPECS/xmake.spec107
-rw-r--r--scripts/rpmbuild/xmake.spec114
5 files changed, 156 insertions, 113 deletions
diff --git a/.gitignore b/.gitignore
index 19d13c928..7d64db33b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,12 +44,6 @@ compile_commands.json
# for fortran
/tests/**/*.mod
-# for rpmbuild
-/scripts/rpmbuild/BUILD*/*
-/scripts/rpmbuild/RPMS/*
-/scripts/rpmbuild/SOURCES/*
-/scripts/rpmbuild/SRPMS/*
-
!/xmake/actions/build/
# for linux driver
diff --git a/scripts/rpmbuild/0001-use-static-libsv-and-tbox.patch b/scripts/rpmbuild/0001-use-static-libsv-and-tbox.patch
new file mode 100644
index 000000000..3ce8ba97a
--- /dev/null
+++ b/scripts/rpmbuild/0001-use-static-libsv-and-tbox.patch
@@ -0,0 +1,27 @@
+diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh
+index dc45ecbca..d0e0d0069 100755
+--- a/core/src/xmake/xmake.sh
++++ b/core/src/xmake/xmake.sh
+@@ -6,6 +6,8 @@ target "xmake"
+
+ # add deps
+ if has_config "external"; then
++ add_deps "sv"
++ add_deps "tbox"
+ local libs="lz4 sv tbox"
+ for lib in $libs; do
+ if has_config "$lib"; then
+diff --git a/core/xmake.sh b/core/xmake.sh
+index 2ae2e686b..6ea8c1b69 100755
+--- a/core/xmake.sh
++++ b/core/xmake.sh
+@@ -214,6 +214,9 @@ if ! has_config "external"; then
+ includes "src/lz4"
+ includes "src/sv"
+ includes "src/tbox"
++else
++ includes "src/sv"
++ includes "src/tbox"
+ fi
+ includes "src/xmake"
+ includes "src/demo"
diff --git a/scripts/rpmbuild/0002-pkgconfig-unversioned-lua.patch b/scripts/rpmbuild/0002-pkgconfig-unversioned-lua.patch
new file mode 100644
index 000000000..4ff14000f
--- /dev/null
+++ b/scripts/rpmbuild/0002-pkgconfig-unversioned-lua.patch
@@ -0,0 +1,15 @@
+diff --git a/core/xmake.sh b/core/xmake.sh
+index 2ae2e686b..2b7767b0c 100755
+--- a/core/xmake.sh
++++ b/core/xmake.sh
+@@ -91,8 +91,8 @@ option_find_lua() {
+ local ldflags=""
+ local cflags=""
+ option "lua"
+- cflags=`pkg-config --cflags lua5.4 2>/dev/null`
+- ldflags=`pkg-config --libs lua5.4 2>/dev/null`
++ cflags=`pkg-config --cflags lua 2>/dev/null`
++ ldflags=`pkg-config --libs lua 2>/dev/null`
+ if test_z "${cflags}"; then
+ cflags="-I/usr/include/lua5.4"
+ fi
diff --git a/scripts/rpmbuild/SPECS/xmake.spec b/scripts/rpmbuild/SPECS/xmake.spec
deleted file mode 100644
index aad6f0c4f..000000000
--- a/scripts/rpmbuild/SPECS/xmake.spec
+++ /dev/null
@@ -1,107 +0,0 @@
-%define xmake_revision c879226767b810186714264d76bc0b55f127f034
-%define tbox_revision 23fb0c033b30f9909efa62f8cfee7cee8d5a8dcc
-%define sv_revision 10ee6a807466a5e61309201caea360a113ad3862
-%define lua_cjson_revision ddcecf3b24b71421e7b4a2962f1fbcc0297e0c1e
-%define luajit_revision e9af1abec542e6f9851ff2368e7f196b6382a44c
-%define lua_revision eadd8c7178c79c814ecca9652973a9b9dd4cc71b
-%define lz4_revision 033606ef259ef2852f6ae1e8ec7a10c641417654
-%define _binaries_in_noarch_packages_terminate_build 0
-%undefine _disable_source_fetch
-
-Name: xmake
-Version: 2.7.9
-Release: 1%{?dist}
-Summary: A cross-platform build utility based on Lua
-BuildArch: noarch
-License: ASL 2.0
-URL: https://xmake.io
-Source0: https://github.com/xmake-io/xmake/archive/%{xmake_revision}.tar.gz#/xmake-%{xmake_revision}.tar.gz
-Source1: https://github.com/tboox/tbox/archive/%{tbox_revision}.tar.gz#/tbox-%{tbox_revision}.tar.gz
-Source2: https://github.com/xmake-io/xmake-core-lua/archive/%{lua_revision}.tar.gz#/xmake-core-lua-%{lua_revision}.tar.gz
-Source3: https://github.com/xmake-io/xmake-core-luajit/archive/%{luajit_revision}.tar.gz#/xmake-core-luajit-%{luajit_revision}.tar.gz
-Source4: https://github.com/xmake-io/xmake-core-sv/archive/%{sv_revision}.tar.gz#/xmake-core-sv-%{sv_revision}.tar.gz
-Source5: https://github.com/xmake-io/xmake-core-lua-cjson/archive/%{lua_cjson_revision}.tar.gz#/xmake-core-lua-cjson-%{lua_cjson_revision}.tar.gz
-Source6: https://github.com/xmake-io/xmake-core-lz4/archive/%{lz4_revision}.tar.gz#/xmake-core-lz4-%{lz4_revision}.tar.gz
-
-BuildRequires: gcc-c++
-BuildRequires: ncurses-devel
-BuildRequires: readline-devel
-
-%description
-xmake is a lightweight cross-platform build utility based on Lua.
-
-It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt,
-the configuration syntax is more concise and intuitive.
-It is very friendly to novices and can quickly get started in a short time.
-Let users focus more on actual project development.
-
-It can compile the project directly like Make/Ninja, or
-generate project files like CMake/Meson, and it also has a built-in package management
-system to help users solve the integrated use of C/C++ dependent libraries.
-
-%prep
-%setup -q -T -b 1 -n tbox-%{tbox_revision}
-cd ..
-%setup -q -T -b 2 -n xmake-core-lua-%{lua_revision}
-cd ..
-%setup -q -T -b 3 -n xmake-core-luajit-%{luajit_revision}
-cd ..
-%setup -q -T -b 4 -n xmake-core-sv-%{sv_revision}
-cd ..
-%setup -q -T -b 5 -n xmake-core-lua-cjson-%{lua_cjson_revision}
-cd ..
-%setup -q -T -b 6 -n xmake-core-lz4-%{lz4_revision}
-cd ..
-%setup -q -T -b 0 -n xmake-%{xmake_revision}
-rm -rf core/src/sv/sv
-rm -rf core/src/tbox/tbox
-rm -rf core/src/lua/lua
-rm -rf core/src/luajit/luajit
-rm -rf core/src/lua-cjson/lua-cjson
-rm -rf core/src/lz4/lz4
-ln -s `pwd`/../tbox-%{tbox_revision} core/src/tbox/tbox
-ln -s `pwd`/../xmake-core-sv-%{sv_revision} core/src/sv/sv
-ln -s `pwd`/../xmake-core-lua-%{lua_revision} core/src/lua/lua
-ln -s `pwd`/../xmake-core-luajit-%{luajit_revision} core/src/luajit/luajit
-ln -s `pwd`/../xmake-core-lua-cjson-%{lua_cjson_revision} core/src/lua-cjson/lua-cjson
-ln -s `pwd`/../xmake-core-lz4-%{lz4_revision} core/src/lz4/lz4
-
-%build
-%if 0%{?suse_version} && 0%{?suse_version} < 1550
-export CFLAGS="%{optflags}"
-export CXXFLAGS="%{optflags}"
-%else
-%set_build_flags
-%endif
-./configure
-%make_build
-
-%install
-mkdir -p %{buildroot}%{_bindir}
-mkdir -p %{buildroot}%{_datadir}
-cp -p -r xmake %{buildroot}%{_datadir}/%{name}
-cp -p build/xmake %{buildroot}%{_bindir}/%{name}
-chmod 755 %{buildroot}%{_bindir}/%{name}
-cp -p README.md %{buildroot}%{_datadir}
-cp -p LICENSE.md %{buildroot}%{_datadir}
-cp -p scripts/xrepo.sh %{buildroot}%{_bindir}/xrepo
-chmod 755 %{buildroot}%{_bindir}/xrepo
-
-%check
-%{buildroot}%{_bindir}/%{name} --version
-%{buildroot}%{_bindir}/xrepo --version
-
-%files
-%{_bindir}/%{name}
-%{_bindir}/xrepo
-%{_datadir}/%{name}
-%doc %{_datadir}/README.md
-%license %{_datadir}/LICENSE.md
-
-%changelog
-* Sun Oct 18 2020 Ruki Wang <[email protected]> - 2.3.8-1
-- v2.3.8 released
-
-* Mon Sep 14 2020 Ruki Wang <[email protected]> - 2.3.7-1
-- Initial Commit
-
diff --git a/scripts/rpmbuild/xmake.spec b/scripts/rpmbuild/xmake.spec
new file mode 100644
index 000000000..dd4f3b1af
--- /dev/null
+++ b/scripts/rpmbuild/xmake.spec
@@ -0,0 +1,114 @@
+%global debug_package %{nil}
+%define use_luajit 0
+
+Name: xmake
+Version: 2.7.9
+Release: 1%{?dist}
+Summary: A cross-platform build utility based on Lua
+
+# Application and 3rd-party modules licensing:
+# * xmake - Apache-2.0 -- Main tarball;
+# * libsv - Public Domain -- static dependency;
+# * tbox - Apache-2.0 -- static dependency;
+# * xxHash - BSD -- static dependency;
+
+License: Apache-2.0 AND LicenseRef-Fedora-Public-Domain AND BSD
+URL: https://xmake.io
+Source0: https://github.com/xmake-io/xmake/releases/download/v%{version}/%{name}-v%{version}.tar.gz
+Patch0: 0001-use-static-libsv-and-tbox.patch
+Patch1: 0002-pkgconfig-unversioned-lua.patch
+
+BuildRequires: pkgconfig(ncurses)
+BuildRequires: pkgconfig(liblz4)
+%if %{use_luajit}
+BuildRequires: pkgconfig(luajit)
+%else
+BuildRequires: pkgconfig(lua) >= 5.4
+%endif
+
+BuildRequires: gcc
+BuildRequires: gcc-c++
+
+# Virtual provides for bundled libraries
+Provides: bundled(libsv) = 0.0.1
+Provides: bundled(libtbox) = 1.7.3
+
+%description
+xmake is a lightweight cross-platform build utility based on Lua.
+
+It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt,
+the configuration syntax is more concise and intuitive.
+It is very friendly to novices and can quickly get started in a short time.
+Let users focus more on actual project development.
+
+It can compile the project directly like Make/Ninja, or
+generate project files like CMake/Meson, and it also has a built-in package management
+system to help users solve the integrated use of C/C++ dependent libraries.
+
+%prep
+%autosetup -n %{name}-%{version} -p1
+
+# Cleanup bundled deps
+rm -rf core/src/{lua,luajit,lua-cjson,lz4,pdcurses}/*/
+
+%build
+%set_build_flags
+./configure --external=yes \
+ --prefix=%{_prefix} \
+ --bindir=%{_bindir} \
+ --libdir=%{_libdir} \
+ --includedir=%{_includedir} \
+%if %{use_luajit}
+ --runtime=luajit
+%else
+ --runtime=lua
+%endif
+
+%make_build
+
+%install
+
+mkdir -p %{buildroot}%{_mandir}/man1/
+install -Dpm0755 build/xmake \
+ %{buildroot}%{_bindir}/%{name}
+install -Dpm0755 scripts/xrepo.sh \
+ %{buildroot}%{_bindir}/xrepo
+install -Dpm0644 scripts/man/*1 \
+ %{buildroot}%{_mandir}/man1/
+install -Dpm0644 xmake/scripts/completions/register-completions.bash \
+ %{buildroot}%{_datadir}/bash-completion/completions/xmake
+install -Dpm0644 xmake/scripts/completions/register-completions.fish \
+ %{buildroot}%{_datadir}/fish/vendor_completions.d/xmake.fish
+install -Dpm0644 xmake/scripts/completions/register-completions.zsh \
+ %{buildroot}%{_datadir}/zsh/site-functions/xmake
+cp -rp xmake \
+ %{buildroot}%{_datadir}/xmake
+
+%check
+%{buildroot}%{_bindir}/%{name} --version
+%{buildroot}%{_bindir}/xrepo --version
+
+%files
+%doc README.md CHANGELOG.md
+%license LICENSE.md NOTICE.md
+%{_bindir}/%{name}
+%{_bindir}/xrepo
+%{_datadir}/%{name}
+%{_datadir}/bash-completion/completions/xmake
+%{_datadir}/zsh/site-functions/xmake
+%{_datadir}/fish/vendor_completions.d/xmake.fish
+%{_mandir}/man1/*.1*
+
+%changelog
+* Sun Jun 04 2023 Zephyr Lykos <[email protected]> - 2.7.9-1
+- Switch to release tarball
+- Use system provided libs if possible
+- Fix docs & manpage installation
+- Install shell completions
+
+* Sun Oct 18 2020 Ruki Wang <[email protected]> - 2.3.8-1
+- v2.3.8 released
+
+* Mon Sep 14 2020 Ruki Wang <[email protected]> - 2.3.7-1
+- Initial Commit
+