!7 更新readme以及增加联合构建的patch

Merge pull request !7 from dongzhengkuan/master
This commit is contained in:
openharmony_ci 2023-07-19 07:56:06 +00:00 committed by Gitee
commit c2d37acfd6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 135 additions and 320 deletions

149
BUILD.gn
View File

@ -344,7 +344,7 @@ ohos_executable("cups-exec") {
}
ohos_prebuilt_etc("mime.convs") {
exec_script("generate_mime_convs.py")
exec_script(rebase_path("//third_party/cups/generate_mime_convs.py"), [rebase_path("//third_party/cups/cups-2.4.0/conf")])
source = "$cups_code_dir/conf/mime.convs"
relative_install_dir = "cups/share/mime"
subsystem_name = "$SUBSYSTEM_NAME"
@ -356,149 +356,4 @@ ohos_prebuilt_etc("mime.types") {
relative_install_dir = "cups/share/mime"
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
#conf
#start of jpeg
JPEG_CODE_ROOT = "//third_party/libjpeg-turbo"
jpeg_sources = [
"$JPEG_CODE_ROOT/jcapimin.c",
"$JPEG_CODE_ROOT/jcapistd.c",
"$JPEG_CODE_ROOT/jccoefct.c",
"$JPEG_CODE_ROOT/jccolor.c",
"$JPEG_CODE_ROOT/jcdctmgr.c",
"$JPEG_CODE_ROOT/jchuff.c",
"$JPEG_CODE_ROOT/jcicc.c",
"$JPEG_CODE_ROOT/jcinit.c",
"$JPEG_CODE_ROOT/jcmainct.c",
"$JPEG_CODE_ROOT/jcmarker.c",
"$JPEG_CODE_ROOT/jcmaster.c",
"$JPEG_CODE_ROOT/jcomapi.c",
"$JPEG_CODE_ROOT/jcparam.c",
"$JPEG_CODE_ROOT/jcphuff.c",
"$JPEG_CODE_ROOT/jcprepct.c",
"$JPEG_CODE_ROOT/jcsample.c",
"$JPEG_CODE_ROOT/jctrans.c",
"$JPEG_CODE_ROOT/jdapimin.c",
"$JPEG_CODE_ROOT/jdapistd.c",
"$JPEG_CODE_ROOT/jdatadst.c",
"$JPEG_CODE_ROOT/jdatasrc.c",
"$JPEG_CODE_ROOT/jdcoefct.c",
"$JPEG_CODE_ROOT/jdcolor.c",
"$JPEG_CODE_ROOT/jddctmgr.c",
"$JPEG_CODE_ROOT/jdhuff.c",
"$JPEG_CODE_ROOT/jdicc.c",
"$JPEG_CODE_ROOT/jdinput.c",
"$JPEG_CODE_ROOT/jdmainct.c",
"$JPEG_CODE_ROOT/jdmarker.c",
"$JPEG_CODE_ROOT/jdmaster.c",
"$JPEG_CODE_ROOT/jdmerge.c",
"$JPEG_CODE_ROOT/jdphuff.c",
"$JPEG_CODE_ROOT/jdpostct.c",
"$JPEG_CODE_ROOT/jdsample.c",
"$JPEG_CODE_ROOT/jdtrans.c",
"$JPEG_CODE_ROOT/jerror.c",
"$JPEG_CODE_ROOT/jfdctflt.c",
"$JPEG_CODE_ROOT/jfdctfst.c",
"$JPEG_CODE_ROOT/jfdctint.c",
"$JPEG_CODE_ROOT/jidctflt.c",
"$JPEG_CODE_ROOT/jidctfst.c",
"$JPEG_CODE_ROOT/jidctint.c",
"$JPEG_CODE_ROOT/jidctred.c",
"$JPEG_CODE_ROOT/jmemmgr.c",
"$JPEG_CODE_ROOT/jmemnobs.c",
"$JPEG_CODE_ROOT/jquant1.c",
"$JPEG_CODE_ROOT/jquant2.c",
"$JPEG_CODE_ROOT/jutils.c",
]
include_dirs = []
define_config = []
cflags = []
mkernel = defined(ohos_kernel_type) && ohos_kernel_type == "liteos_m"
if (mkernel || is_win) {
jpeg_sources += [ "jsimd_none.c" ]
define_config += [
"NO_PUTENV",
"NO_GETENV",
]
} else if (current_cpu == "arm" || current_cpu == "arm64") {
jpeg_sources += [
"$JPEG_CODE_ROOT/simd/arm/jcgray-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jcphuff-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jcsample-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jdmerge-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jdsample-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jfdctfst-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jidctred-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jquanti-neon.c",
]
# NEON_INTRINSICS as default
jpeg_sources += [
"$JPEG_CODE_ROOT/simd/arm/jccolor-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jidctfst-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jidctint-neon.c",
]
define_config += [ "NEON_INTRINSICS" ]
cflags += [ "-DNEON_INTRINSICS" ]
include_dirs += [ "//third_party/libjpeg-turbo/simd/arm" ]
if (current_cpu == "arm") {
jpeg_sources += [
"$JPEG_CODE_ROOT/simd/arm/aarch32/jchuff-neon.c",
"$JPEG_CODE_ROOT/simd/arm/aarch32/jsimd.c",
"$JPEG_CODE_ROOT/simd/arm/jdcolor-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jfdctint-neon.c",
]
cflags += [
"-mfpu=neon",
"-mfloat-abi=softfp",
]
} else {
jpeg_sources += [
"$JPEG_CODE_ROOT/simd/arm/aarch64/jchuff-neon.c",
"$JPEG_CODE_ROOT/simd/arm/aarch64/jsimd.c",
"$JPEG_CODE_ROOT/simd/arm/jdcolor-neon.c",
"$JPEG_CODE_ROOT/simd/arm/jfdctint-neon.c",
]
}
} else {
jpeg_sources += [ "$JPEG_CODE_ROOT/jsimd_none.c" ]
}
jpeg_sources += [
# enable arith codec
"$JPEG_CODE_ROOT/jaricom.c",
"$JPEG_CODE_ROOT/jcarith.c",
"$JPEG_CODE_ROOT/jdarith.c",
"$JPEG_CODE_ROOT/jdatadst-tj.c",
"$JPEG_CODE_ROOT/jdatasrc-tj.c",
"$JPEG_CODE_ROOT/rdbmp.c",
"$JPEG_CODE_ROOT/rdppm.c",
"$JPEG_CODE_ROOT/transupp.c",
# enable turbo
"$JPEG_CODE_ROOT/turbojpeg.c",
"$JPEG_CODE_ROOT/wrbmp.c",
"$JPEG_CODE_ROOT/wrppm.c",
]
define_config += [
"C_ARITH_CODING_SUPPORTED=1", #Support arithmetic encoding
"D_ARITH_CODING_SUPPORTED=1", #Support arithmetic decoding
"BMP_SUPPORTED=1", #Support arithmetic decoding
"PPM_SUPPORTED=1", #Support arithmetic decoding
]
config("turbojpeg_config") {
include_dirs += [ "//third_party/libjpeg-turbo" ]
defines = define_config
}
ohos_shared_library("turbojpeg") {
sources = jpeg_sources
public_configs = [ ":turbojpeg_config" ]
subsystem_name = "$SUBSYSTEM_NAME"
part_name = "$PART_NAME"
}
}

183
README.md
View File

@ -1,177 +1,20 @@
OpenPrinting CUPS v2.4.0
========================
![Version](https://img.shields.io/github/v/release/openprinting/cups?include_prereleases)
![Apache 2.0](https://img.shields.io/github/license/openprinting/cups)
[![Build and Test](https://github.com/OpenPrinting/cups/workflows/Build%20and%20Test/badge.svg)](https://github.com/OpenPrinting/cups/actions/workflows/build.yml)
[![Coverity Scan](https://img.shields.io/coverity/scan/23806)](https://scan.coverity.com/projects/openprinting-cups)
Introduction
------------
OpenPrinting CUPS is the most current version of CUPS, a standards-based, open
source printing system for Linux® and other Unix®-like operating systems. CUPS
supports printing to:
- [AirPrint™][1] and [IPP Everywhere™][2] printers,
## cups
### Introduction
OpenPrinting CUPS is the most current version of CUPS, a standards-based, open source printing system for Linux® and other Unix®-like operating systems. CUPS supports printing to:
- AirPrint™ and IPP Everywhere™ printers,
- Network and local (USB) printers with Printer Applications, and
- Network and local (USB) printers with (legacy) PPD-based printer drivers.
CUPS provides the System V ("lp") and Berkeley ("lpr") command-line interfaces,
a configurable web interface, a C API, and common print filters, drivers, and
backends for printing. The [cups-filters][3] project provides additional
filters and drivers.
You can also learn more about the Cups project through [the official website](https://github.com/OpenPrinting/cups)
CUPS is licensed under the Apache License Version 2.0 with an exception to allow
linking against GNU GPL2-only software. See the files `LICENSE` and `NOTICE`
for more information.
### Background Brief
In the process of OpenHarmony's southward ecological development, it is necessary to be compatible with printers in the stock market. The use of cups printing system can directly connect with most printers in the market, which also reduces the difficulty for printer manufacturers to adapt to OpenHarmony.
> Note: Apple maintains a separate repository for the CUPS that ships with macOS
> and iOS at <https://github.com/apple/cups>.
#### Repositories Involved
[third_party_cups-filters](https://gitee.com/openharmony/third_party_cups-filters)
[print_print_fwk](https://gitee.com/openharmony/print_print_fwk)
[1]: https://support.apple.com/en-us/HT201311
[2]: https://www.pwg.org/ipp/everywhere.html
[3]: https://github.com/openprinting/cups-filters
#### Contribution
[How to involve](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/参与贡献.md)
[Commit message spec](https://gitee.com/openharmony/device_qemu/wikis/Commit%20message%E8%A7%84%E8%8C%83)
Reading the Documentation
-------------------------
Initial documentation to get you started is provided in the root directory of
the CUPS sources:
- `CHANGES.md`: A list of changes in the current major release of CUPS.
- `CONTRIBUTING.md`: Guidelines for contributing to the CUPS project.
- `CREDITS.md`: A list of past contributors to the CUPS project.
- `DEVELOPING.md`: Guidelines for developing code for the CUPS project.
- `INSTALL.md`: Instructions for building and installing CUPS.
- `LICENSE`: The CUPS license agreement (Apache 2.0).
- `NOTICE`: Copyright notices and exceptions to the CUPS license agreement.
- `README.md`: This file.
Once you have installed the software you can access the documentation (and a
bunch of other stuff) online at <http://localhost:631/> and using the `man`
command, for example `man cups`.
If you're having trouble getting that far, the documentation is located under
the `doc/help` and `man` directories.
*Please read the documentation before asking questions.*
Getting Support and Other Resources
-----------------------------------
In addition to the OpenPrinting CUPS home page at
<https://openprinting.github.io/cups>, we provide a mailing list for CUPS users
and developers to ask questions and discuss issues at
<https://linuxfoundation.groups.io/g/printing>.
Setting Up Printers
-------------------
CUPS includes a web-based administration tool that allows you to manage
printers, classes, and jobs on your server. Open <http://localhost:631/admin/>
in your browser to access the printer administration tools. You will be asked
for the administration password (root or any other user in the "sys", "system",
"root", "admin", or "lpadmin" group on your system) when performing any
administrative function.
The `lpadmin` command is used to manage printers from the command-line. For
example, the following command creates a print queue called "myprinter" for an
IPP Everywhere printer at address "11.22.33.44":
lpadmin -p myprinter -E -v "ipp://11.22.33.44/ipp/print" -m everywhere
The `-p` option specifies the printer name. The `-E` option enables the printer
and accepts new print jobs immediately. The `-v` option specifies the *device
URI* for the printer, which tells CUPS how to communicate with the printer. And
the `-m` option specifies the model (driver) to use, in this case the IPP
Everywhere ("everywhere") driver that is used for AirPrint and IPP Everywhere
printers as well as shared printers and printers supported through Printer
Applications.
Legacy printers are supported using PPD (PostScript Printer Description) files
that describe printer capabilities and driver programs needed for each printer.
CUPS includes several sample PPD files for common legacy printers:
Driver | PPD Name
-----------------------------|------------------------------
Dymo Label Printers | drv:///sample.drv/dymo.ppd
Intellitech Intellibar | drv:///sample.drv/intelbar.ppd
EPSON 9-pin Series | drv:///sample.drv/epson9.ppd
EPSON 24-pin Series | drv:///sample.drv/epson24.ppd
Generic PCL Laser Printer | drv:///sample.drv/generpcl.ppd
Generic PostScript Printer | drv:///sample.drv/generic.ppd
HP DeskJet Series | drv:///sample.drv/deskjet.ppd
HP LaserJet Series | drv:///sample.drv/laserjet.ppd
OKIDATA 9-Pin Series | drv:///sample.drv/okidata9.ppd
OKIDATA 24-Pin Series | drv:///sample.drv/okidat24.ppd
Zebra CPCL Label Printer | drv:///sample.drv/zebracpl.ppd
Zebra EPL1 Label Printer | drv:///sample.drv/zebraep1.ppd
Zebra EPL2 Label Printer | drv:///sample.drv/zebraep2.ppd
Zebra ZPL Label Printer | drv:///sample.drv/zebra.ppd
The sample drivers provide basic printing capabilities, but generally do not
exercise the full potential of the printers or CUPS. Other drivers provide
greater printing capabilities.
You can run the `lpinfo -m` command to list all of the available drivers:
lpinfo -m
Similarly, the `lpinfo -v` command lists the available printers and their device
URIs:
lpinfo -v
Once you know the device URI and driver name, add the printer using the
`lpadmin` command:
lpadmin -p PRINTER-NAME -E -v "DEVICE-URI" -m DRIVER-NAME
Printing Files
--------------
CUPS provides both the System V `lp` and Berkeley `lpr` commands for printing:
lp FILENAME
lpr FILENAME
Both the `lp` and `lpr` commands support printing options:
lp -o media=A4 -o resolution=600dpi FILENAME
lpr -o media=A4 -o resolution=600dpi FILENAME
CUPS recognizes many types of images files as well as PDF, PostScript, and text
files, so you can print those files directly rather than through an application.
If you have an application that generates output specifically for your printer
then you need to use the `-oraw` or `-l` options:
lp -o raw FILENAME
lpr -l FILENAME
This will prevent the filters from misinterpreting your print file.
Legal Stuff
-----------
Copyright © 2020-2021 by OpenPrinting
Copyright © 2007-2020 by Apple Inc.
Copyright © 1997-2007 by Easy Software Products.
CUPS is provided under the terms of the Apache License, Version 2.0 with
exceptions for GPL2/LGPL2 software. A copy of this license can be found in the
file `LICENSE`. Additional legal information is provided in the file `NOTICE`.
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.

100
README_zh.md Executable file
View File

@ -0,0 +1,100 @@
## 三方开源软件cups
### cups简介
cupsCommon Unix Printing System是一种开源打印系统现在由OpenPrinting组织维护。cups主要功能包括打印队列管理、打印驱动程序管理、网络打印支持等。cups支持多种打印协议包括IPPInternet Printing Protocol、LPDLine Printer Daemon Protocol、AppSocket等。
cups支持以下类型的打印机、AirPrint和IPP Everywhere认证的打印机、带打印机应用程序的网络和USB打印机、基于PPDPostScript Printer Definition打印驱动程序的网络和本地USB打印机。
您也可以通过[cups官网主页](https://github.com/OpenPrinting/cups)了解更多关于cups项目的信息。
### 引入背景简述
Openharmony南向生态发展过程中需要对存量市场的打印机进行兼容。使用cups打印系统能直接对接市场上大部分的打印机也减少了打印机驱动适配OpenHarmony系统的难度。
### 目录结构
```
- LICENSE 版权文件
- OAT.xml OAT.xml过滤配置文件
- README.OpenSource 项目README.OpenSource文件
- README.md 英文说明
- README_zh.md 中文说明
- backport-CVE-2022-26691.patch CVE修复补丁
- backport-CVE-2023-32324.patch CVE修复补丁
- backport-CVE-2023-34241.patch CVE修复补丁
- cups-2.4.0-source.tar.gz cups2.4.0源码压缩tar包
- backport-xxx.patch 上游更新补丁列表
- cups-xxx.patch 上游更新补丁列表
- cups.spec 上游更新记录说明
- cups.yaml 上游yaml文件
- cups_single_file.patch 适配OH编译补丁文件
- pthread_cancel.patch 适配OH编译补丁文件
- install.sh 适配OH编译sh脚本文件
- generate_mime_convs.py 适配OH编译python脚本文件
```
### 如何使用
#### 1、头文件引入
```c
#include <cups/cups-private.h>
```
#### 2、添加编译依赖
在您的 bundle.json 文件 添加
```json
"deps": {
"third_part": [
"cups"
]
}
```
在您的BUILD.gn需要的地方添加依赖
```json
deps += [ "//third_party/cups:cups" ]
```
#### 3、接口使用示例
```c
// 使用cups接口查询打印机能力示例
ipp_t *request; /* IPP Request */
ipp_t *response; /* IPP response */
http_t *http = NULL;
char scheme[HTTP_MAX_URI]; // 协议类型
char username[HTTP_MAX_URI]; // 请求用户名
char host[HTTP_MAX_URI]; // 打印机端口
int port; // 打印机端口
// 声明需要查询哪些打印机能力,此处为所有
static const char * const pattrs[] = {
"all"
};
// 使用打印机ip和端口连接打印机
http = httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED, 1, TIME_OUT, NULL);
if (http == nullptr) {
return;
}
// 构造获取打印机能力的request
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
// 指定请求uri
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerUri.c_str());
// 指定请求的用户
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
// 指定请求哪些打印机属性
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",
(int)(sizeof(pattrs) / sizeof(pattrs[0])), NULL, pattrs);
// 调用cups接口发送ipp请求
response = cupsDoRequest(http, request, "/");
// 处理请求结果
if (cupsLastError() > IPP_STATUS_OK_CONFLICTING) {
ippDelete(response);
return;
}
// 关闭http
httpClose(http);
```
### 相关仓
[third_party_cups-filters](https://gitee.com/openharmony/third_party_cups-filters)
[print_print_fwk](https://gitee.com/openharmony/print_print_fwk)
### 参与贡献
[如何贡献](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/contribute/参与贡献.md)
[Commit message规范](https://gitee.com/openharmony/device_qemu/wikis/Commit%20message%E8%A7%84%E8%8C%83)

14
generate_mime_convs.py Normal file → Executable file
View File

@ -14,13 +14,21 @@
# limitations under the License.
import sys
import shutil
import os
import shutil
def copy_file(dir):
src_name = '/mime.convs.in'
dest_name = '/mime.convs'
src_file = dir + src_name
dest_file = dir + dest_name
print(f'copy from %s to %s', src_file, dest_file)
shutil.copy2(src_file, dest_file)
def main():
shutil.copy2("../../../third_party/cups/cups-2.4.0/conf/mime.convs.in",
"../../../third_party/cups/cups-2.4.0/conf/mime.convs")
args = sys.argv[1:]
print(f'args: {args}')
copy_file(args[0])
return 0
if __name__ == '__main__':

0
install.sh Normal file → Executable file
View File

9
patches/patches.json Normal file
View File

@ -0,0 +1,9 @@
{
"patches": [
{
"project":"print_print_fwk",
"path":"base/print/print_fwk",
"pr_url":"https://gitee.com/openharmony/print_print_fwk/pulls/93"
}
]
}