Tizen:Common armv7l build fix
[platform/upstream/gcd.git] / packaging / gcd.spec
index ce90c91..57d88a6 100644 (file)
@@ -2,135 +2,87 @@ Name:       gcd
 Summary:    GCD(Grand Central Dispatch) library
 Version:    1.0
 Release:    1
-License:    Apache License, Version 2.0 and BSD
-Vendor:     AUTHOR
-Group:      System Environment/Libraries
+License:    Apache-2.0 and BSD-2-Clause
+Group:      System/Libraries
 Source0:    %{name}-%{version}.tar.gz
-BuildRoot:  %{_tmppath}/%{name}-%{version}-build
-Provides:   libdispatch.so.0 libkqueue.so.0 libBlocksRuntime.so.0 libpthread_workqueue.so.0
 BuildRequires:  clang
 
-
 %description
-GCD(Grand Central Dispatch) library.
+Grand Central Dispatch (GCD) is a technology developed by Apple Inc.
+
+%package devel
+Summary:    GCD(Grand Central Dispatch) library
+Requires:   %{name} = %{version}-%{release}
 
-%package devel  
-Summary:    GCD(Grand Central Dispatch) library.  
-Group:      TO_BE/FILLED_IN  
-Requires:   %{name} = %{version}-%{release}  
-  
-%description devel  
-GCD(Grand Central Dispatch) library. (DEV)  
+%description devel
+Grand Central Dispatch (GCD) is a technology developed by Apple Inc. (DEV)
 
 %prep
-%setup -q -n gcd-1.0
+%setup -q -n %{name}-%{version}
 
 %build
-
-export GCCVER=$(LANG=C gcc --version | head -1 | sed 's/\([a-z+]*\) \((.*)\) \([1-9\.]*\)\(.*\)/\3/')
-
-cd kqueue-1.0.4
-./configure --prefix=/usr
-make
-cd ..
-cd pthread_workqueue-0.8.2
-./configure --prefix=/usr
-make
-cd ..
-cd BlocksRuntime-0.1
-./configure --prefix=/usr
-make
-cd ..
-cd dispatch-1.0
+for sub_pkg in kqueue-1.0.4 \
+               pthread_workqueue-0.8.2 \
+               BlocksRuntime-0.1; do
+    pushd ${sub_pkg}
+    %configure
+    make
+    popd
+done
+
+pushd dispatch-1.0
 export KQUEUE_CFLAGS="-I../../kqueue-1.0.4/include"
-export KQUEUE_LIBS="/usr/lib"
+export KQUEUE_LIBS="%{_libdir}"
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/BlocksRuntime-0.1"
 export CFLAGS="$CFLAGS -L%{_builddir}/%{name}-%{version}/BlocksRuntime-0.1 -lBlocksRuntime -I%{_builddir}/%{name}-%{version}/BlocksRuntime-0.1 -Xlinker --build-id"
 
+export COMPILER_PATH="%{_libdir}/gcc/$(gcc -v 2>&1 | grep Target | sed -e 's/.*\s//')/$(gcc -v 2>&1 | grep 'gcc version' | sed -e 's/gcc\sversion\s//;s/\.[[:digit:]]\s.*$//')"
+
 %ifarch %{ix86}
-export CC="clang -target i386-tizen-linux-gnueabi"
-export CFLAGS="$CFLAGS -Xlinker -L/usr/lib/gcc/i586-tizen-linux/$GCCVER"
-export COMPILER_PATH=/usr/lib/gcc/i586-tizen-linux/$GCCVER
+export CC="clang -target i586-tizen-linux"
+export CFLAGS="$CFLAGS -Xlinker -L$COMPILER_PATH"
 %else
-export CC="clang -target arm-tizen-linux-gnueabi"
-export CFLAGS="$CFLAGS -Xlinker -L/usr/lib/gcc/armv7l-tizen-linux-gnueabi/$GCCVER"
-export COMPILER_PATH=/usr/lib/gcc/armv7l-tizen-linux-gnueabi/$GCCVER
+export CC="clang -target %{_target_cpu}-tizen-linux"
+export CFLAGS="$CFLAGS -Xlinker -L$COMPILER_PATH"
 %endif
 
-./configure --with-blocks-runtime=/usr/lib --prefix=/usr
+%configure --with-blocks-runtime=%{_libdir}
 make
-cd ..
+popd
 
 %install
-cd kqueue-1.0.4
-make DESTDIR=$RPM_BUILD_ROOT install
-gzip $RPM_BUILD_ROOT/usr/share/man/man2/kqueue.2
-gzip $RPM_BUILD_ROOT/usr/share/man/man2/kevent.2
-cd ..
-cd pthread_workqueue-0.8.2
-make DESTDIR=$RPM_BUILD_ROOT install
-cd ..
-cd BlocksRuntime-0.1
-make DESTDIR=$RPM_BUILD_ROOT install
-cd ..
-cd dispatch-1.0
-%ifarch %{ix86}
-export COMPILER_PATH=/usr/lib/gcc/i586-tizen-linux/$GCCVER
-%else
-export COMPILER_PATH=/usr/lib/gcc/armv7l-tizen-linux-gnueabi/$GCCVER
-%endif
-make DESTDIR=$RPM_BUILD_ROOT install
-cd ..
-mkdir -p %{buildroot}/usr/share/license
-cp %{_builddir}/%{name}-%{version}/LICENSE  %{buildroot}/usr/share/license/%{name}
-
+for sub_pkg in kqueue-1.0.4 \
+               pthread_workqueue-0.8.2 \
+               BlocksRuntime-0.1 \
+               dispatch-1.0; do
+    pushd ${sub_pkg}
+    %make_install
+    popd
+done
 
-%clean
-[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+%post -p /sbin/ldconfig
 
-%post
-/sbin/ldconfig
-
-%postun
-/sbin/ldconfig
+%postun -p /sbin/ldconfig
 
 %files
-%manifest gcd.manifest
-/usr/share/license/%{name}
 %defattr(-,root,root)
-%{_libdir}/libkqueue.so.0
-%{_libdir}/libkqueue.so.0.0
-%{_libdir}/libpthread_workqueue.so.0
-%{_libdir}/libpthread_workqueue.so.0.0
-%{_libdir}/libBlocksRuntime.so.0
-%{_libdir}/libBlocksRuntime.so.0.0
-%{_libdir}/libdispatch.so.0
-%{_libdir}/libdispatch.so.0.0.0
+%manifest gcd.manifest
+%license LICENSE
+%{_libdir}/libkqueue.so.*
+%{_libdir}/libpthread_workqueue.so.*
+%{_libdir}/libBlocksRuntime.so.*
+%{_libdir}/libdispatch.so.*
 
 %files devel
 %{_includedir}/kqueue/sys/event.h
 %{_libdir}/libkqueue.so
-%{_libdir}/libkqueue.so.0
-%{_libdir}/libkqueue.so.0.0
-%{_libdir}/libkqueue.la
-%{_libdir}/libkqueue.a
 %{_libdir}/pkgconfig/libkqueue.pc
-/usr/share/man/man2/kqueue.2.gz
-/usr/share/man/man2/kevent.2.gz
 %{_includedir}/pthread_workqueue.h
 %{_libdir}/libpthread_workqueue.so
-%{_libdir}/libpthread_workqueue.so.0
-%{_libdir}/libpthread_workqueue.so.0.0
-/usr/share/man/man3/pthread_workqueue.3.gz
 %{_includedir}/Block.h
 %{_includedir}/Block_private.h
 %{_libdir}/libBlocksRuntime.so
-%{_libdir}/libBlocksRuntime.so.0
-%{_libdir}/libBlocksRuntime.so.0.0
 %{_includedir}/dispatch/*.h
-%{_libdir}/libdispatch.a
-%{_libdir}/libdispatch.la
-/usr/share/man/man3/dispatch*
 %{_libdir}/libdispatch.so
-
-%changelog
+%{_mandir}/man2/*.gz
+%{_mandir}/man3/*.gz