# Copyright (c) 2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//third_party/cups/cups.gni") CUPS_CODE_DIR = "//third_party/cups/cups-2.4.0" CUPS_FILTERS_CODE_DIR = "//third_party/cups-filters" SUBSYSTEM_NAME = "thirdparty" PART_NAME = "cups-filters" group("third_party_cupsfilters") { deps = [ ":cupsfilters", ":cupsfilters.convs", ":cupsfilters.types", ":imagetoraster" ] } config("cups_filters_config") { include_dirs = [ ".", "$CUPS_CODE_DIR", "$CUPS_FILTERS_CODE_DIR/cupsfilters/", "$CUPS_FILTERS_CODE_DIR/filter/", ] defines = cups_defines cflags = [ "-D_PPD_DEPRECATED=", "-Wextra", "-Wall", "-Wno-unused-parameter", "-Wno-unused-function", "-Wno-unused-variable", "-Wno-unused-value", "-Wno-sign-compare", "-Wno-missing-field-initializers", "-Wno-strlcpy-strlcat-size", "-Wtautological-pointer-compare", "-Wimplicit-fallthrough", "-Wno-implicit-function-declaration", "-w", ] } ohos_shared_library("cupsfilters") { sources = [ "$CUPS_FILTERS_CODE_DIR/cupsfilters/attr.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/check.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/cmyk.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/colord.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/colormanager.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/dither.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-bmp.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-colorspace.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-gif.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-jpeg.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-photocd.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pix.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-png.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-pnm.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgi.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sgilib.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-sun.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-tiff.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image-zoom.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/image.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/ipp.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/lut.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/pack.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/pdftoippprinter.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/ppdgenerator.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/raster.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/rgb.c", "$CUPS_FILTERS_CODE_DIR/cupsfilters/srgb.c", ] public_configs = [ ":cups_filters_config" ] deps = [ "//third_party/cups:cups", "//third_party/libjpeg-turbo:turbojpeg", "//third_party/libpng:libpng", "//third_party/zlib:libz", ] install_enable = true subsystem_name = "$SUBSYSTEM_NAME" part_name = "$PART_NAME" } ohos_executable("imagetoraster") { sources = [ "$CUPS_FILTERS_CODE_DIR/filter/common.c", "$CUPS_FILTERS_CODE_DIR/filter/imagetoraster.c", ] deps = [ "//third_party/cups:cups", "//third_party/cups-filters:cupsfilters", ] public_configs = [ ":cups_filters_config" ] module_install_dir = "$cups_serverbin_dir/filter" install_enable = true subsystem_name = "$SUBSYSTEM_NAME" part_name = "$PART_NAME" } ohos_prebuilt_etc("cupsfilters.convs") { exec_script(rebase_path("//third_party/cups-filters/generate_cupsfilters_convs.py"), [rebase_path("//third_party/cups-filters/mime")]) source = "mime/cupsfilters.convs" relative_install_dir = "cups/share/mime" subsystem_name = "$SUBSYSTEM_NAME" part_name = "$PART_NAME" } ohos_prebuilt_etc("cupsfilters.types") { source = "mime/cupsfilters.types" relative_install_dir = "cups/share/mime" subsystem_name = "$SUBSYSTEM_NAME" part_name = "$PART_NAME" }