• 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("//third_party/cups/cups.gni")
16
17CUPS_CODE_DIR = "//third_party/cups/cups-2.4.0"
18CUPS_FILTERS_CODE_DIR = "//third_party/cups-filters"
19SUBSYSTEM_NAME = "thirdparty"
20PART_NAME = "cups-filters"
21
22group("third_party_cupsfilters") {
23  deps = [
24    ":cupsfilters",
25    ":cupsfilters.convs",
26    ":cupsfilters.types",
27    ":imagetoraster",
28  ]
29}
30
31config("cups_filters_config") {
32  include_dirs = [
33    ".",
34    "$CUPS_CODE_DIR",
35    "$CUPS_FILTERS_CODE_DIR/cupsfilters/",
36    "$CUPS_FILTERS_CODE_DIR/filter/",
37  ]
38
39  defines = cups_defines
40
41  cflags = [
42    "-D_PPD_DEPRECATED=",
43    "-Wextra",
44    "-Wall",
45    "-Wno-unused-parameter",
46    "-Wno-unused-function",
47    "-Wno-unused-variable",
48    "-Wno-unused-value",
49    "-Wno-sign-compare",
50    "-Wno-missing-field-initializers",
51
52    "-Wno-strlcpy-strlcat-size",
53    "-Wtautological-pointer-compare",
54    "-Wimplicit-fallthrough",
55    "-Wno-implicit-function-declaration",
56    "-w",
57    "-D_FORTIFY_SOURCE=2",
58    "-fstack-protector-all",
59  ]
60}
61
62action("cupsfilters_action") {
63  script = "//third_party/cups-filters/install.py"
64  outputs = [ "${target_gen_dir}/cupsfilters.convs" ]
65  inputs = [ "//third_party/cups/cups-2.4.0-source.tar.gz" ]
66  gen_path = rebase_path("${target_gen_dir}", root_build_dir)
67  source_path = rebase_path("//third_party/cups-filters", root_build_dir)
68  args = [
69    "--gen-dir",
70    "$gen_path",
71    "--source-dir",
72    "$source_path",
73  ]
74}
75
76ohos_shared_library("cupsfilters") {
77  sources = [
78    "$CUPS_FILTERS_CODE_DIR/cupsfilters/attr.c",
79    "$CUPS_FILTERS_CODE_DIR/cupsfilters/check.c",
80    "$CUPS_FILTERS_CODE_DIR/cupsfilters/cmyk.c",
81    "$CUPS_FILTERS_CODE_DIR/cupsfilters/colord.c",
82    "$CUPS_FILTERS_CODE_DIR/cupsfilters/colormanager.c",
83    "$CUPS_FILTERS_CODE_DIR/cupsfilters/dither.c",
84    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-bmp.c",
85    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-colorspace.c",
86    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-gif.c",
87    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-jpeg.c",
88    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-photocd.c",
89    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pix.c",
90    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-png.c",
91    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pnm.c",
92    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgi.c",
93    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgilib.c",
94    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sun.c",
95    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-tiff.c",
96    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-zoom.c",
97    "$CUPS_FILTERS_CODE_DIR/cupsfilters/image.c",
98    "$CUPS_FILTERS_CODE_DIR/cupsfilters/ipp.c",
99    "$CUPS_FILTERS_CODE_DIR/cupsfilters/lut.c",
100    "$CUPS_FILTERS_CODE_DIR/cupsfilters/pack.c",
101    "$CUPS_FILTERS_CODE_DIR/cupsfilters/pdftoippprinter.c",
102    "$CUPS_FILTERS_CODE_DIR/cupsfilters/ppdgenerator.c",
103    "$CUPS_FILTERS_CODE_DIR/cupsfilters/raster.c",
104    "$CUPS_FILTERS_CODE_DIR/cupsfilters/rgb.c",
105    "$CUPS_FILTERS_CODE_DIR/cupsfilters/srgb.c",
106  ]
107
108  public_configs = [ ":cups_filters_config" ]
109
110  deps = [
111    ":cupsfilters_action",
112    "//third_party/cups:cups",
113    "//third_party/libjpeg-turbo:turbojpeg",
114    "//third_party/libpng:libpng",
115    "//third_party/zlib:libz",
116  ]
117
118  install_enable = true
119  subsystem_name = "$SUBSYSTEM_NAME"
120  part_name = "$PART_NAME"
121}
122
123ohos_executable("imagetoraster") {
124  sources = [
125    "$CUPS_FILTERS_CODE_DIR/filter/common.c",
126    "$CUPS_FILTERS_CODE_DIR/filter/imagetoraster.c",
127  ]
128
129  deps = [
130    "//third_party/cups:cups",
131    "//third_party/cups-filters:cupsfilters",
132  ]
133
134  public_configs = [ ":cups_filters_config" ]
135
136  module_install_dir = "$cups_serverbin_dir/filter"
137  install_enable = true
138  subsystem_name = "$SUBSYSTEM_NAME"
139  part_name = "$PART_NAME"
140}
141
142ohos_prebuilt_etc("cupsfilters.convs") {
143  source = "${target_gen_dir}/cupsfilters.convs"
144  deps = [ ":cupsfilters_action" ]
145  relative_install_dir = "cups/share/mime"
146  subsystem_name = "$SUBSYSTEM_NAME"
147  part_name = "$PART_NAME"
148}
149
150ohos_prebuilt_etc("cupsfilters.types") {
151  source = "mime/cupsfilters.types"
152  deps = [ ":cupsfilters_action" ]
153  relative_install_dir = "cups/share/mime"
154  subsystem_name = "$SUBSYSTEM_NAME"
155  part_name = "$PART_NAME"
156}
157