Remove Profile Build Dependency (m/t/c) 11/97111/2
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 11 Nov 2016 07:13:26 +0000 (16:13 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 30 Nov 2016 06:19:51 +0000 (15:19 +0900)
- This is for Tizen 4.0.

- When this gets SR, the maintainer needs to create a JIRA-TRE issue of:

  Add capi-network-wifi-direct-profile_common for common profile
  Add capi-network-wifi-direct-profile_mobile for mobile profile
  Add capi-network-wifi-direct-profile_tv for tv profile

- It'd be better to distinguish such features at runtime using CAPI(system-info)
 or VCONF/BUXTON; however, such refactoring can be done later and this modification
 is enough for Tizen 4.0 Configurability & Building Blocks.

Change-Id: Id5ccb8856f58d5f8096ba7d3f76e7594d7d1cf0f
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/capi-network-wifi-direct.spec

index fe54e06..fbf5a16 100644 (file)
@@ -1,3 +1,6 @@
+# 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
@@ -16,6 +19,8 @@ BuildRequires:  pkgconfig(capi-base-common)
 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)
@@ -37,6 +42,19 @@ Network WiFi-Direct library in Tizen CAPI (Shared Library) (Development)
 #%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
 
@@ -58,34 +76,31 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 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
@@ -99,8 +114,18 @@ 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