Add libpcap package

This commit is contained in:
Orgad Shaneh 2021-04-12 17:22:51 +03:00
parent 42e11da8e9
commit cd8e0fa399
4 changed files with 182 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From cc8131feac011954b6b1cc1a9bfde6172d359a05 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Mon, 12 Apr 2021 18:12:30 +0300
Subject: [PATCH 1/2] Fix symlinking with DESTDIR
make install DESTDIR=/path/inst failed on symlink.
---
CMakeLists.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50bf1713..2b258564 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2504,20 +2504,20 @@ function(install_manpage_symlink SOURCE TARGET MANDIR)
# If we haven't found an ln executable with MinGW, we don't try
# generating and installing the man pages, so if we get here,
# we've found that executable.
- set(LINK_COMMAND "\"${LINK_EXECUTABLE}\" \"-s\" \"${SOURCE}\" \"${TARGET}\"")
+ set(LINK_COMMAND "\"${LINK_EXECUTABLE}\" \"-s\" \$ENV{DESTDIR}\"${SOURCE}\" \"${TARGET}\"")
else(MINGW)
- set(LINK_COMMAND "\"${CMAKE_COMMAND}\" \"-E\" \"create_symlink\" \"${SOURCE}\" \"${TARGET}\"")
+ set(LINK_COMMAND "\"${CMAKE_COMMAND}\" \"-E\" \"create_symlink\" \$ENV{DESTDIR}\"${SOURCE}\" \"${TARGET}\"")
endif(MINGW)
install(CODE
"message(STATUS \"Symlinking: ${CMAKE_INSTALL_PREFIX}/${MANDIR}/${SOURCE} to ${TARGET}\")
execute_process(
COMMAND \"${CMAKE_COMMAND}\" \"-E\" \"remove\" \"${TARGET}\"
- WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${MANDIR}
+ WORKING_DIRECTORY \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${MANDIR}
)
execute_process(
COMMAND ${LINK_COMMAND}
- WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${MANDIR}
+ WORKING_DIRECTORY \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${MANDIR}
RESULT_VARIABLE EXIT_STATUS
)
if(NOT EXIT_STATUS EQUAL 0)
--
2.31.0.windows.1

View File

@ -0,0 +1,49 @@
From 23e0b17fe5b82c84d8d1bd5b6f50f5c78307d4e9 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Mon, 12 Apr 2021 18:14:39 +0300
Subject: [PATCH 2/2] Fix Cygwin/MSYS target directories
CYGWIN doesn't define WIN32 since 2.8.4.
---
CMakeLists.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b258564..9df65cf0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2600,7 +2600,7 @@ if(NOT BUILD_SHARED_LIBS)
unset(LIBRARY_NAME)
endif(NOT BUILD_SHARED_LIBS)
-if(WIN32)
+if(WIN32 OR CYGWIN)
if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
#
# Install 64-bit code built with MSVC in the x64 subdirectories,
@@ -2628,18 +2628,18 @@ if(WIN32)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
- if(NOT MINGW)
+ if(MSVC)
install(FILES $<TARGET_FILE_DIR:${LIBRARY_NAME_STATIC}>/${LIBRARY_NAME_STATIC}.pdb
DESTINATION bin OPTIONAL)
if(BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:${LIBRARY_NAME}>
DESTINATION bin OPTIONAL)
endif(BUILD_SHARED_LIBS)
- endif(NOT MINGW)
+ endif(MSVC)
endif(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
-else(WIN32)
+else(WIN32 OR CYGWIN)
install(TARGETS ${LIBRARY_NAME} ${LIBRARY_NAME_STATIC} DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
-endif(WIN32)
+endif(WIN32 OR CYGWIN)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pcap/ DESTINATION include/pcap)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
--
2.31.0.windows.1

View File

@ -0,0 +1,34 @@
From c0ae0e050f995631bc04e99de7d6b046f6c52d59 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Mon, 12 Apr 2021 18:49:46 +0300
Subject: [PATCH 3/3] Disable man symlinks
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9df65cf0..f8fd3495 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2702,7 +2702,7 @@ if(NOT MSVC)
if(MINGW)
find_program(LINK_EXECUTABLE ln)
endif(MINGW)
- if(UNIX OR (MINGW AND LINK_EXECUTABLE))
+ if(FALSE)
set(MAN1 "")
foreach(MANPAGE ${MAN1_NOEXPAND})
set(MAN1 ${MAN1} ${CMAKE_CURRENT_SOURCE_DIR}/${MANPAGE})
@@ -2752,7 +2752,7 @@ if(NOT MSVC)
set(MANMISC ${MANMISC} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
endforeach(TEMPLATE_MANPAGE)
install(FILES ${MANMISC} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_MISC_INFO})
- endif(UNIX OR (MINGW AND LINK_EXECUTABLE))
+ endif(FALSE)
endif(NOT MSVC)
# uninstall target
--
2.31.0.windows.1

57
libpcap/PKGBUILD Normal file
View File

@ -0,0 +1,57 @@
# Maintainer: Orgad Shaneh <orgads@gmail.com>
pkgbase=libpcap
pkgname=('libpcap' 'libpcap-devel')
pkgver=1.10.0
pkgrel=1
pkgdesc="A portable C/C++ library for network traffic capture"
arch=('i686' 'x86_64')
license=('BSD')
url="https://www.tcpdump.org/"
makedepends=('bison' 'cmake' 'flex' 'gcc' 'make' 'openssl-devel')
source=(https://www.tcpdump.org/release/${pkgname}-${pkgver}.tar.gz
0001-Fix-symlinking-with-DESTDIR.patch
0002-Fix-Cygwin-MSYS-target-directories.patch
0003-Disable-man-symlinks.patch)
sha256sums=('8d12b42623eeefee872f123bd0dc85d535b00df4d42e865f993c40f7bfc92b1e'
'e5e47f7aa271f8d92cf19525bfb301c7e158e3e4a96d870a03bc5eae141b92a0'
'dc69c6be0c39f37cf957d4b4fe5b9b56748a9e6a456836777651470de40d7c2c'
'cc3e4218937f5c75448ddcb3b09b1ad90c11ca2a01ade1defe900cba60893e8e')
prepare() {
cd ${srcdir}/${pkgbase}-${pkgver}
patch -p1 -i ${srcdir}/0001-Fix-symlinking-with-DESTDIR.patch
patch -p1 -i ${srcdir}/0002-Fix-Cygwin-MSYS-target-directories.patch
patch -p1 -i ${srcdir}/0003-Disable-man-symlinks.patch
}
build() {
mkdir -p build-${pkgbase}-${pkgver}-${CHOST}
cd build-${pkgbase}-${pkgver}-${CHOST}
cmake \
-DCMAKE_INSTALL_PREFIX="/usr" \
../${pkgbase}-${pkgver}
make DESTDIR=${srcdir}/dest install
}
package_libpcap() {
pkgdesc="A portable C/C++ library for network traffic capture"
groups=('libraries')
depends=('gcc-libs')
mkdir -p ${pkgdir}/usr/bin
cp -f ${srcdir}/dest/usr/bin/*.dll ${pkgdir}/usr/bin/
}
package_libpcap-devel() {
pkgdesc="Libpcap headers and libraries"
groups=('development')
depends=("libpcap=${pkgver}")
options=('staticlibs')
mkdir -p ${pkgdir}/usr/bin
cp -f ${srcdir}/dest/usr/bin/pcap-config ${pkgdir}/usr/bin
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
}