• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("./cups.gni")
16
17config_dir = "${target_gen_dir}"
18cups_code_dir = "${target_gen_dir}/cups-2.4.0"
19core_code_dir = "$cups_code_dir/cups/"
20filter_code_dir = "$cups_code_dir/filter"
21backend_code_dir = "$cups_code_dir/backend"
22ppdc_code_dir = "$cups_code_dir/ppdc"
23scheduler_code_dir = "$cups_code_dir/scheduler"
24
25SUBSYSTEM_NAME = "thirdparty"
26PART_NAME = "cups"
27
28cups_generated_sources = [
29  "$core_code_dir/adminutil.c",
30  "$core_code_dir/array.c",
31  "$core_code_dir/auth.c",
32  "$core_code_dir/backchannel.c",
33  "$core_code_dir/backend.c",
34  "$core_code_dir/debug.c",
35  "$core_code_dir/dest-job.c",
36  "$core_code_dir/dest-localization.c",
37  "$core_code_dir/dest-options.c",
38  "$core_code_dir/dest.c",
39  "$core_code_dir/dir.c",
40  "$core_code_dir/encode.c",
41  "$core_code_dir/file.c",
42  "$core_code_dir/getdevices.c",
43  "$core_code_dir/getifaddrs.c",
44  "$core_code_dir/getputfile.c",
45  "$core_code_dir/globals.c",
46  "$core_code_dir/hash.c",
47  "$core_code_dir/http-addr.c",
48  "$core_code_dir/http-addrlist.c",
49  "$core_code_dir/http-support.c",
50  "$core_code_dir/http.c",
51  "$core_code_dir/ipp-file.c",
52  "$core_code_dir/ipp-support.c",
53  "$core_code_dir/ipp-vars.c",
54  "$core_code_dir/ipp.c",
55  "$core_code_dir/langprintf.c",
56  "$core_code_dir/language.c",
57  "$core_code_dir/md5.c",
58  "$core_code_dir/md5passwd.c",
59  "$core_code_dir/notify.c",
60  "$core_code_dir/options.c",
61  "$core_code_dir/ppd-attr.c",
62  "$core_code_dir/ppd-cache.c",
63  "$core_code_dir/ppd-conflicts.c",
64  "$core_code_dir/ppd-custom.c",
65  "$core_code_dir/ppd-emit.c",
66  "$core_code_dir/ppd-localize.c",
67  "$core_code_dir/ppd-mark.c",
68  "$core_code_dir/ppd-page.c",
69  "$core_code_dir/ppd-util.c",
70  "$core_code_dir/ppd.c",
71  "$core_code_dir/pwg-media.c",
72  "$core_code_dir/raster-error.c",
73  "$core_code_dir/raster-interpret.c",
74  "$core_code_dir/raster-stream.c",
75  "$core_code_dir/request.c",
76  "$core_code_dir/sidechannel.c",
77  "$core_code_dir/snmp.c",
78  "$core_code_dir/snprintf.c",
79  "$core_code_dir/string.c",
80  "$core_code_dir/tempfile.c",
81  "$core_code_dir/thread.c",
82  "$core_code_dir/tls-openssl.c",
83  "$core_code_dir/tls.c",
84  "$core_code_dir/transcode.c",
85  "$core_code_dir/usersys.c",
86  "$core_code_dir/util.c",
87]
88
89scheduler_util_generated_sources = [ "$scheduler_code_dir/util.c" ]
90
91cups_deviced_generated_sources = [ "$scheduler_code_dir/cups-deviced.c" ]
92
93cups_driverd_generated_sources = [ "$scheduler_code_dir/cups-driverd.cxx" ]
94
95cups_exec_generated_sources = [ "$scheduler_code_dir/cups-exec.c" ]
96
97cupsd_generated_sources = [
98  "$scheduler_code_dir/auth.c",
99  "$scheduler_code_dir/banners.c",
100  "$scheduler_code_dir/cert.c",
101  "$scheduler_code_dir/classes.c",
102  "$scheduler_code_dir/client.c",
103  "$scheduler_code_dir/colorman.c",
104  "$scheduler_code_dir/conf.c",
105  "$scheduler_code_dir/dirsvc.c",
106  "$scheduler_code_dir/env.c",
107  "$scheduler_code_dir/file.c",
108  "$scheduler_code_dir/ipp.c",
109  "$scheduler_code_dir/job.c",
110  "$scheduler_code_dir/listen.c",
111  "$scheduler_code_dir/log.c",
112  "$scheduler_code_dir/main.c",
113  "$scheduler_code_dir/network.c",
114  "$scheduler_code_dir/policy.c",
115  "$scheduler_code_dir/printers.c",
116  "$scheduler_code_dir/process.c",
117  "$scheduler_code_dir/quotas.c",
118  "$scheduler_code_dir/select.c",
119  "$scheduler_code_dir/server.c",
120  "$scheduler_code_dir/statbuf.c",
121  "$scheduler_code_dir/subscriptions.c",
122  "$scheduler_code_dir/sysman.c",
123]
124
125cupsfilter_generated_sources = [ "$scheduler_code_dir/cupsfilter.c" ]
126
127ipp_generated_sources = [ "$backend_code_dir/ipp.c" ]
128
129usb_generated_sources = [ "$backend_code_dir/usb.c" ]
130
131lp_generated_sources = [ "$cups_code_dir/systemv/lp.c" ]
132
133lpadmin_generated_sources = [ "$cups_code_dir/systemv/lpadmin.c" ]
134
135lpinfo_generated_sources = [ "$cups_code_dir/systemv/lpinfo.c" ]
136
137rastertopwg_generated_sources = [ "$filter_code_dir/rastertopwg.c" ]
138
139cupsmime_generated_sources = [
140  "$scheduler_code_dir/filter.c",
141  "$scheduler_code_dir/mime.c",
142  "$scheduler_code_dir/type.c",
143]
144
145cupsimage_generated_sources = [
146  "$core_code_dir/raster-interstub.c",
147  "$core_code_dir/raster-stubs.c",
148]
149
150backend_generated_sources = [
151  "$backend_code_dir/ieee1284.c",
152  "$backend_code_dir/network.c",
153  "$backend_code_dir/runloop.c",
154  "$backend_code_dir/snmp-supplies.c",
155]
156
157cupsppdc_generated_sources = [
158  "$ppdc_code_dir/ppdc-array.cxx",
159  "$ppdc_code_dir/ppdc-attr.cxx",
160  "$ppdc_code_dir/ppdc-catalog.cxx",
161  "$ppdc_code_dir/ppdc-choice.cxx",
162  "$ppdc_code_dir/ppdc-constraint.cxx",
163  "$ppdc_code_dir/ppdc-driver.cxx",
164  "$ppdc_code_dir/ppdc-file.cxx",
165  "$ppdc_code_dir/ppdc-filter.cxx",
166  "$ppdc_code_dir/ppdc-font.cxx",
167  "$ppdc_code_dir/ppdc-group.cxx",
168  "$ppdc_code_dir/ppdc-import.cxx",
169  "$ppdc_code_dir/ppdc-mediasize.cxx",
170  "$ppdc_code_dir/ppdc-message.cxx",
171  "$ppdc_code_dir/ppdc-option.cxx",
172  "$ppdc_code_dir/ppdc-profile.cxx",
173  "$ppdc_code_dir/ppdc-shared.cxx",
174  "$ppdc_code_dir/ppdc-source.cxx",
175  "$ppdc_code_dir/ppdc-string.cxx",
176  "$ppdc_code_dir/ppdc-variable.cxx",
177]
178
179ppdc_generated_sources = [ "$ppdc_code_dir/ppdc.cxx" ]
180
181mime_convs_generated_source = "$cups_code_dir/conf/mime.convs"
182mime_types_generated_source = "$cups_code_dir/conf/mime.types"
183
184action("cups_action") {
185  print("cups_action is exec")
186  script = "//third_party/cups/install.py"
187  outputs = []
188  outputs += cups_generated_sources
189  outputs += cups_deviced_generated_sources
190  outputs += cups_driverd_generated_sources
191  outputs += cups_exec_generated_sources
192  outputs += cupsd_generated_sources
193  outputs += cupsfilter_generated_sources
194  outputs += ipp_generated_sources
195  outputs += usb_generated_sources
196  outputs += lp_generated_sources
197  outputs += lpadmin_generated_sources
198  outputs += lpinfo_generated_sources
199  outputs += rastertopwg_generated_sources
200  outputs += cupsmime_generated_sources
201  outputs += cupsimage_generated_sources
202  outputs += backend_generated_sources
203  outputs += cupsppdc_generated_sources
204  outputs += ppdc_generated_sources
205  outputs += scheduler_util_generated_sources
206  outputs += [ mime_convs_generated_source ]
207  outputs += [ mime_types_generated_source ]
208
209  inputs = [ "//third_party/cups/cups-2.4.0-source.tar.gz" ]
210  cups_path = rebase_path("${target_gen_dir}", root_build_dir)
211  cups_source_path = rebase_path("//third_party/cups", root_build_dir)
212  args = [
213    "--gen-dir",
214    "$cups_path",
215    "--source-dir",
216    "$cups_source_path",
217  ]
218}
219
220group("third_party_cups") {
221  public_deps = [ ":cups" ]
222  deps = [
223    ":cups-deviced",
224    ":cups-driverd",
225    ":cups-exec",
226    ":cupsd",
227    ":cupsfilter",
228    ":cupsimage",
229    ":ipp",
230    ":mime.convs",
231    ":mime.types",
232    ":rastertopwg",
233    ":usb",
234  ]
235}
236
237config("cups_config") {
238  defines = cups_defines
239  include_dirs = [
240    "$config_dir",
241    "$cups_code_dir",
242    "$core_code_dir",
243    "//third_party/libusb",
244    "//third_party/openssl/include",
245    get_label_info(":cups_action", "target_gen_dir") + "/cups-2.4.0",
246  ]
247
248  cflags = [
249    "-Wno-unused-function",
250    "-Wno-unused-value",
251    "-Wno-implicit-function-declaration",
252    "-Wno-int-conversion",
253    "-D_FORTIFY_SOURCE=2",
254    "-fstack-protector-all",
255  ]
256}
257
258ohos_shared_library("cups") {
259  sources = cups_generated_sources
260  sources += cupsimage_generated_sources
261  deps = [
262    ":cups_action",
263    "//third_party/openssl:libcrypto_shared",
264    "//third_party/openssl:libssl_shared",
265    "//third_party/zlib:libz",
266  ]
267  public_configs = [ ":cups_config" ]
268  subsystem_name = "$SUBSYSTEM_NAME"
269  part_name = "$PART_NAME"
270}
271
272ohos_shared_library("cupsimage") {
273  sources = cupsimage_generated_sources
274  deps = [
275    ":cups_action",
276    "//third_party/cups:cups",
277  ]
278  public_configs = [ ":cups_config" ]
279  subsystem_name = "$SUBSYSTEM_NAME"
280  part_name = "$PART_NAME"
281}
282
283ohos_executable("rastertopwg") {
284  sources = rastertopwg_generated_sources
285  deps = [
286    ":cups_action",
287    "//third_party/cups:cups",
288  ]
289  install_enable = true
290  module_install_dir = "$cups_serverbin_dir/filter"
291  public_configs = [ ":cups_config" ]
292  subsystem_name = "$SUBSYSTEM_NAME"
293  part_name = "$PART_NAME"
294}
295
296ohos_shared_library("backend") {
297  sources = backend_generated_sources
298  deps = [
299    ":cups_action",
300    "//third_party/cups:cups",
301  ]
302  public_configs = [ ":cups_config" ]
303  subsystem_name = "$SUBSYSTEM_NAME"
304  part_name = "$PART_NAME"
305}
306
307ohos_executable("ipp") {
308  sources = ipp_generated_sources
309  deps = [
310    ":cups_action",
311    "//third_party/cups:backend",
312    "//third_party/cups:cups",
313  ]
314  install_enable = true
315  module_install_dir = "$cups_serverbin_dir/backend"
316  public_configs = [ ":cups_config" ]
317  subsystem_name = "$SUBSYSTEM_NAME"
318  part_name = "$PART_NAME"
319}
320
321ohos_executable("usb") {
322  sources = usb_generated_sources
323  deps = [
324    ":cups_action",
325    "//third_party/cups:backend",
326    "//third_party/cups:cups",
327    "//third_party/libusb:libusb",
328  ]
329  install_enable = true
330  module_install_dir = "$cups_serverbin_dir/backend"
331  public_configs = [ ":cups_config" ]
332  subsystem_name = "$SUBSYSTEM_NAME"
333  part_name = "$PART_NAME"
334}
335
336#end of backend
337
338ohos_executable("lpadmin") {
339  sources = lpadmin_generated_sources
340  deps = [
341    ":cups_action",
342    "//third_party/cups:cups",
343  ]
344  install_enable = true
345  public_configs = [ ":cups_config" ]
346  subsystem_name = "$SUBSYSTEM_NAME"
347  part_name = "$PART_NAME"
348}
349
350ohos_executable("lpinfo") {
351  sources = lpinfo_generated_sources
352  deps = [
353    ":cups_action",
354    "//third_party/cups:cups",
355  ]
356  install_enable = true
357  public_configs = [ ":cups_config" ]
358  subsystem_name = "$SUBSYSTEM_NAME"
359  part_name = "$PART_NAME"
360}
361
362ohos_executable("lp") {
363  sources = lp_generated_sources
364  deps = [
365    ":cups_action",
366    "//third_party/cups:cups",
367  ]
368  install_enable = true
369  public_configs = [ ":cups_config" ]
370  subsystem_name = "$SUBSYSTEM_NAME"
371  part_name = "$PART_NAME"
372}
373
374#ppdc
375ohos_shared_library("cupsppdc") {
376  sources = cupsppdc_generated_sources
377  deps = [
378    ":cups_action",
379    "//third_party/cups:cups",
380  ]
381  public_configs = [ ":cups_config" ]
382  subsystem_name = "$SUBSYSTEM_NAME"
383  part_name = "$PART_NAME"
384}
385
386ohos_executable("ppdc") {
387  sources = ppdc_generated_sources
388  deps = [
389    ":cups_action",
390    "//third_party/cups:cups",
391    "//third_party/cups:cupsppdc",
392  ]
393  install_enable = true
394  public_configs = [ ":cups_config" ]
395  subsystem_name = "$SUBSYSTEM_NAME"
396  part_name = "$PART_NAME"
397}
398
399#end of ppdc
400
401#scheduler
402ohos_shared_library("cupsmime") {
403  sources = cupsmime_generated_sources
404  deps = [
405    ":cups_action",
406    "//third_party/cups:cups",
407  ]
408  public_configs = [ ":cups_config" ]
409  subsystem_name = "$SUBSYSTEM_NAME"
410  part_name = "$PART_NAME"
411}
412
413ohos_executable("cupsd") {
414  sources = cupsd_generated_sources
415  deps = [
416    ":cups_action",
417    "//third_party/cups:cups",
418    "//third_party/cups:cupsmime",
419  ]
420  install_enable = true
421  public_configs = [ ":cups_config" ]
422  subsystem_name = "$SUBSYSTEM_NAME"
423  part_name = "$PART_NAME"
424}
425
426ohos_executable("cupsfilter") {
427  sources = cupsfilter_generated_sources
428  deps = [
429    ":cups_action",
430    "//third_party/cups:cups",
431    "//third_party/cups:cupsmime",
432  ]
433  install_enable = true
434  public_configs = [ ":cups_config" ]
435  subsystem_name = "$SUBSYSTEM_NAME"
436  part_name = "$PART_NAME"
437}
438
439ohos_executable("cups-deviced") {
440  sources = cups_deviced_generated_sources
441  sources += scheduler_util_generated_sources
442  deps = [
443    ":cups_action",
444    "//third_party/cups:cups",
445    "//third_party/cups:cupsmime",
446  ]
447  install_enable = true
448  module_install_dir = "$cups_serverbin_dir/daemon"
449  public_configs = [ ":cups_config" ]
450  subsystem_name = "$SUBSYSTEM_NAME"
451  part_name = "$PART_NAME"
452}
453
454ohos_executable("cups-driverd") {
455  sources = cups_driverd_generated_sources
456  sources += scheduler_util_generated_sources
457  deps = [
458    ":cups_action",
459    "//third_party/cups:cups",
460    "//third_party/cups:cupsppdc",
461  ]
462  install_enable = true
463  module_install_dir = "$cups_serverbin_dir/daemon"
464  public_configs = [ ":cups_config" ]
465  subsystem_name = "$SUBSYSTEM_NAME"
466  part_name = "$PART_NAME"
467}
468
469ohos_executable("cups-exec") {
470  sources = cups_exec_generated_sources
471  deps = [ ":cups_action" ]
472  install_enable = true
473  module_install_dir = "$cups_serverbin_dir/daemon"
474  public_configs = [ ":cups_config" ]
475  subsystem_name = "$SUBSYSTEM_NAME"
476  part_name = "$PART_NAME"
477}
478
479ohos_prebuilt_etc("mime.convs") {
480  source = mime_convs_generated_source
481  deps = [ ":cups_action" ]
482  relative_install_dir = "cups/share/mime"
483  subsystem_name = "$SUBSYSTEM_NAME"
484  part_name = "$PART_NAME"
485}
486
487ohos_prebuilt_etc("mime.types") {
488  source = mime_types_generated_source
489  deps = [ ":cups_action" ]
490  relative_install_dir = "cups/share/mime"
491  subsystem_name = "$SUBSYSTEM_NAME"
492  part_name = "$PART_NAME"
493}
494