%define filterout_ld -Wl,-z,(combreloc|relro)
-%define tirpccflags %(pkg-config --cflags libtirpc)
+%if %{with dynamic}
+%define tirpcdcflags %(pkg-config --cflags libtirpc)
+%endif
+%if %{with initrd} || %{with static}
+%if %{with musl}
+%define tirpcscflags -I%{_includedir}/musl/tirpc
+%endif
+%if %{with glibc}
+%define tirpcscflags %(pkg-config --cflags libtirpc)
+%endif
+%endif
%if %{with glibc}
%if %{with initrd} || %{with static}
%define tirpcslibs %(pkg-config --libs --static libtirpc krb5 krb5-gssapi openssl sqlite3|sed 's/-l//g')
%endif
%if %{with musl}
-%define tirpcslibs %(pkg-config --libs libtirpc|sed s/-l//g)
+%define tirpcslibs tirpc
%endif
%description
%{__make} oldconfig
%{__make} \
%{?with_verbose:V=1} \
- EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpcscflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack %{?with_musl:-L%{_libdir}/musl}" \
%if %{with musl}
CC="musl-gcc"
%{__make} oldconfig
%{__make} \
%{?with_verbose:V=1} \
- EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpcscflags} -Os -D_GNU_SOURCE %{?with_musl:-I%{_includedir}/musl} %{!?with_glibc:-fno-stack-protector}" \
EXTRA_LDFLAGS="%{rpmldflags} -static -Wl,-z,noexecstack %{?with_musl:-L%{_libdir}/musl}" \
%if %{with musl}
CC="musl-gcc"
%{__make} \
%{?with_verbose:V=1} \
%{CrossOpts} \
- EXTRA_CFLAGS="%{rpmcflags} %{tirpccflags} %{!?with_glibc:-fno-stack-protector}" \
+ EXTRA_CFLAGS="%{rpmcflags} %{tirpcdcflags} %{!?with_glibc:-fno-stack-protector}" \
EXTRA_LDFLAGS="%{rpmldflags} -Wl,-z,noexecstack" \
CC="%{__cc}"
%{__make} busybox.links docs/busybox.1