summaryrefslogtreecommitdiff
path: root/recipes-tizen/libprivilege-control/libprivilege-control.inc
blob: d9b2719e8b960751c4ae2701772d33416390ac2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
DESCRIPTION = "Library to control privilege of application"
HOMEPAGE = "http://nohomepage.org"
SECTION = "Security/Access Control"
LICENSE = "Apache-2.0"

SRC_URI = ""

S = "${WORKDIR}/git"

inherit autotools-brokensep

BBCLASSEXTEND = ""
PROVIDES = ""

#PROVIDES by libprivilege-control


#PROVIDES by libprivilege-control-conf


#PROVIDES by libprivilege-control-dev


RDEPENDS = ""
#RDEPENDS of libprivilege-control-conf (${PN}-conf)
RDEPENDS_${PN}-conf += "libprivilege-control"

#RDEPENDS of libprivilege-control-dev (${PN}-dev)
RDEPENDS_${PN}-dev += "libprivilege-control"


DEPENDS = ""
#DEPENDS of libprivilege-control
DEPENDS_append_class-native = " cmake-native"
DEPENDS_append_class-target = " cmake-native"
DEPENDS += "tizen-platform-config"
DEPENDS += "dlog"
DEPENDS += "libiri"
DEPENDS += "smack"
DEPENDS += "sqlite3"
DEPENDS += "libcap"

do_prep() {
 cd ${S}
 chmod -Rf a+rX,u+w,g-w,o-w ${S}
 #setup -q
 cp ${S}/packaging/libprivilege-control.manifest .
 
 
}
do_patch_append() {
    bb.build.exec_func('do_prep', d)
}

do_configure() {
}

do_compile() {
 cd ${S}
 LANG=C
 export LANG
 unset DISPLAY
 CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ;
 CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ;
 FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ;
 LD_AS_NEEDED=1; export LD_AS_NEEDED ;
 
 
 export CFLAGS="${CFLAGS} -Wno-implicit-function-declaration"
 
   CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CFLAGS ; 
   CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
   FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export FFLAGS ; 
   cmake \
         -DCMAKE_VERBOSE_MAKEFILE=ON \
         -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
         -DCMAKE_INSTALL_LIBDIR:PATH=${prefix}/lib \
         -DINCLUDE_INSTALL_DIR:PATH=${prefix}/include \
         -DLIB_INSTALL_DIR:PATH=${prefix}/lib \
         -DSYSCONF_INSTALL_DIR:PATH=${sysconfdir} \
         -DSHARE_INSTALL_PREFIX:PATH=${prefix}/share \
         -DCMAKE_SKIP_RPATH:BOOL=ON \
         -DBUILD_SHARED_LIBS:BOOL=ON . -DCMAKE_BUILD_TYPE=RELEASE \
          -DCMAKE_VERBOSE_MAKEFILE=ON \
 	-DTZ_SYS_DB=${prefix}/dbspace \
 	-DTZ_SYS_HOME=/home
 
 VERBOSE=1 make -j16
 
 
 
}

do_install() {
 echo export RPM_BUILD_ROOT=${D}
 cd ${S}
 LANG=C
 export LANG
 unset DISPLAY
 rm -rf ${D}
 mkdir -p ${D}
 
 
   oe_runmake \
         DESTDIR=${D} \
         INSTALL_ROOT=${D} \
         BINDIR=${prefix}/bin \
   install  
   rm -f ${D}${infodir}/dir 
   find ${D} -regex ".*\.la$" | xargs rm -f -- 
   find ${D} -regex ".*\.a$" | xargs rm -f --
 mkdir -p ${D}/usr/share/privilege-control/
 
 mkdir -p ${D}/usr/lib/systemd/system/multi-user.target.wants
 ln -sf /usr/lib/systemd/system/smack-rules.service ${D}/usr/lib/systemd/system/multi-user.target.wants/smack-rules.service
 mkdir -p ${D}${prefix}/dbspace
 
 sed -i 's|TZ_SYS_DB|${prefix}/dbspace|g' ${S}/packaging/libprivilege-control.manifest
 
 
}

pkg_postinst_${PN}() {
    #!/bin/sh -e

    ldconfig
    /usr/share/privilege-control/db/updater.sh
    chsmack -a 'System' $D${prefix}/dbspace/.rules-db.db3*

}

pkg_postrm_${PN}() {
    #!/bin/sh -e

    ldconfig
}

PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
PACKAGES += " libprivilege-control "
PACKAGES += " libprivilege-control-conf "
PACKAGES += " libprivilege-control-dev "

libprivilege-control_files = ""
libprivilege-control_files += "libprivilege-control.manifest"
libprivilege-control_files += "${prefix}/lib/*.so.*"
libprivilege-control_files += "${prefix}/lib/librules-db-sql-udf.so"
libprivilege-control_files += "/usr/lib/systemd/system/smack-rules.service"
libprivilege-control_files += "/usr/bin/api_feature_loader"
libprivilege-control_files += "/usr/lib/systemd/system/multi-user.target.wants/smack-rules.service"
libprivilege-control_files += "/usr/share/privilege-control/db/rules-db.sql"
libprivilege-control_files += "/usr/share/privilege-control/db/rules-db-data.sql"
libprivilege-control_files += "/usr/share/privilege-control/db/updater.sh"
libprivilege-control_files += "/usr/share/privilege-control/db/updates/*"
libprivilege-control_files += "/usr/share/privilege-control/db/load-rules-db.sql"
libprivilege-control_files += "/etc/opt/upgrade/220.libprivilege-updater.patch.sh"
libprivilege-control_files += "%dir ${prefix}/dbspace"

libprivilege-control-conf_files = ""
libprivilege-control-conf_files += "libprivilege-control.manifest"
libprivilege-control-conf_files += "${prefix}/dbspace/.privilege_control*.db"

libprivilege-control-dev_files = ""
libprivilege-control-dev_files += "libprivilege-control.manifest"
libprivilege-control-dev_files += "${prefix}/include/*.h"
libprivilege-control-dev_files += "${prefix}/lib/*.so"
libprivilege-control-dev_files += "${prefix}/lib/pkgconfig/*.pc"

FILES_${PN} = "${libprivilege-control_files}"
FILES_${PN}-conf = "${libprivilege-control-conf_files}"
FILES_${PN}-dev = "${libprivilege-control-dev_files}"

PKG_libprivilege-control= "libprivilege-control"
PKG_libprivilege-control-conf= "libprivilege-control-conf"
PKG_libprivilege-control-dev= "libprivilege-control-dev"

require libprivilege-control-extraconf.inc