-
Notifications
You must be signed in to change notification settings - Fork 2k
dnet: add 1.16.3 #16372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
dnet: add 1.16.3 #16372
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8d44fa5
Init libdnet
xakod 9c5dd33
move to cmake
xakod 046cd85
prepare for cmake
xakod 518e7f1
rename package
xakod a51cabc
fix license
xakod 40858c4
fix write header
bc00fbf
fix libcxx and cppstd
0af3495
bump to upstream
xakod 8003c58
Apply suggestions from code review
a789d07
Merge branch 'master' into libdnet
jcar87 cf67efe
Remove test_v1_package, fix configure method
jcar87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.17.0": | ||
url: "https://github.com/ofalk/libdnet/archive/refs/tags/libdnet-1.17.0.tar.gz" | ||
sha256: "6be1ed0763151ede4c9665a403f1c9d974b2ffab2eacdb26b22078e461aae1dc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.files import copy, get, rmdir | ||
import os | ||
|
||
|
||
required_conan_version = ">=1.56.0" | ||
|
||
|
||
class dnetConan(ConanFile): | ||
name = "dnet" | ||
description = "Provides a simplified, portable interface to several low-level networking routines." | ||
homepage = "https://github.com/ofalk/libdnet" | ||
topics = ("dnet", "libdnet", "libdumbnet") | ||
license = "BSD-3-Clause" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
package_type = "library" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True | ||
} | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
# This is a pure C project | ||
self.settings.rm_safe("compiler.cppstd") | ||
self.settings.rm_safe("compiler.libcxx") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.generate() | ||
|
||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self,"LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.install() | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs.append("dnet") | ||
self.cpp_info.includedirs.append(os.path.join("include", "dnet")) | ||
|
||
if self.settings.os == 'Windows': | ||
self.cpp_info.system_libs = ['Iphlpapi', 'wsock32'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
find_package(dnet REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE dnet::dnet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run("{} {}".format(bin_path, "127.0.0.1"), env="conanrun") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <dnet/dnet.h> | ||
#include <dnet/config.h> | ||
#include <dnet/err.h> | ||
|
||
#include <sys/types.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) | ||
#include <unistd.h> | ||
#elif defined(_WIN32) | ||
#include <io.h> | ||
#endif | ||
|
||
void addr_usage(void) | ||
{ | ||
fprintf(stderr, "Usage: dnet addr <address> ...\n"); | ||
exit(1); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
struct addr addr; | ||
int c, len; | ||
|
||
if (argc == 1 || *(argv[1]) == '-') | ||
addr_usage(); | ||
|
||
for (c = 1; c < argc; c++) { | ||
if (addr_aton(argv[c], &addr) < 0) | ||
addr_usage(); | ||
|
||
len = addr.addr_bits / 8; | ||
|
||
if (write(1, addr.addr_data8, len) != len) | ||
err(1, "write"); | ||
} | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.17.0": | ||
folder: "all" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.