Remove Profile Build Dependency 81/98981/1 submit/tizen/20161219.233906 submit/tizen/20170112.021958 submit/tizen/20170116.115935
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 21 Nov 2016 09:43:08 +0000 (18:43 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 21 Nov 2016 09:43:08 +0000 (18:43 +0900)
- This is for Tizen 4.0.
  (4.0 Configurability & Building Blocks requires not to use
  profile macro soon.)

- To SR this, you need to create JIRA-TRE issue of

  - Add bluetooth-tools-profile_common for common profile
  - Add bluetooth-tools-profile_tv for tv profile
  - Add bluetooth-tools-profile_mobile for mobile profile
  - Add bluetooth-tools-profile_wearable for wearable profile
  - Add bluetooth-tools-profile_ivi for ivi profile

Change-Id: I7c0172d275a661bf504de980c47ccb7b99d66fb1
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/bluetooth-tools.spec
scripts/CMakeLists.txt

index c8a4ade..1e3846d 100644 (file)
@@ -10,10 +10,49 @@ BuildRequires:  cmake
 Suggests:       bluetooth-share
 Requires:       tizen-platform-config-tools
 Requires:      bluetooth-scripts
+Requires:   %{name}-compat = %{version}-%{release}
+Recommends:   %{name}-profile_common = %{version}-%{release}
 
 %description
 Tools fo bluetooth run/stop and set address
 
+%package profile_common
+Summary:    Bluetooth-tools extension for common/tv
+Provides:   %{name}-compat = %{version}-%{release}
+Provides:   %{name}-profile_tv = %{version}-%{release}
+Conflicts:  %{name}-profile_mobile = %{version}-%{release}
+Conflicts:  %{name}-profile_wearable = %{version}-%{release}
+Conflicts:  %{name}-profile_ivi = %{version}-%{release}
+%description profile_common
+Bluetooth-tools extension for Tizen common / tv profile.
+
+%package profile_mobile
+Summary:    Bluetooth-tools extension for mobile/tv
+Provides:   %{name}-compat = %{version}-%{release}
+Conflicts:  %{name}-profile_common = %{version}-%{release}
+Conflicts:  %{name}-profile_wearable = %{version}-%{release}
+Conflicts:  %{name}-profile_ivi = %{version}-%{release}
+%description profile_mobile
+Bluetooth-tools extension for Tizen mobile profile.
+
+%package profile_wearable
+Summary:    Bluetooth-tools extension for wearable/tv
+Provides:   %{name}-compat = %{version}-%{release}
+Conflicts:  %{name}-profile_common = %{version}-%{release}
+Conflicts:  %{name}-profile_mobile = %{version}-%{release}
+Conflicts:  %{name}-profile_ivi = %{version}-%{release}
+%description profile_wearable
+Bluetooth-tools extension for Tizen wearable profile.
+
+%package profile_ivi
+Summary:    Bluetooth-tools extension for ivi/tv
+Provides:   %{name}-compat = %{version}-%{release}
+Conflicts:  %{name}-profile_common = %{version}-%{release}
+Conflicts:  %{name}-profile_mobile = %{version}-%{release}
+Conflicts:  %{name}-profile_wearable = %{version}-%{release}
+%description profile_ivi
+Bluetooth-tools extension for Tizen ivi profile.
+
 %package no-firmware
 Summary:    On/Off Bluetooth adapter
 Group:      Network & Connectivity/Bluetooth
@@ -33,41 +72,9 @@ export CFLAGS+=" -fpie -fvisibility=hidden"
 export CXXFLAGS+=" -fpie -fvisibility=hidden"
 export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
 
-%if "%{profile}" == "mobile"
-export CFLAGS="$CFLAGS -DTIZEN_MOBILE"
-%else
-%if "%{profile}" == "wearable"
-export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
-%endif
-%endif
-
-%cmake \
-%if "%{profile}" == "mobile"
-       -DTIZEN_MOBILE=YES \
-       -DTIZEN_WEARABLE=NO \
-       -DTIZEN_IVI=NO \
-%else
-%if "%{profile}" == "wearable"
-       -DTIZEN_MOBILE=NO \
-        -DTIZEN_WEARABLE=YES \
-       -DTIZEN_IVI=NO \
-%else
-%if "%{profile}" == "ivi"
-        -DTIZEN_MOBILE=NO \
-        -DTIZEN_WEARABLE=NO \
-       -DTIZEN_IVI=YES \
-%else
-        -DTIZEN_MOBILE=NO \
-        -DTIZEN_WEARABLE=NO \
-       -DTIZEN_IVI=NO \
-%endif
-%endif
-%endif
-
+%cmake
 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 %__make %{?_smp_mflags}
-#cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
-#make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
@@ -90,29 +97,91 @@ install -D -m 0644 LICENSE.APLv2 %{buildroot}%{_datadir}/license/bluetooth-tools
 %files
 %manifest %{name}.manifest
 %defattr(-,root,root,-)
-%if "%{profile}" == "mobile" || "%{profile}" == "wearable" || "%{profile}" == "ivi"
 %exclude %{_sysconfdir}/rc.d/init.d/bluetooth-address
-%else
-%{_sysconfdir}/rc.d/init.d/bluetooth-address
-%endif
 %{_sysconfdir}/rc.d/rc3.d/S60bluetooth-address
 %{_sysconfdir}/rc.d/rc5.d/S60bluetooth-address
-%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-stack-up.sh
-%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-stack-down.sh
-%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-reset-env.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-on.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-dev-up.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-mode-on.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-off.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-hci-logdump.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-run-hcidump.sh
-%if "%{profile}" == "mobile"
-%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-stack-down-with-radio.sh
-%endif
 %{_datadir}/license/bluetooth-tools
 %{_unitdir}/multi-user.target.wants/bluetooth-address.service
 %{_unitdir}/bluetooth-address.service
 
+%post profile_common
+pushd %{_prefix}/etc/bluetooth/
+ln -sf common/bt-stack-up.sh bt-stack-up.sh
+ln -sf common/bt-stack-down.sh bt-stack-down.sh
+ln -sf common/bt-reset-env.sh bt-reset-env.sh
+popd
+%preun profile_common
+pushd %{_prefix}/etc/bluetooth/
+rm bt-stack-up.sh
+rm bt-stack-down.sh
+rm bt-reset-env.sh
+popd
+%files profile_common
+%{_sysconfdir}/rc.d/init.d/bluetooth-address
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-stack-up.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-stack-down.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/common/bt-reset-env.sh
+
+%post profile_mobile
+pushd %{_prefix}/etc/bluetooth/
+ln -sf mobile/bt-stack-up.sh bt-stack-up.sh
+ln -sf mobile/bt-stack-down.sh bt-stack-down.sh
+ln -sf mobile/bt-stack-down-with-radio.sh bt-stack-down-with-radio.sh
+ln -sf mobile/bt-reset-env.sh bt-reset-env.sh
+popd
+%preun profile_mobile
+pushd %{_prefix}/etc/bluetooth/
+rm bt-stack-up.sh
+rm bt-stack-down.sh
+rm bt-stack-down-with-radio.sh
+rm bt-reset-env.sh
+popd
+%files profile_mobile
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/mobile/bt-stack-up.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/mobile/bt-stack-down.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/mobile/bt-reset-env.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/mobile/bt-stack-down-with-radio.sh
+
+%post profile_ivi
+pushd %{_prefix}/etc/bluetooth/
+ln -sf ivi/bt-stack-up.sh bt-stack-up.sh
+ln -sf ivi/bt-stack-down.sh bt-stack-down.sh
+ln -sf ivi/bt-reset-env.sh bt-reset-env.sh
+popd
+%preun profile_ivi
+pushd %{_prefix}/etc/bluetooth/
+rm bt-stack-up.sh
+rm bt-stack-down.sh
+rm bt-reset-env.sh
+popd
+%files profile_ivi
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/ivi/bt-stack-up.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/ivi/bt-stack-down.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/ivi/bt-reset-env.sh
+
+%post profile_wearable
+pushd %{_prefix}/etc/bluetooth/
+ln -sf wearable/bt-stack-up.sh bt-stack-up.sh
+ln -sf wearable/bt-stack-down.sh bt-stack-down.sh
+ln -sf wearable/bt-reset-env.sh bt-reset-env.sh
+popd
+%preun profile_wearable
+pushd %{_prefix}/etc/bluetooth/
+rm bt-stack-up.sh
+rm bt-stack-down.sh
+rm bt-reset-env.sh
+popd
+%files profile_wearable
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/wearable/bt-stack-up.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/wearable/bt-stack-down.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/wearable/bt-reset-env.sh
+
 %files no-firmware
 %manifest %{name}.manifest
 %defattr(-, root, root)
index 59a9c84..bb8a5c0 100755 (executable)
@@ -2,30 +2,33 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 # install script files
 
-IF (TIZEN_MOBILE)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-up.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-down.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-down-with-radio.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-reset-env.sh DESTINATION etc/bluetooth)
-ELSE ()
-IF (TIZEN_WEARABLE)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-up.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-down.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-reset-env.sh DESTINATION etc/bluetooth)
-ELSE ()
-IF (TIZEN_IVI)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-stack-up.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-stack-down.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-reset-env.sh DESTINATION etc/bluetooth)
-ELSE ()
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-up.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-down.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-reset-env.sh DESTINATION etc/bluetooth)
+# (TIZEN_MOBILE)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-up.sh DESTINATION etc/bluetooth/mobile)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-down.sh DESTINATION etc/bluetooth/mobile)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-down-with-radio.sh DESTINATION etc/bluetooth/mobile)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-reset-env.sh DESTINATION etc/bluetooth/mobile)
+
+
+# (TIZEN_WEARABLE)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-up.sh DESTINATION etc/bluetooth/wearable)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-down.sh DESTINATION etc/bluetooth/wearable)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-reset-env.sh DESTINATION etc/bluetooth/wearable)
+
+
+# (TIZEN_IVI)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-stack-up.sh DESTINATION etc/bluetooth/ivi)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-stack-down.sh DESTINATION etc/bluetooth/ivi)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/ivi/bt-reset-env.sh DESTINATION etc/bluetooth/ivi)
+
+# OTHERWISE
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-up.sh DESTINATION etc/bluetooth/common)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-down.sh DESTINATION etc/bluetooth/common)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-reset-env.sh DESTINATION etc/bluetooth/common)
 # install booting script
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bluetooth-address DESTINATION /etc/rc.d/init.d)
-ENDIF (TIZEN_IVI)
-ENDIF (TIZEN_WEARABLE)
-ENDIF (TIZEN_MOBILE)
+
+
+# For All
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-on.sh DESTINATION etc/bluetooth)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-dev-up.sh DESTINATION etc/bluetooth)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-mode-on.sh DESTINATION etc/bluetooth)