884bb0733a8cb7596bb29d58b4136b70ef05bf6b
[scm/bb/meta-tizen.git] / meta-tizen-ivi / meta-tizen-common-base / recipes-connectivity / net-config / net-config.inc
1 DESCRIPTION = "TIZEN Network Configuration Module"
2 HOMEPAGE = "http://nohomepage.org"
3 SECTION = "System/Network"
4 LICENSE = "Apache-2.0"
5 PV = "0.1.90_29"
6
7 SRC_URI = ""
8
9 S = "${WORKDIR}/git"
10
11 inherit manifest autotools-brokensep
12
13 BBCLASSEXTEND = ""
14 PROVIDES = ""
15
16 #PROVIDES by net-config
17
18
19 RDEPENDS = ""
20 #RDEPENDS of net-config (${PN})
21 RDEPENDS_${PN} += "systemd"
22 RDEPENDS_${PN} += "vconf"
23
24
25 DEPENDS = ""
26 #DEPENDS of net-config
27 DEPENDS += "libwifi-direct"
28 inherit tizen_cmake
29 DEPENDS += "syspopup"
30 inherit pkgconfig
31 DEPENDS += "dlog"
32 DEPENDS += "glib-2.0"
33 DEPENDS += "systemd"
34 DEPENDS += "libtapi"
35 DEPENDS += "vconf"
36 DEPENDS += "dbus-glib"
37
38 do_prep() {
39  cd ${S}
40  chmod -Rf a+rX,u+w,g-w,o-w ${S}
41  #setup -q
42  cp ${S}/packaging/net-config.manifest .
43  
44  
45  
46 }
47 do_patch_append() {
48     bb.build.exec_func('do_prep', d)
49 }
50
51 do_configure() {
52 }
53
54 do_compile() {
55  cd ${S}
56  LANG=C
57  export LANG
58  unset DISPLAY
59  LD_AS_NEEDED=1; export LD_AS_NEEDED ;
60  
61  
62    cmake \
63          -DCMAKE_VERBOSE_MAKEFILE=ON \
64          -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
65          -DCMAKE_INSTALL_LIBDIR:PATH=${prefix}/lib \
66          -DINCLUDE_INSTALL_DIR:PATH=${prefix}/include \
67          -DLIB_INSTALL_DIR:PATH=${prefix}/lib \
68          -DSYSCONF_INSTALL_DIR:PATH=${sysconfdir} \
69          -DSHARE_INSTALL_PREFIX:PATH=${prefix}/share \
70          -DCMAKE_SKIP_RPATH:BOOL=ON \
71          -DBUILD_SHARED_LIBS:BOOL=ON \
72          -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
73          ${EXTRA_OECMAKE} . -DCMAKE_INSTALL_PREFIX=${prefix}
74  
75  make -j16
76  
77  
78  
79  
80 }
81
82 do_install() {
83  export RPM_BUILD_ROOT=${D}
84  cd ${S}
85  LANG=C
86  export LANG
87  unset DISPLAY
88  rm -rf ${D}
89  mkdir -p ${D}
90  
91  
92    oe_runmake \
93          DESTDIR=${D} \
94          INSTALL_ROOT=${D} \
95          BINDIR=${prefix}/bin \
96    install  
97    rm -f ${D}${infodir}/dir 
98    find ${D} -regex ".*\.la$" | xargs rm -f -- 
99    find ${D} -regex ".*\.a$" | xargs rm -f --
100  
101  mkdir -p ${D}${prefix}/share/dbus-1/system-services
102  cp resources/usr/share/dbus-1/services/net.netconfig.service ${D}${prefix}/share/dbus-1/system-services/net.netconfig.service
103  mkdir -p ${D}${sysconfdir}/dbus-1/system.d
104  cp resources/etc/dbus-1/system.d/net-config.conf ${D}${sysconfdir}/dbus-1/system.d/net-config.conf
105  
106  # Systemd service file
107  mkdir -p ${D}${systemd_unitdir}/system
108  cp resources/usr/lib/systemd/system/net-config.service ${D}${systemd_unitdir}/system/net-config.service
109  mkdir -p ${D}${systemd_unitdir}/system/multi-user.target.wants/
110  ln -s ../net-config.service ${D}${systemd_unitdir}/system/multi-user.target.wants/net-config.service
111  
112  #License
113  mkdir -p ${D}${prefix}/share/license
114  cp LICENSE.APLv2 ${D}${prefix}/share/license/net-config
115  
116  
117 }
118
119 pkg_postinst_${PN}() {
120     #!/bin/sh -e
121
122     vconftool set -t int memory/dnet/state 0 -i
123     vconftool set -t int memory/wifi/state 0 -i
124     vconftool set -t int memory/wifi/transfer_state 0 -i
125     vconftool set -t int memory/wifi/strength 0 -i
126     vconftool set -t int memory/wifi/bgscan_mode 0 -i
127     vconftool set -t int memory/dnet/wifi 0 -i
128     vconftool set -t int memory/dnet/network_config 0 -i
129     vconftool set -t int memory/dnet/status 0 -i
130     vconftool set -t string memory/dnet/ip "" -i
131     vconftool set -t string memory/dnet/proxy "" -i
132     vconftool set -t string memory/wifi/connected_ap_name "" -i
133     vconftool set -t string db/wifi/bssid_address ""
134     #Default Call Statistics
135     vconftool set -t int db/dnet/statistics/cellular/totalsnt "0"
136     vconftool set -t int db/dnet/statistics/cellular/totalrcv "0"
137     vconftool set -t int db/dnet/statistics/cellular/lastsnt "0"
138     vconftool set -t int db/dnet/statistics/cellular/lastrcv "0"
139     vconftool set -t int db/dnet/statistics/wifi/totalsnt "0"
140     vconftool set -t int db/dnet/statistics/wifi/totalrcv "0"
141     vconftool set -t int db/dnet/statistics/wifi/lastsnt "0"
142     vconftool set -t int db/dnet/statistics/wifi/lastrcv "0"
143     vconftool set -t int file/private/wifi/last_power_state "0"
144     systemctl daemon-reload
145     if [ "$1" == "1" ]; then
146         systemctl restart net-config.service
147     fi
148
149 }
150
151 pkg_prerm_${PN}() {
152     #!/bin/sh -e
153
154     if [ "$1" == "0" ]; then
155         systemctl stop net-config.service
156     fi
157
158 }
159
160 pkg_postrm_${PN}() {
161     #!/bin/sh -e
162
163     systemctl daemon-reload
164     if [ "$1" == "1" ]; then
165         systemctl restart net-config.service
166     fi
167
168 }
169
170 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
171 PACKAGES += " net-config "
172
173 net-config_files = ""
174 net-config_files += "${prefix}/sbin/*"
175 net-config_files += "${prefix}/share/dbus-1/system-services/*"
176 net-config_files += "${sysconfdir}/dbus-1/system.d/*"
177 net-config_files += "${systemd_unitdir}/system/net-config.service"
178 net-config_files += "${systemd_unitdir}/system/multi-user.target.wants/net-config.service"
179 net-config_files += "${prefix}/share/license/net-config"
180 MANIFESTFILES_${PN} = "net-config.manifest"
181
182 FILES_${PN} = "${net-config_files}"
183
184 PKG_net-config= "net-config"
185
186 require net-config-extraconf.inc
187