Difference between revisions of "Template Spec Files"
From Rosalab Wiki
(→For both python 2 and python 3, ROSA >= 2019.1 (in progress)) |
Mikhailnov (Talk | contribs) |
||
Line 206: | Line 206: | ||
=Spec file for a Python module= | =Spec file for a Python module= | ||
− | == | + | |
+ | == Spec file to build python3 module == | ||
+ | (in progress) | ||
+ | |||
<pre> | <pre> | ||
− | %define module mymodule | + | %define module mymodule |
Summary: Example module | Summary: Example module | ||
Line 219: | Line 222: | ||
Source0: %{module}-%{version}.tar.gz | Source0: %{module}-%{version}.tar.gz | ||
BuildRequires: pkgconfig(python2) | BuildRequires: pkgconfig(python2) | ||
+ | |||
+ | %define _description \ | ||
+ | Text about \ | ||
+ | example Python module | ||
%description | %description | ||
− | + | %{_description} | |
− | % | + | #------------------------------------------------------------------ |
− | % | + | |
+ | %package -n python3-%{module} | ||
+ | Summary: %{summary} | ||
+ | Group: Development/Python | ||
+ | |||
+ | %description -n python3-%{module} | ||
+ | %{_description} | ||
+ | |||
+ | %files -n python3-%{module} | ||
%{python2_sitearch}/* | %{python2_sitearch}/* | ||
Line 240: | Line 255: | ||
</pre> | </pre> | ||
− | == | + | == Spec file to build python2 module (ROSA <= 2016.1) == |
<pre> | <pre> | ||
%define module mymodule | %define module mymodule | ||
Line 252: | Line 267: | ||
Url: http://mypage.org/mymodule | Url: http://mypage.org/mymodule | ||
Source0: %{module}-%{version}.tar.gz | Source0: %{module}-%{version}.tar.gz | ||
− | BuildRequires: pkgconfig( | + | BuildRequires: pkgconfig(python2) |
%description | %description | ||
Line 259: | Line 274: | ||
%files | %files | ||
%doc *.txt | %doc *.txt | ||
− | %{ | + | %{python2_sitearch}/* |
#------------------------------------------------------------------ | #------------------------------------------------------------------ | ||
Line 267: | Line 282: | ||
%build | %build | ||
− | % | + | %py2_build |
%install | %install | ||
− | % | + | %py2_install |
+ | |||
+ | </pre> | ||
+ | |||
+ | == Spec file to build python2 module (ROSA >= 2019.1) == | ||
+ | <pre> | ||
+ | %define module mymodule | ||
+ | |||
+ | Summary: Example module | ||
+ | Name: python-%{module} | ||
+ | Version: 1.0 | ||
+ | Release: 1 | ||
+ | License: Apache License | ||
+ | Group: Development/Python | ||
+ | Url: http://mypage.org/mymodule | ||
+ | Source0: %{module}-%{version}.tar.gz | ||
+ | BuildRequires: pkgconfig(python2) | ||
+ | |||
+ | %define _description \ | ||
+ | Text about \ | ||
+ | example Python module | ||
+ | |||
+ | %description | ||
+ | %{_description} | ||
+ | |||
+ | #------------------------------------------------------------------ | ||
+ | |||
+ | %package -n python2-%{module} | ||
+ | Summary: %{summary} | ||
+ | Group: Development/Python | ||
+ | |||
+ | %description -n python2-%{module} | ||
+ | %{_description} | ||
+ | |||
+ | %files -n python2-%{module} | ||
+ | %{python2_sitearch}/* | ||
+ | |||
+ | #------------------------------------------------------------------ | ||
+ | |||
+ | %prep | ||
+ | %setup -q | ||
+ | |||
+ | %build | ||
+ | %py2_build | ||
+ | |||
+ | %install | ||
+ | %py2_install | ||
</pre> | </pre> | ||
− | == For both python 2 and python 3, ROSA >= 2019.1 | + | == For both python 2 and python 3, ROSA >= 2019.1 == |
<pre> | <pre> | ||
%define module mymodule | %define module mymodule |
Revision as of 13:32, 7 May 2020
Contents
- 1 Spec file for a program built using GNU Autotools
- 2 Spec file for a program built using CMake
- 3 Spec file for a program written in Qt4 and built using cmake
- 4 Spec file for a program written in Qt5 and built using cmake
- 5 Spec file for a program built using Perl/Makefile.PL
- 6 Spec file for a program built using Perl/Build.PL
- 7 Spec file for a Python module
- 8 Spec file for a Library
- 9 Spec file for a Node.js module
- 10 Spec file for a Ruby Gem
- 11 Spec file for a Haskell Library
Spec file for a program built using GNU Autotools
Summary: foo Name: foo Version: 1.0 Release: 1 License: foo Group: foo Url: foo Source0: %{name}-%{version}.tar.bz2 %description foo. %files -f %{name}.lang #------------------------------------------------------------------ %prep %setup -q %build %configure %make %install %makeinstall_std %find_lang %{name}
Spec file for a program built using CMake
Summary: foo Name: foo Version: 1.0 Release: 1 License: foo Group: foo Url: foo Source0: %{name}-%{version}.tar.bz2 BuildRequires: cmake %description foo. %files -f %{name}.lang #------------------------------------------------------------------ %prep %setup -q %build %cmake %make %install %makeinstall_std -C build %find_lang %{name}
Spec file for a program written in Qt4 and built using cmake
Summary: foo Name: foo Version: 1.0 Release: 1 License: foo Group: foo Url: foo Source0: %{name}-%{version}.tar.bz2 BuildRequires: cmake BuildRequires: qt4-devel %description foo. %files -f %{name}.lang #------------------------------------------------------------------ %prep %setup -q %build %cmake_qt4 %make %install %makeinstall_std -C build %find_lang %{name}
Spec file for a program written in Qt5 and built using cmake
Summary: foo Name: foo Version: 1.0 Release: 1 License: foo Group: foo Url: foo Source0: %{name}-%{version}.tar.bz2 BuildRequires: cmake BuildRequires: qt5-devel %description foo. %files -f %{name}.lang #------------------------------------------------------------------ %prep %setup -q %build %cmake_qt5 %make %install %makeinstall_std -C build %find_lang %{name}
Spec file for a program built using Perl/Makefile.PL
%define upstream_name foo %define upstream_version 1.0 Summary: foo Name: perl-%{upstream_name} Version: %perl_convert_version %{upstream_version} Release: 1 License: foo Group: foo Url: foo Source0: %{upstream_name}-%{upstream_version}.tar.bz2 BuildRequires: perl-devel %description foo. %files #------------------------------------------------------------------ %prep %setup -qn %{upstream_name}-%{upstream_version} %build perl Makefile.PL INSTALLDIRS=vendor %make %check %make test %install %makeinstall_std
Spec file for a program built using Perl/Build.PL
%define upstream_name foo %define upstream_version 1.0 Summary: foo Name: perl-%{upstream_name} Version: %perl_convert_version %{upstream_version} Release: 1 License: foo Group: foo Url: foo Source0: %{upstream_name}-%{upstream_version}.tar.bz2 BuildRequires: perl-devel BuildRequires: perl(Module::Build) %description foo. %files #------------------------------------------------------------------ %prep %setup -qn %{upstream_name}-%{upstream_version} %build perl Build.PL installdirs=vendor ./Build CFLAGS="%{optflags}" %check ./Build test %install ./Build install destdir=%{buildroot}
Spec file for a Python module
Spec file to build python3 module
(in progress)
%define module mymodule Summary: Example module Name: python-%{module} Version: 1.0 Release: 1 License: Apache License Group: Development/Python Url: http://mypage.org/mymodule Source0: %{module}-%{version}.tar.gz BuildRequires: pkgconfig(python2) %define _description \ Text about \ example Python module %description %{_description} #------------------------------------------------------------------ %package -n python3-%{module} Summary: %{summary} Group: Development/Python %description -n python3-%{module} %{_description} %files -n python3-%{module} %{python2_sitearch}/* #------------------------------------------------------------------ %prep %setup -q %build %py2_build %install %py2_install
Spec file to build python2 module (ROSA <= 2016.1)
%define module mymodule Summary: Example module Name: python-%{module} Version: 1.0 Release: 1 License: Apache License Group: Development/Python Url: http://mypage.org/mymodule Source0: %{module}-%{version}.tar.gz BuildRequires: pkgconfig(python2) %description Example Python module. %files %doc *.txt %{python2_sitearch}/* #------------------------------------------------------------------ %prep %setup -q %build %py2_build %install %py2_install
Spec file to build python2 module (ROSA >= 2019.1)
%define module mymodule Summary: Example module Name: python-%{module} Version: 1.0 Release: 1 License: Apache License Group: Development/Python Url: http://mypage.org/mymodule Source0: %{module}-%{version}.tar.gz BuildRequires: pkgconfig(python2) %define _description \ Text about \ example Python module %description %{_description} #------------------------------------------------------------------ %package -n python2-%{module} Summary: %{summary} Group: Development/Python %description -n python2-%{module} %{_description} %files -n python2-%{module} %{python2_sitearch}/* #------------------------------------------------------------------ %prep %setup -q %build %py2_build %install %py2_install
For both python 2 and python 3, ROSA >= 2019.1
%define module mymodule Summary: Example module Name: python-%{module} Version: 1.0 Release: 1 License: Apache License Group: Development/Python Url: http://mypage.org/mymodule Source0: %{module}-%{version}.tar.gz %define _description \ Text about \ example Python module %description %{_description} #------------------------------------------------------------------ %package -n python2-%{module} Summary: Example python2 module Group: Development/Python BuildRequires: pkgconfig(python2) %py2_migration_meta python-%{module} %description -n python2-%{module} %{_description} %files -n python2-%{module} %{python2_sitearch}/* #------------------------------------------------------------------ %package -n python3-%{module} Summary: Example python3 module Group: Development/Python BuildRequires: pkgconfig(python3) %description -n python3-%{module} %{_description} %files -n python3-%{module} %{python3_sitearch}/* #------------------------------------------------------------------ %prep %setup -q %build %py2_build %py3_build %install %py2_install %py3_install
See also
Spec file for a Library
%define major 1 %define libname %mklibname %{name} %{major} %define devname %mklibname %{name} -d # Usually we don't need to build static library # But let's add it to spec template anyway %define sdevname %mklibname %{name} -d -s Summary: foo Name: foo Version: 1.0 Release: 1 License: foo Group: foo Url: foo Source0: %{name}-%{version}.tar.bz2 %description foo. #------------------------------------------------------------------ %package -n %{libname} Summary: foo shared library Group: System/Libraries %description -n %{libname} foo shared library. %files -n %{libname} %{_libdir}/lib%{name}.so.%{major}* #------------------------------------------------------------------ %package -n %{devname} Summary: foo development files Group: Development/Other Requires: %{libname} = %{EVRD} Provides: %{name}-devel = %{EVRD} %description -n %{devname} foo development files. %files -n %{devname} %{_includedir}/*.h %{_libdir}/*.so #------------------------------------------------------------------ %package -n %{sdevname} Summary: foo development files (static library) Group: Development/Other Requires: %{devname} = %{EVRD} Provides: %{name}-static-devel = %{EVRD} %description -n %{sdevname} foo development files (static library). %files -n %{sdevname} %{_libdir}/*.a #------------------------------------------------------------------ %prep %setup -q %build %configure %make %install %makeinstall_std
See also
Spec file for a Node.js module
%define oname foo Summary: foo Name: nodejs-%{oname} Version: 1.0 Release: 1 License: foo Group: Development/Other Url: foo Source0: %{oname}-%{version}.tgz BuildRequires: nodejs-packaging BuildArch: noarch %description %{summary}. %files %doc LICENSE %{nodejs_sitelib}/%{oname} #------------------------------------------------------------------ %prep %setup -q -n package rm -rf node_modules %build %install mkdir -p %{buildroot}/%{nodejs_sitelib}/%{oname} cp -r package.json index.js %{buildroot}/%{nodejs_sitelib}/%{oname} %nodejs_symlink_deps
Spec file for a Ruby Gem
%define rbname foo Summary: Foo Name: rubygem-%{rbname} Version: 1.0 Release: 1 Group: Development/Ruby License: GPLv2+ or Ruby URL: foo Source0: %{rbname}-%{version}.gem BuildRequires: rubygems BuildArch: noarch %description %{summary}. %files %{ruby_gemdir}/gems/%{rbname}-%{version} %{ruby_gemdir}/specifications/%{rbname}-%{version}.gemspec #------------------------------------------------------------------ %package doc Summary: Documentation for %{name} Group: Books/Computer books Requires: %{name} = %{EVRD} %description doc Documents, RDoc & RI documentation for %{name}. %files doc %{ruby_gemdir}/doc/%{rbname}-%{version} #------------------------------------------------------------------ %prep %setup -q %build %gem_build %install %gem_install
Spec file for a Haskell Library
%define module foo Summary: foo Name: ghc-%{module} Version: 1.0 Release: 1 License: BSD Group: Development/Haskell Url: foo Source0: %{module}-%{version}.tar.gz BuildRequires: ghc-devel BuildRequires: haskell-macros Requires(post,preun): ghc %description %{summary}. %files %{_libdir}/%{module}-%{version} %{_cabal_rpm_deps_dir} %{_cabal_haddoc_files} #---------------------------------------------------------------------------- %prep %setup -q -n %{module}-%{version} %build %_cabal_build %install %_cabal_install %_cabal_rpm_gen_deps %_cabal_scriptlets