Also test brp-llvm-compile-lto-elf on object file

This serves the dual purpose on making sure that plain object
files can also be converted to ELF, and that the script handles
more than a single file.
This commit is contained in:
Nikita Popov 2023-09-29 09:33:12 +02:00
parent 88a50692ec
commit 820c23a121
2 changed files with 8 additions and 4 deletions

View File

@ -18,17 +18,19 @@ Source1: %{name}.h
%build
clang ${CFLAGS} -c %{SOURCE0} -o lib.o
ar cr %{name}.a lib.o
clang ${CFLAGS} -c %{SOURCE0} -o %{name}.o
ar cr %{name}.a %{name}.o
ranlib %{name}.a
%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.o
%{__install} -p -m 644 -t %{buildroot}%{_libdir} %{name}.a
%{__install} -p -m 644 -t %{buildroot}%{_includedir} %{SOURCE1}
%files
%{_libdir}/%{name}.o
%{_libdir}/%{name}.a
%{_includedir}/%{name}.h

View File

@ -18,7 +18,9 @@ Source0: %{name}.c
%build
gcc ${CFLAGS} -c %{SOURCE0} -o %{name}.o
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.a -o %{name}
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.a -o %{name}-ar
gcc ${LDFLAGS} %{name}.o %{_libdir}/%{name}-lib.o -o %{name}-obj
%check
./%{name} | grep "Hello, world!"
./%{name}-ar | grep "Hello, world!"
./%{name}-obj | grep "Hello, world!"