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