From f70f7470450334e559b6bd77a8d50218ec32806f Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Mon, 25 Oct 2021 21:06:47 +0800 Subject: [PATCH] Initial commit --- devel/ccls/Makefile | 29 +++++++++ devel/ccls/distinfo | 2 + devel/ccls/pkg/DESCR | 4 ++ devel/ccls/pkg/PLIST | 2 + devel/rapidjson/Makefile | 24 ++++++++ devel/rapidjson/distinfo | 2 + devel/rapidjson/pkg/DESCR | 4 ++ devel/rapidjson/pkg/PLIST | 79 +++++++++++++++++++++++++ net/trojan/Makefile | 37 ++++++++++++ net/trojan/distinfo | 2 + net/trojan/patches/patch-CMakeLists_txt | 27 +++++++++ net/trojan/patches/patch-docs_trojan_1 | 15 +++++ net/trojan/patches/patch-docs_usage_md | 13 ++++ net/trojan/patches/patch-src_main_cpp | 53 +++++++++++++++++ net/trojan/pkg/DESCR | 6 ++ net/trojan/pkg/PLIST | 17 ++++++ net/trojan/pkg/trojan.rc | 14 +++++ 17 files changed, 330 insertions(+) create mode 100644 devel/ccls/Makefile create mode 100644 devel/ccls/distinfo create mode 100644 devel/ccls/pkg/DESCR create mode 100644 devel/ccls/pkg/PLIST create mode 100644 devel/rapidjson/Makefile create mode 100644 devel/rapidjson/distinfo create mode 100644 devel/rapidjson/pkg/DESCR create mode 100644 devel/rapidjson/pkg/PLIST create mode 100644 net/trojan/Makefile create mode 100644 net/trojan/distinfo create mode 100644 net/trojan/patches/patch-CMakeLists_txt create mode 100644 net/trojan/patches/patch-docs_trojan_1 create mode 100644 net/trojan/patches/patch-docs_usage_md create mode 100644 net/trojan/patches/patch-src_main_cpp create mode 100644 net/trojan/pkg/DESCR create mode 100644 net/trojan/pkg/PLIST create mode 100644 net/trojan/pkg/trojan.rc diff --git a/devel/ccls/Makefile b/devel/ccls/Makefile new file mode 100644 index 0000000..45778e7 --- /dev/null +++ b/devel/ccls/Makefile @@ -0,0 +1,29 @@ +# $OpenBSD$ + +COMMENT = C/C++/ObjC language server +HOMEPAGE = https://github.com/MaskRay/ccls +MAINTAINER = Nick Gasson +CATEGORIES = devel + +GH_ACCOUNT = MaskRay +GH_PROJECT = ccls +GH_TAGNAME = 0.20210330 + +MODULES = devel/cmake + +# Apache 2.0 +PERMIT_PACKAGE = Yes + +COMPILER = base-clang +COMPILER_LANGS = c++ + +BUILD_DEPENDS = devel/llvm devel/rapidjson +RUN_DEPENDS = devel/llvm + +WANTLIB = c clang-cpp m pthread ${COMPILER_LIBCXX} + +CONFIGURE_ARGS = -DUSE_SYSTEM_RAPIDJSON=ON -DCLANG_LINK_CLANG_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DCCLS_VERSION=$(GH_TAGNAME) + +.include diff --git a/devel/ccls/distinfo b/devel/ccls/distinfo new file mode 100644 index 0000000..26a335c --- /dev/null +++ b/devel/ccls/distinfo @@ -0,0 +1,2 @@ +SHA256 (ccls-0.20210330.tar.gz) = KMIo9J38DyPLXVgbfeNXkmSPMsOfTKNfaP+MnLXOVsI= +SIZE (ccls-0.20210330.tar.gz) = 160487 diff --git a/devel/ccls/pkg/DESCR b/devel/ccls/pkg/DESCR new file mode 100644 index 0000000..e865ba3 --- /dev/null +++ b/devel/ccls/pkg/DESCR @@ -0,0 +1,4 @@ +ccls is a C/C++/Objective-C language server supporting most features of +the LSP protocol including code completion, cross references, +formatting, caller/callee hierarchies, symbol renaming, diagnostics, +semantic highlighting, and more. diff --git a/devel/ccls/pkg/PLIST b/devel/ccls/pkg/PLIST new file mode 100644 index 0000000..c9c96b1 --- /dev/null +++ b/devel/ccls/pkg/PLIST @@ -0,0 +1,2 @@ +@comment $OpenBSD: PLIST,v$ +@bin bin/ccls diff --git a/devel/rapidjson/Makefile b/devel/rapidjson/Makefile new file mode 100644 index 0000000..d74ae10 --- /dev/null +++ b/devel/rapidjson/Makefile @@ -0,0 +1,24 @@ +# $OpenBSD$ + +COMMENT = fast header only JSON parser/generator for C++ +HOMEPAGE = https://rapidjson.org/ +MAINTAINER = Nick Gasson +CATEGORIES = devel + +GH_ACCOUNT = Tencent +GH_PROJECT = rapidjson +GH_TAGNAME = v1.1.0 + +MODULES = devel/cmake + +# MIT +PERMIT_PACKAGE = Yes + +COMPILER = base-clang ports-gcc + +CONFIGURE_ARGS = -DRAPIDJSON_BUILD_DOC=NO -DRAPIDJSON_BUILD_EXAMPLES=NO + +# Needs gtest source +NO_TEST = Yes + +.include diff --git a/devel/rapidjson/distinfo b/devel/rapidjson/distinfo new file mode 100644 index 0000000..22053ae --- /dev/null +++ b/devel/rapidjson/distinfo @@ -0,0 +1,2 @@ +SHA256 (rapidjson-1.1.0.tar.gz) = v3ztKXBKHmlvvM8qK06gaOd3T6N/bX3UA50Hh/i+2Y4= +SIZE (rapidjson-1.1.0.tar.gz) = 1019402 diff --git a/devel/rapidjson/pkg/DESCR b/devel/rapidjson/pkg/DESCR new file mode 100644 index 0000000..c3c263c --- /dev/null +++ b/devel/rapidjson/pkg/DESCR @@ -0,0 +1,4 @@ +RapidJSON is a self-contained and header-only JSON parser and generator +for C++ with both SAX and DOM style APIs. It fully supports UTF-8, +UTF-16, UTF-32 (LE & BE) and also optionally supports SSE2/SSE4.2 for +acceleration. diff --git a/devel/rapidjson/pkg/PLIST b/devel/rapidjson/pkg/PLIST new file mode 100644 index 0000000..bead5bd --- /dev/null +++ b/devel/rapidjson/pkg/PLIST @@ -0,0 +1,79 @@ +@comment $OpenBSD: PLIST,v$ +include/rapidjson/ +include/rapidjson/allocators.h +include/rapidjson/document.h +include/rapidjson/encodedstream.h +include/rapidjson/encodings.h +include/rapidjson/error/ +include/rapidjson/error/en.h +include/rapidjson/error/error.h +include/rapidjson/filereadstream.h +include/rapidjson/filewritestream.h +include/rapidjson/fwd.h +include/rapidjson/internal/ +include/rapidjson/internal/biginteger.h +include/rapidjson/internal/diyfp.h +include/rapidjson/internal/dtoa.h +include/rapidjson/internal/ieee754.h +include/rapidjson/internal/itoa.h +include/rapidjson/internal/meta.h +include/rapidjson/internal/pow10.h +include/rapidjson/internal/regex.h +include/rapidjson/internal/stack.h +include/rapidjson/internal/strfunc.h +include/rapidjson/internal/strtod.h +include/rapidjson/internal/swap.h +include/rapidjson/istreamwrapper.h +include/rapidjson/memorybuffer.h +include/rapidjson/memorystream.h +include/rapidjson/msinttypes/ +include/rapidjson/msinttypes/inttypes.h +include/rapidjson/msinttypes/stdint.h +include/rapidjson/ostreamwrapper.h +include/rapidjson/pointer.h +include/rapidjson/prettywriter.h +include/rapidjson/rapidjson.h +include/rapidjson/reader.h +include/rapidjson/schema.h +include/rapidjson/stream.h +include/rapidjson/stringbuffer.h +include/rapidjson/writer.h +lib/cmake/ +lib/cmake/RapidJSON/ +lib/cmake/RapidJSON/RapidJSONConfig.cmake +lib/cmake/RapidJSON/RapidJSONConfigVersion.cmake +lib/pkgconfig/RapidJSON.pc +share/doc/RapidJSON/ +share/doc/RapidJSON/examples/ +share/doc/RapidJSON/examples/CMakeLists.txt +share/doc/RapidJSON/examples/capitalize/ +share/doc/RapidJSON/examples/capitalize/capitalize.cpp +share/doc/RapidJSON/examples/condense/ +share/doc/RapidJSON/examples/condense/condense.cpp +share/doc/RapidJSON/examples/filterkey/ +share/doc/RapidJSON/examples/filterkey/filterkey.cpp +share/doc/RapidJSON/examples/filterkeydom/ +share/doc/RapidJSON/examples/filterkeydom/filterkeydom.cpp +share/doc/RapidJSON/examples/jsonx/ +share/doc/RapidJSON/examples/jsonx/jsonx.cpp +share/doc/RapidJSON/examples/messagereader/ +share/doc/RapidJSON/examples/messagereader/messagereader.cpp +share/doc/RapidJSON/examples/parsebyparts/ +share/doc/RapidJSON/examples/parsebyparts/parsebyparts.cpp +share/doc/RapidJSON/examples/pretty/ +share/doc/RapidJSON/examples/pretty/pretty.cpp +share/doc/RapidJSON/examples/prettyauto/ +share/doc/RapidJSON/examples/prettyauto/prettyauto.cpp +share/doc/RapidJSON/examples/schemavalidator/ +share/doc/RapidJSON/examples/schemavalidator/schemavalidator.cpp +share/doc/RapidJSON/examples/serialize/ +share/doc/RapidJSON/examples/serialize/serialize.cpp +share/doc/RapidJSON/examples/simpledom/ +share/doc/RapidJSON/examples/simpledom/simpledom.cpp +share/doc/RapidJSON/examples/simplereader/ +share/doc/RapidJSON/examples/simplereader/simplereader.cpp +share/doc/RapidJSON/examples/simplewriter/ +share/doc/RapidJSON/examples/simplewriter/simplewriter.cpp +share/doc/RapidJSON/examples/tutorial/ +share/doc/RapidJSON/examples/tutorial/tutorial.cpp +share/doc/RapidJSON/readme.md diff --git a/net/trojan/Makefile b/net/trojan/Makefile new file mode 100644 index 0000000..6dc0a96 --- /dev/null +++ b/net/trojan/Makefile @@ -0,0 +1,37 @@ +# $OpenBSD$ +# + +COMMENT = unidentifiable mechanism for bypassing GFW +CATEGORIES = net + +GH_ACCOUNT = trojan-gfw +GH_PROJECT = trojan +GH_TAGNAME = v1.16.0 + +MODULES = devel/cmake + +HOMEPAGE = https://trojan-gfw.github.io/trojan/ + +MAINTAINER = Nick Gasson + +# GPLv3 +PERMIT_PACKAGE = Yes + +# If pledge is used, annotate with `uses pledge()' in a comment + +WANTLIB += ${COMPILER_LIBCXX} c crypto m ssl +WANTLIB += boost_program_options-mt boost_system-mt + +COMPILER = base-clang ports-gcc + +#BUILD_DEPENDS = devel/boost +#RUN_DEPENDS = ??? +LIB_DEPENDS = devel/boost +#TEST_DEPENDS = ??? + +CONFIGURE_ARGS = -DENABLE_MYSQL=OFF \ + -DENABLE_TLS13_CIPHERSUITES=OFF \ + -DENABLE_SSL_KEYLOG=OFF \ + -DDEFAULT_CONFIG="${SYSCONFDIR}/trojan/config.json" + +.include diff --git a/net/trojan/distinfo b/net/trojan/distinfo new file mode 100644 index 0000000..456f092 --- /dev/null +++ b/net/trojan/distinfo @@ -0,0 +1,2 @@ +SHA256 (trojan-1.16.0.tar.gz) = hs2yaFuwOmO2LOBlRcQRiZUvHsSgzZFHRQMS7XCVbLw= +SIZE (trojan-1.16.0.tar.gz) = 51669 diff --git a/net/trojan/patches/patch-CMakeLists_txt b/net/trojan/patches/patch-CMakeLists_txt new file mode 100644 index 0000000..71e8dbc --- /dev/null +++ b/net/trojan/patches/patch-CMakeLists_txt @@ -0,0 +1,27 @@ +$OpenBSD$ + +Index: CMakeLists.txt +--- CMakeLists.txt.orig ++++ CMakeLists.txt +@@ -107,7 +107,7 @@ else() + + include(GNUInstallDirs) + install(TARGETS trojan DESTINATION ${CMAKE_INSTALL_BINDIR}) +- install(FILES examples/server.json-example DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/trojan RENAME config.json) ++ #install(FILES examples/server.json-example DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/trojan RENAME config.json) + set(DEFAULT_CONFIG ${CMAKE_INSTALL_FULL_SYSCONFDIR}/trojan/config.json CACHE STRING "Default config path") + add_definitions(-DDEFAULT_CONFIG="${DEFAULT_CONFIG}") + install(FILES docs/trojan.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) +@@ -119,6 +119,12 @@ else() + set(CONFIG_NAME %i) + configure_file(examples/trojan.service-example trojan@.service) + install(FILES ${CMAKE_BINARY_DIR}/trojan.service ${CMAKE_BINARY_DIR}/trojan@.service DESTINATION ${SYSTEMD_SERVICE_PATH}) ++ endif() ++ ++ include(CheckSymbolExists) ++ check_symbol_exists(daemon "stdlib.h;unistd.h" HAVE_DAEMON) ++ if(HAVE_DAEMON) ++ add_definitions(-DHAVE_DAEMON) + endif() + + enable_testing() diff --git a/net/trojan/patches/patch-docs_trojan_1 b/net/trojan/patches/patch-docs_trojan_1 new file mode 100644 index 0000000..0d8e306 --- /dev/null +++ b/net/trojan/patches/patch-docs_trojan_1 @@ -0,0 +1,15 @@ +$OpenBSD$ + +Index: docs/trojan.1 +--- docs/trojan.1.orig ++++ docs/trojan.1 +@@ -14,6 +14,9 @@ and start either a proxy client or a proxy server. + .BR \-c, " " \-\-config=\fICONFIG\fR + Set the config file to be loaded. Default is \fI/etc/trojan/config.json\fR. + .TP ++.BR \-d, " " \-\-daemon ++Detach from the terminal and run in the background as a daemon. ++.TP + .BR \-h, " " \-\-help + Print help message. + .TP diff --git a/net/trojan/patches/patch-docs_usage_md b/net/trojan/patches/patch-docs_usage_md new file mode 100644 index 0000000..8b219d4 --- /dev/null +++ b/net/trojan/patches/patch-docs_usage_md @@ -0,0 +1,13 @@ +$OpenBSD$ + +Index: docs/usage.md +--- docs/usage.md.orig ++++ docs/usage.md +@@ -4,6 +4,7 @@ + usage: ./trojan [-htv] [-l LOG] [-k KEYLOG] [[-c] CONFIG] + options: + -c [ --config ] CONFIG specify config file ++ -d [ --daemon ] fork into background + -h [ --help ] print help message + -k [ --keylog ] KEYLOG specify keylog file location (OpenSSL >= 1.1.1) + -l [ --log ] LOG specify log file location diff --git a/net/trojan/patches/patch-src_main_cpp b/net/trojan/patches/patch-src_main_cpp new file mode 100644 index 0000000..aebf849 --- /dev/null +++ b/net/trojan/patches/patch-src_main_cpp @@ -0,0 +1,53 @@ +$OpenBSD$ + +Index: src/main.cpp +--- src/main.cpp.orig ++++ src/main.cpp +@@ -26,6 +26,9 @@ + #ifdef ENABLE_MYSQL + #include + #endif // ENABLE_MYSQL ++#ifdef HAVE_DAEMON ++#include ++#endif // HAVE_DAEMON + #include "core/service.h" + #include "core/version.h" + using namespace std; +@@ -68,9 +71,11 @@ int main(int argc, const char *argv[]) { + string log_file; + string keylog_file; + bool test; ++ bool do_daemon; + po::options_description desc("options"); + desc.add_options() + ("config,c", po::value(&config_file)->default_value(DEFAULT_CONFIG)->value_name("CONFIG"), "specify config file") ++ ("daemon,d", po::bool_switch(&do_daemon), "fork into background") + ("help,h", "print help message") + ("keylog,k", po::value(&keylog_file)->value_name("KEYLOG"), "specify keylog file location (OpenSSL >= 1.1.1)") + ("log,l", po::value(&log_file)->value_name("LOG"), "specify log file location") +@@ -83,7 +88,7 @@ int main(int argc, const char *argv[]) { + po::store(po::command_line_parser(argc, argv).options(desc).positional(pd).run(), vm); + po::notify(vm); + if (vm.count("help")) { +- Log::log(string("usage: ") + argv[0] + " [-htv] [-l LOG] [-k KEYLOG] [[-c] CONFIG]", Log::FATAL); ++ Log::log(string("usage: ") + argv[0] + " [-hdtv] [-l LOG] [-k KEYLOG] [[-c] CONFIG]", Log::FATAL); + cerr << desc; + exit(EXIT_SUCCESS); + } +@@ -137,6 +142,16 @@ int main(int argc, const char *argv[]) { + if (vm.count("keylog")) { + Log::redirect_keylog(keylog_file); + } ++#ifdef HAVE_DAEMON ++ if (do_daemon && daemon(0, 0) == -1) { ++ Log::log(string("Failed to fork into background: ") + strerror(errno), Log::FATAL); ++ exit(EXIT_FAILURE); ++ } ++#else // HAVE_DAEMON ++ if (do_daemon) { ++ Log::log("Daemon mode not supported on this system", Log::FATAL); ++ } ++#endif // HAVE_DAEMON + bool restart; + Config config; + do { diff --git a/net/trojan/pkg/DESCR b/net/trojan/pkg/DESCR new file mode 100644 index 0000000..c56101b --- /dev/null +++ b/net/trojan/pkg/DESCR @@ -0,0 +1,6 @@ +An unidentifiable mechanism that helps you bypass GFW. + +On penetrating GFW, people assume that strong encryption and random +obfuscation may cheat GFW’s filtration mechanism. However, trojan +implements the direct opposite: it imitates the most common protocol +across the wall, HTTPS, to trick GFW into thinking that it is HTTPS. \ No newline at end of file diff --git a/net/trojan/pkg/PLIST b/net/trojan/pkg/PLIST new file mode 100644 index 0000000..00e8267 --- /dev/null +++ b/net/trojan/pkg/PLIST @@ -0,0 +1,17 @@ +@comment $OpenBSD: PLIST,v$ +@rcscript ${RCDIR}/trojan +@bin bin/trojan +@man man/man1/trojan.1 +share/doc/trojan/ +share/doc/trojan/README.md +share/doc/trojan/authenticator.md +share/doc/trojan/build.md +share/doc/trojan/config.md +share/doc/trojan/examples/ +share/doc/trojan/examples/client.json-example +share/doc/trojan/examples/forward.json-example +share/doc/trojan/examples/nat.json-example +share/doc/trojan/examples/server.json-example +share/doc/trojan/overview.md +share/doc/trojan/protocol.md +share/doc/trojan/usage.md diff --git a/net/trojan/pkg/trojan.rc b/net/trojan/pkg/trojan.rc new file mode 100644 index 0000000..49ef350 --- /dev/null +++ b/net/trojan/pkg/trojan.rc @@ -0,0 +1,14 @@ +#!/bin/ksh +# +# $OpenBSD$ + +daemon="${TRUEPREFIX}/bin/trojan -d" + +. /etc/rc.d/rc.subr + +rc_pre() { + true + #install -d -o _mpd /var/run/mpd +} + +rc_cmd $1 -- 2.39.5