+# Do not provide .so automatically for the extensions.
+%global __provides_exclude_from ^.*\\.extension
+
Name: capi-network-wifi-direct
Summary: Network WiFi-Direct Library
Version: 1.2.75
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: cmake
BuildRequires: gettext-devel
+Provides: %{name}-profile_wearable = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
%description
Network WiFi-Direct library in Tizen CAPI (Shared Library)
#%description -n test-wifi-direct
#Test Application for Wi-Fi Direct Framework
+%package extension-features
+Summary: capi-network-wifi-direct with more features (mobile/common/tv)
+Requires: %{name} = %{version}-%{release}
+Provides: %{name}-profile_common = %{version}-%{release}
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_tv = %{version}-%{release}
+%description extension-features
+Overwrites the binary of %{name} with a binary containing more features:
+WIFI_DIRECT_ON_DEMAND, SERVICE_DISCOVERY, WIFI_DISPLAY.
+This targets mobile/common/tv profiles.
+If you unininstall this package and want to keep %{name}, you need to
+reinstall %{name} because this package overwrites a file or %{name}.
+
%prep
%setup -q
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-
+mkdir -p build_extension
+pushd build_extension
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-%if "%{profile}" == "common"
-DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND=1 \
-DTIZEN_FEATURE_SERVICE_DISCOVERY=1 \
-DTIZEN_FEATURE_WIFI_DISPLAY=1 \
-%else
-%if "%{profile}" == "wearable"
+ .. -DVERSION=%{version} -DMAJORVERSION=${MAJORVER} -DCMAKE_LIB_DIR=%{_libdir}
+make %{?jobs:-j%jobs}
+popd
+
+cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DTIZEN_FEATURE_SERVICE_DISCOVERY=0 \
-DTIZEN_FEATURE_WIFI_DISPLAY=0 \
-%else
-%if "%{profile}" == "mobile"
- -DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND=1 \
- -DTIZEN_FEATURE_SERVICE_DISCOVERY=1 \
- -DTIZEN_FEATURE_WIFI_DISPLAY=1 \
-%else
-%if "%{profile}" == "tv"
- -DTIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND=1 \
- -DTIZEN_FEATURE_SERVICE_DISCOVERY=1 \
- -DTIZEN_FEATURE_WIFI_DISPLAY=1 \
-%endif
-%endif
-%endif
-%endif
. -DVERSION=%{version} -DMAJORVERSION=${MAJORVER} -DCMAKE_LIB_DIR=%{_libdir}
make %{?jobs:-j%jobs}
+
%install
rm -rf %{buildroot}
+
+pushd build_extension
+%make_install
+popd
+pushd %{buildroot}%{_libdir}
+for FILE in libwifi-direct.so.*; do mv "${FILE}" "${FILE}.extension"; done
+popd
%make_install
ln -sf libwifi-direct.so.%{version} %{buildroot}/%{_libdir}/libwifi-direct.so.0
%manifest capi-network-wifi-direct.manifest
%license LICENSE
%defattr(-,root,root,-)
+%exclude %{_libdir}/libwifi-direct.so.*.extension
%{_libdir}/libwifi-direct.so*
+%post extension-features
+pushd %{_libdir}
+for FILE in libwifi-direct.so.*.extension;do ln -sf "${FILE}" "${FILE%.extension}"; done
+popd
+%preun extension-features
+echo "If you want to keep %{name} after uninstalling this, you need to reinstall %{name}."
+%files extension-features
+%{_libdir}/libwifi-direct.so.*.extension
+
%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/capi-network-wifi-direct.pc