User:Rhabacker

Jump to: navigation, search

Useful links

Mingw64

Porting native autotools packages to mingw64

%define _name chmlib
Name:           mingw64-%{_name}
...
BuildRequires:  mingw64-cross-gcc 
# mingw64-cross-gcc-c++ in case of c++ project
... 
## if package provides pkg-config files add the following line
BuildRequires:  mingw64-cross-pkg-config
...
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%_mingw64_package_header_debug
BuildArch: noarch
...
%_mingw64_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
## sure ? there are also MINGW32_xxx flags
export CFLAGS=...
export CXXFLAGS=...
export LDFLAGS=...
%_mingw64_configure \
  --options
%make_jobs

%install
%make DESTDIR=%{buildroot} install %{?_smp_mflags}

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw64_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw64_bindir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw64_libdir}/xxx*.dll.a

Porting native Qt4/cmake packages to mingw64

%define _name   libalkimia
Name:           mingw64-%{_name}
...
BuildRequires:  cmake >= 3.0.0
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-cross-qmake
BuildRequires:  mingw64-libqt4-devel
...
%_mingw64_package_header_debug
BuildArch: noarch
...
## for language support
%lang_package
...
## add debug package
%_mingw64_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
export MINGW64_CFLAGS=...
export MINGW64_CXXFLAGS=...
export MINGW64_LDFLAGS=...
%_mingw64_cmake_qt4 
%make_jobs

%install
%_mingw64_cmake_makeinstall
## for language support
%_mingw64_find_lang %{_name} || true

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw64_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw64_bindir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw64_libdir}/xxx*.dll.a

Porting native KDE4 packages to mingw64

%define _name kmymoney
Name:           mingw64-%{_name}
...
BuildRequires:  cmake >= 3.0.0
BuildRequires:  mingw64-cross-gcc-c++
...
## if package provides pkg-config files add the following line
BuildRequires:  mingw64-cross-pkg-config
...
BuildRequires:  mingw64-cross-kde4-tools
BuildRequires:  mingw64-libkde4-devel
..
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%_mingw64_package_header_debug
BuildArch: noarch
...
%lang_package
%_mingw64_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
## sure ? there are also MINGW32_xxx flags
export CFLAGS=...
export CXXFLAGS=...
export LDFLAGS=...
%_mingw64_cmake_kde4 -d build -- -Dxxx=yyy
%make_jobs

%install
%_mingw64_kde4_makeinstall -C build
%_mingw64_kde4_post_install
%_mingw64_find_lang %{_name} || true

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw64_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw64_bindir}/xxx*.dll
%{_kde4_modulesdir}/xxx.so.* %{_mingw64_kde4_modulesdir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw64_libdir}/xxx*.dll.a

Mingw32

Porting native autotools packages to mingw32

%define _name chmlib
Name:           mingw32-%{_name}
...
BuildRequires:  mingw32-cross-gcc 
# mingw32-cross-gcc-c++ in case of c++ project
... 
## if package provides pkg-config files add the following line
BuildRequires:  mingw32-cross-pkg-config
...
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%_mingw32_package_header_debug
BuildArch: noarch

...
%_mingw32_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
## sure ? there are also MINGW32_xxx flags
export CFLAGS=...
export CXXFLAGS=...
export LDFLAGS=...
%_mingw32_configure \
  --options
%make_jobs

%install
%make DESTDIR=%{buildroot} install %{?_smp_mflags}

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw32_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw32_bindir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw64_libdir}/xxx*.dll.a

Porting native Qt4/cmake packages to mingw32

%define _name   libalkimia
Name:           mingw32-%{_name}
...
BuildRequires:  cmake >= 3.0.0
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-cross-qmake
BuildRequires:  mingw32-libqt4-devel
...
%_mingw32_package_header_debug
BuildArch: noarch
...
## for language support
%lang_package
...
## add debug package
%_mingw32_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
export MINGW32_CFLAGS=...
export MINGW32_CXXFLAGS=...
export MINGW32_LDFLAGS=...
%_mingw32_cmake_qt4 
%make_jobs

%install
%_mingw32_cmake_makeinstall
## for language support
%_mingw32_find_lang %{_name} || true

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw32_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw32_bindir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw32_libdir}/xxx*.dll.a

Porting native KDE4 packages to mingw32

%define _name kmymoney
Name:           mingw32-%{_name}
...
BuildRequires:  cmake >= 3.0.0
BuildRequires:  mingw32-cross-gcc-c++
## if package provides pkg-config files add the following line
BuildRequires:  mingw32-cross-pkg-config
BuildRequires:  mingw32-cross-kde4-tools
BuildRequires:  mingw32-libkde4-devel
..
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%_mingw32_package_header_debug
BuildArch: noarch
...
%lang_package
%_mingw32_debug_package

%prep
%setup -q -n %{_name}-%{version}

%build
## sure ? there are also MINGW32_xxx flags
export CFLAGS=...
export CXXFLAGS=...
export LDFLAGS=...
%_mingw32_cmake_kde4 -d build -- -Dxxx=yyy
%make_jobs

%install
%_mingw32_kde4_makeinstall -C build
%_mingw32_kde4_post_install
%_mingw32_find_lang %{_name} || true

%files
## rename *.so* -> *.dll
## add .exe to executables
## rename _xxxdir to _mingw32_xxxdir
%{_libdir}/xxx*.so  -> %{_mingw32_bindir}/xxx*.dll
%{_kde4_modulesdir}/xxx.so.* %{_mingw32_kde4_modulesdir}/xxx*.dll

%files devel
%{_libdir}/xxx*.so  -> %{_mingw32_libdir}/xxx*.dll.a

Misc

Conditional builds

%bcond_with     shared
...
%if %{with shared}
...
%endif

Access files in local installation root

%{buildroot}%{_mingwXX_prefix}
%{buildroot}%{_mingwXX_prefix}

KDE4 compiler flags

%define _mingwXX_kde4_cxxflags
%define _mingwXX_kde4_cflags
%define _mingwXX_kde4_ldflags

do not use MINGW64_CXXFLAGS, they will be overwritten