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 ] 58} 59 60ohos_shared_library("cupsfilters") { 61 sources = [ 62 "$CUPS_FILTERS_CODE_DIR/cupsfilters/attr.c", 63 "$CUPS_FILTERS_CODE_DIR/cupsfilters/check.c", 64 "$CUPS_FILTERS_CODE_DIR/cupsfilters/cmyk.c", 65 "$CUPS_FILTERS_CODE_DIR/cupsfilters/colord.c", 66 "$CUPS_FILTERS_CODE_DIR/cupsfilters/colormanager.c", 67 "$CUPS_FILTERS_CODE_DIR/cupsfilters/dither.c", 68 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-bmp.c", 69 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-colorspace.c", 70 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-gif.c", 71 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-jpeg.c", 72 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-photocd.c", 73 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pix.c", 74 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-png.c", 75 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pnm.c", 76 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgi.c", 77 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgilib.c", 78 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sun.c", 79 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-tiff.c", 80 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-zoom.c", 81 "$CUPS_FILTERS_CODE_DIR/cupsfilters/image.c", 82 "$CUPS_FILTERS_CODE_DIR/cupsfilters/ipp.c", 83 "$CUPS_FILTERS_CODE_DIR/cupsfilters/lut.c", 84 "$CUPS_FILTERS_CODE_DIR/cupsfilters/pack.c", 85 "$CUPS_FILTERS_CODE_DIR/cupsfilters/pdftoippprinter.c", 86 "$CUPS_FILTERS_CODE_DIR/cupsfilters/ppdgenerator.c", 87 "$CUPS_FILTERS_CODE_DIR/cupsfilters/raster.c", 88 "$CUPS_FILTERS_CODE_DIR/cupsfilters/rgb.c", 89 "$CUPS_FILTERS_CODE_DIR/cupsfilters/srgb.c", 90 ] 91 92 public_configs = [ ":cups_filters_config" ] 93 94 deps = [ 95 "//third_party/cups:cups", 96 "//third_party/libjpeg-turbo:turbojpeg", 97 "//third_party/libpng:libpng", 98 "//third_party/zlib:libz", 99 ] 100 101 install_enable = true 102 subsystem_name = "$SUBSYSTEM_NAME" 103 part_name = "$PART_NAME" 104} 105 106ohos_executable("imagetoraster") { 107 sources = [ 108 "$CUPS_FILTERS_CODE_DIR/filter/common.c", 109 "$CUPS_FILTERS_CODE_DIR/filter/imagetoraster.c", 110 ] 111 112 deps = [ 113 "//third_party/cups:cups", 114 "//third_party/cups-filters:cupsfilters", 115 ] 116 117 public_configs = [ ":cups_filters_config" ] 118 119 module_install_dir = "$cups_serverbin_dir/filter" 120 install_enable = true 121 subsystem_name = "$SUBSYSTEM_NAME" 122 part_name = "$PART_NAME" 123} 124 125ohos_prebuilt_etc("cupsfilters.convs") { 126 exec_script(rebase_path("//third_party/cups-filters/generate_cupsfilters_convs.py"), [rebase_path("//third_party/cups-filters/mime")]) 127 source = "mime/cupsfilters.convs" 128 relative_install_dir = "cups/share/mime" 129 subsystem_name = "$SUBSYSTEM_NAME" 130 part_name = "$PART_NAME" 131} 132 133ohos_prebuilt_etc("cupsfilters.types") { 134 source = "mime/cupsfilters.types" 135 relative_install_dir = "cups/share/mime" 136 subsystem_name = "$SUBSYSTEM_NAME" 137 part_name = "$PART_NAME" 138}