Open
LLVM平行宇宙:支持使用clang构建ppp #43
AtomGit-BotAdd on Nov 3, 2023
LLVM平行宇宙:支持使用clang构建ppp #43
Open
Merged fromrefs/pull/43/headintoopenEuler-22.03-LTS-Next
Total: 2 files changed+102-3
| @@ -0,0 +1,92 @@ | |||
| 1 | +From dd119016a952283b85e341676d6eb7a3b64567da Mon Sep 17 00:00:00 2001 | ||
| 2 | +From: 15859157387 <977713017@qq.com> | ||
| 3 | +Date: Thu, 2 Nov 2023 20:03:01 +0800 | ||
| 4 | +Subject: [PATCH] support clang compile | ||
| 5 | + | ||
| 6 | +--- | ||
| 7 | + configure | 2 +- | ||
| 8 | + pppd/Makefile.linux | 2 ++ | ||
| 9 | + pppd/eap-tls.c | 19 ++++++++----------- | ||
| 10 | + pppd/pppcrypt.h | 2 +- | ||
| 11 | + 4 files changed, 12 insertions(+), 13 deletions(-) | ||
| 12 | + | ||
| 13 | +diff --git a/configure b/configure | ||
| 14 | +index f977663..872e192 100755 | ||
| 15 | +--- a/configure | ||
| 16 | ++++ b/configure | ||
| 17 | +@@ -7,7 +7,7 @@ SYSCONF=/etc | ||
| 18 | + | ||
| 19 | + # Compile defaults | ||
| 20 | + CROSS_COMPILE= | ||
| 21 | +-CC=cc | ||
| 22 | ++CC?=gcc | ||
| 23 | + CFLAGS= | ||
| 24 | + | ||
| 25 | + system=`uname -s` | ||
| 26 | +diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux | ||
| 27 | +index 22837c5..2fc205f 100644 | ||
| 28 | +--- a/pppd/Makefile.linux | ||
| 29 | ++++ b/pppd/Makefile.linux | ||
| 30 | +@@ -155,7 +155,9 @@ endif | ||
| 31 | + | ||
| 32 | + ifdef NEEDDES | ||
| 33 | + ifndef USE_CRYPT | ||
| 34 | ++ifeq ($(CC),"cc") | ||
| 35 | + CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl | ||
| 36 | ++endif | ||
| 37 | + NEEDCRYPTOLIB = y | ||
| 38 | + else | ||
| 39 | + CFLAGS += -DUSE_CRYPT=1 | ||
| 40 | +diff --git a/pppd/eap-tls.c b/pppd/eap-tls.c | ||
| 41 | +index 5740f30..567ca74 100644 | ||
| 42 | +--- a/pppd/eap-tls.c | ||
| 43 | ++++ b/pppd/eap-tls.c | ||
| 44 | +@@ -278,7 +278,14 @@ ENGINE *eaptls_ssl_load_engine( char *engine_name ) | ||
| 45 | + return e; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | +- | ||
| 49 | ++int writer (UI *ui, UI_STRING *uis) | ||
| 50 | ++{ | ||
| 51 | ++ PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui); | ||
| 52 | ++ UI_set_result(ui, uis, cb_data->password); | ||
| 53 | ++ return 1; | ||
| 54 | ++}; | ||
| 55 | ++int stub (UI* ui) {return 1;}; | ||
| 56 | ++int stub_reader (UI *ui, UI_STRING *uis) {return 1;}; | ||
| 57 | + | ||
| 58 | + /* | ||
| 59 | + * Initialize the SSL stacks and tests if certificates, key and crl | ||
| 60 | +@@ -515,16 +522,6 @@ SSL_CTX *eaptls_init_ssl(int init_server, char *cacertfile, char *capath, | ||
| 61 | + if (passwd[0] != 0) | ||
| 62 | + { | ||
| 63 | + UI_METHOD* transfer_pin = UI_create_method("transfer_pin"); | ||
| 64 | +- | ||
| 65 | +- int writer (UI *ui, UI_STRING *uis) | ||
| 66 | +- { | ||
| 67 | +- PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui); | ||
| 68 | +- UI_set_result(ui, uis, cb_data->password); | ||
| 69 | +- return 1; | ||
| 70 | +- }; | ||
| 71 | +- int stub (UI* ui) {return 1;}; | ||
| 72 | +- int stub_reader (UI *ui, UI_STRING *uis) {return 1;}; | ||
| 73 | +- | ||
| 74 | + UI_method_set_writer(transfer_pin, writer); | ||
| 75 | + UI_method_set_opener(transfer_pin, stub); | ||
| 76 | + UI_method_set_closer(transfer_pin, stub); | ||
| 77 | +diff --git a/pppd/pppcrypt.h b/pppd/pppcrypt.h | ||
| 78 | +index 364940e..0f71bb3 100644 | ||
| 79 | +--- a/pppd/pppcrypt.h | ||
| 80 | ++++ b/pppd/pppcrypt.h | ||
| 81 | +@@ -38,7 +38,7 @@ | ||
| 82 | + #endif | ||
| 83 | + | ||
| 84 | + #ifndef USE_CRYPT | ||
| 85 | +-#include <des.h> | ||
| 86 | ++#include <openssl/des.h> | ||
| 87 | + #endif | ||
| 88 | + | ||
| 89 | + extern bool DesSetkey(u_char *); | ||
| 90 | +-- | ||
| 91 | +2.27.0 | ||
| 92 | + | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | Name: ppp | 1 | Name: ppp |
| 2 | Version: 2.4.9 | 2 | Version: 2.4.9 |
| 3 | -Release: 6 | 3 | +Release: 7 |
| 4 | Summary: The Point-to-Point Protocol | 4 | Summary: The Point-to-Point Protocol |
| 5 | 5 | ||
| 6 | License: BSD and LGPLv2+ and GPLv2+ and Public Domain | 6 | License: BSD and LGPLv2+ and GPLv2+ and Public Domain |
| @@ -47,6 +47,7 @@ Patch0017: backport-0027-Set-LIBDIR-for-RISCV.patch | |||
| 47 | Patch0018: backport-pppd-Negotiate-IP-address-when-only-peer-addresses-are-provided.patch | 47 | Patch0018: backport-pppd-Negotiate-IP-address-when-only-peer-addresses-are-provided.patch |
| 48 | Patch0019: backport-CVE-2022-4603.patch | 48 | Patch0019: backport-CVE-2022-4603.patch |
| 49 | Patch0020: backport-add-fclose-operation-to-fix-file-pointer-not-closed.patch | 49 | Patch0020: backport-add-fclose-operation-to-fix-file-pointer-not-closed.patch |
| 50 | +Patch0021: backport-0028-support-clang-compile.patch | ||
| 50 | 51 | ||
| 51 | %description | 52 | %description |
| 52 | The Point-to-Point Protocol (PPP) provides a standard way to establish | 53 | The Point-to-Point Protocol (PPP) provides a standard way to establish |
| @@ -81,8 +82,8 @@ cp %{SOURCE9} network-scripts | |||
| 81 | 82 | ||
| 82 | %build | 83 | %build |
| 83 | %configure --cflags="$RPM_OPT_FLAGS -fPIC -Wall -fno-strict-aliasing" | 84 | %configure --cflags="$RPM_OPT_FLAGS -fPIC -Wall -fno-strict-aliasing" |
| 84 | -%{make_build} LDFLAGS="%{?build_ldflags} -pie" | 85 | +%{make_build} CC=%{__cc} LDFLAGS="%{?build_ldflags} -pie" |
| 85 | -%{make_build} -C ppp-watch LDFLAGS="%{?build_ldflags} -pie" | 86 | +%{make_build} CC=%{__cc} -C ppp-watch LDFLAGS="%{?build_ldflags} -pie" |
| 86 | 87 | ||
| 87 | %install | 88 | %install |
| 88 | make install INSTROOT=$RPM_BUILD_ROOT install-etcppp | 89 | make install INSTROOT=$RPM_BUILD_ROOT install-etcppp |
| @@ -142,6 +143,12 @@ mkdir -p %{buildroot}%{_rundir}/lock/ppp | |||
| 142 | %{_mandir}/man8/*.8.gz | 143 | %{_mandir}/man8/*.8.gz |
| 143 | 144 | ||
| 144 | %changelog | 145 | %changelog |
| 146 | +* Fri Nov 3 2023 renyi <977713017@qq.com> - 2.4.9-7 | ||
| 147 | +- Type:NA | ||
| 148 | +- ID:NA | ||
| 149 | +- SUG:NA | ||
| 150 | +- DESC:support clang compile | ||
| 151 | + | ||
| 145 | * Mon Sep 11 2023 xingwei <xingwei14@h-partners.com> - 2.4.9-6 | 152 | * Mon Sep 11 2023 xingwei <xingwei14@h-partners.com> - 2.4.9-6 |
| 146 | - Type:bugfix | 153 | - Type:bugfix |
| 147 | - ID:NA | 154 | - ID:NA |
不是原生社区的补丁,名称不用带backport,请去掉backport-0028前缀