forked from tindy2013/subconverter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up file structure. Update build scripts.
- Loading branch information
Showing
136 changed files
with
326 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,58 @@ | ||
project(subconverter LANGUAGES CXX) | ||
cmake_minimum_required(VERSION 3.4) | ||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") | ||
IF(NOT CMAKE_BUILD_TYPE) | ||
SET(CMAKE_BUILD_TYPE Release) | ||
ENDIF() | ||
SET(CMAKE_CXX_STANDARD 17) | ||
ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result) | ||
|
||
ADD_EXECUTABLE(subconverter | ||
src/logger.cpp | ||
src/main.cpp | ||
src/misc.cpp | ||
src/multithread.cpp | ||
src/nodemanip.cpp | ||
src/rapidjson_extra.cpp | ||
src/speedtestutil.cpp | ||
src/subexport.cpp | ||
src/webget.cpp | ||
src/webserver_libevent.cpp) | ||
INCLUDE_DIRECTORIES(src) | ||
|
||
SET(THREADS_PREFER_PTHREAD_FLAG ON) | ||
FIND_PACKAGE(Threads REQUIRED) | ||
TARGET_LINK_LIBRARIES(subconverter ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
FIND_PACKAGE(LibEvent REQUIRED) | ||
FIND_LIBRARY(LIBEVENT_STATIC_LIBS libevent.a) | ||
INCLUDE_DIRECTORIES(${LIBEVENT_INCLUDE_DIR}) | ||
TARGET_LINK_LIBRARIES(subconverter ${LIBEVENT_STATIC_LIBS}) | ||
|
||
FIND_PACKAGE(CURL 7.54.0 REQUIRED) | ||
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) | ||
TARGET_LINK_LIBRARIES(subconverter ${CURL_LIBRARIES}) | ||
ADD_DEFINITIONS(-DCURL_STATICLIB) | ||
|
||
FIND_PACKAGE(OpenSSL 1.1.0 REQUIRED) | ||
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) | ||
TARGET_LINK_LIBRARIES(subconverter ${OPENSSL_LIBRARIES}) | ||
|
||
FIND_PACKAGE(Rapidjson REQUIRED) | ||
INCLUDE_DIRECTORIES(${RAPIDJSON_INCLUDE_DIRS}) | ||
|
||
FIND_PACKAGE(yaml-cpp REQUIRED) | ||
INCLUDE_DIRECTORIES(${YAML_CPP_INCLUDE_DIRS}) | ||
TARGET_LINK_LIBRARIES(subconverter yaml-cpp.a) | ||
|
||
FIND_PACKAGE(PCRE REQUIRED) | ||
INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIRS}) | ||
TARGET_LINK_LIBRARIES(subconverter pcrecpp.a ${PCRE_LIBRARIES}) | ||
ADD_DEFINITIONS(-DPCRE_STATIC) | ||
|
||
IF(WIN32) | ||
TARGET_LINK_LIBRARIES(subconverter wsock32 ws2_32) | ||
ELSE() | ||
INCLUDE(GNUInstallDirs) | ||
INSTALL(TARGETS subconverter DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
ENDIF() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,38 @@ | ||
# - Find LibEvent (a cross event library) | ||
# This module defines | ||
# LIBEVENT_INCLUDE_DIR, where to find LibEvent headers | ||
# LIBEVENT_LIB, LibEvent libraries | ||
# LibEvent_FOUND, If false, do not try to use libevent | ||
|
||
set(LibEvent_EXTRA_PREFIXES /usr/local /opt/local "$ENV{HOME}") | ||
foreach(prefix ${LibEvent_EXTRA_PREFIXES}) | ||
list(APPEND LibEvent_INCLUDE_PATHS "${prefix}/include") | ||
list(APPEND LibEvent_LIB_PATHS "${prefix}/lib") | ||
endforeach() | ||
|
||
find_path(LIBEVENT_INCLUDE_DIR event.h PATHS ${LibEvent_INCLUDE_PATHS}) | ||
find_library(LIBEVENT_LIB NAMES libevent.a PATHS ${LibEvent_LIB_PATHS}) | ||
find_library(LIBEVENT_PTHREAD_LIB NAMES event_pthreads PATHS ${LibEvent_LIB_PATHS}) | ||
|
||
if (LIBEVENT_LIB AND LIBEVENT_INCLUDE_DIR AND LIBEVENT_PTHREAD_LIB) | ||
set(LibEvent_FOUND TRUE) | ||
set(LIBEVENT_LIB ${LIBEVENT_LIB} ${LIBEVENT_PTHREAD_LIB}) | ||
else () | ||
set(LibEvent_FOUND FALSE) | ||
endif () | ||
|
||
if (LibEvent_FOUND) | ||
if (NOT LibEvent_FIND_QUIETLY) | ||
message(STATUS "Found libevent: ${LIBEVENT_LIB}") | ||
endif () | ||
else () | ||
if (LibEvent_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could NOT find libevent and libevent_pthread.") | ||
endif () | ||
message(STATUS "libevent and libevent_pthread NOT found.") | ||
endif () | ||
|
||
mark_as_advanced( | ||
LIBEVENT_LIB | ||
LIBEVENT_INCLUDE_DIR | ||
) |
This file contains 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,37 @@ | ||
# Copyright (C) 2007-2009 LuaDist. | ||
# Created by Peter Kapec <[email protected]> | ||
# Redistribution and use of this file is allowed according to the terms of the MIT license. | ||
# For details see the COPYRIGHT file distributed with LuaDist. | ||
# Note: | ||
# Searching headers and libraries is very simple and is NOT as powerful as scripts | ||
# distributed with CMake, because LuaDist defines directories to search for. | ||
# Everyone is encouraged to contact the author with improvements. Maybe this file | ||
# becomes part of CMake distribution sometimes. | ||
|
||
# - Find pcre | ||
# Find the native PCRE headers and libraries. | ||
# | ||
# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. | ||
# PCRE_LIBRARIES - List of libraries when using pcre. | ||
# PCRE_FOUND - True if pcre found. | ||
|
||
# Look for the header file. | ||
FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) | ||
|
||
# Look for the library. | ||
FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) | ||
|
||
# Handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if all listed variables are TRUE. | ||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) | ||
|
||
# Copy the results to the output variables. | ||
IF(PCRE_FOUND) | ||
SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) | ||
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) | ||
ELSE(PCRE_FOUND) | ||
SET(PCRE_LIBRARIES) | ||
SET(PCRE_INCLUDE_DIRS) | ||
ENDIF(PCRE_FOUND) | ||
|
||
MARK_AS_ADVANCED(PCRE_INCLUDE_DIRS PCRE_LIBRARIES) |
This file contains 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,97 @@ | ||
# Copyright (c) 2011 Milo Yip ([email protected]) | ||
# Copyright (c) 2013 Rafal Jeczalik ([email protected]) | ||
# Distributed under the MIT License (see license.txt file) | ||
|
||
# ----------------------------------------------------------------------------------- | ||
# | ||
# Finds the rapidjson library | ||
# | ||
# ----------------------------------------------------------------------------------- | ||
# | ||
# Variables used by this module, they can change the default behaviour. | ||
# Those variables need to be either set before calling find_package | ||
# or exported as environment variables before running CMake: | ||
# | ||
# RAPIDJSON_INCLUDEDIR - Set custom include path, useful when rapidjson headers are | ||
# outside system paths | ||
# RAPIDJSON_USE_SSE2 - Configure rapidjson to take advantage of SSE2 capabilities | ||
# RAPIDJSON_USE_SSE42 - Configure rapidjson to take advantage of SSE4.2 capabilities | ||
# | ||
# ----------------------------------------------------------------------------------- | ||
# | ||
# Variables defined by this module: | ||
# | ||
# RAPIDJSON_FOUND - True if rapidjson was found | ||
# RAPIDJSON_INCLUDE_DIRS - Path to rapidjson include directory | ||
# RAPIDJSON_CXX_FLAGS - Extra C++ flags required for compilation with rapidjson | ||
# | ||
# ----------------------------------------------------------------------------------- | ||
# | ||
# Example usage: | ||
# | ||
# set(RAPIDJSON_USE_SSE2 ON) | ||
# set(RAPIDJSON_INCLUDEDIR "/opt/github.com/rjeczalik/rapidjson/include") | ||
# | ||
# find_package(rapidjson REQUIRED) | ||
# | ||
# include_directories("${RAPIDJSON_INCLUDE_DIRS}") | ||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}") | ||
# add_executable(foo foo.cc) | ||
# | ||
# ----------------------------------------------------------------------------------- | ||
|
||
foreach(opt RAPIDJSON_INCLUDEDIR RAPIDJSON_USE_SSE2 RAPIDJSON_USE_SSE42) | ||
if(${opt} AND DEFINED ENV{${opt}} AND NOT ${opt} STREQUAL "$ENV{${opt}}") | ||
message(WARNING "Conflicting ${opt} values: ignoring environment variable and using CMake cache entry.") | ||
elseif(DEFINED ENV{${opt}} AND NOT ${opt}) | ||
set(${opt} "$ENV{${opt}}") | ||
endif() | ||
endforeach() | ||
|
||
find_path( | ||
RAPIDJSON_INCLUDE_DIRS | ||
NAMES rapidjson/rapidjson.h | ||
PATHS ${RAPIDJSON_INCLUDEDIR} | ||
DOC "Include directory for the rapidjson library." | ||
) | ||
|
||
mark_as_advanced(RAPIDJSON_INCLUDE_DIRS) | ||
|
||
if(RAPIDJSON_INCLUDE_DIRS) | ||
set(RAPIDJSON_FOUND TRUE) | ||
endif() | ||
|
||
mark_as_advanced(RAPIDJSON_FOUND) | ||
|
||
if(RAPIDJSON_USE_SSE42) | ||
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE42") | ||
if(MSVC) | ||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE4.2") | ||
else() | ||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse4.2") | ||
endif() | ||
else() | ||
if(RAPIDJSON_USE_SSE2) | ||
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE2") | ||
if(MSVC) | ||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE2") | ||
else() | ||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse2") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
mark_as_advanced(RAPIDJSON_CXX_FLAGS) | ||
|
||
if(RAPIDJSON_FOUND) | ||
if(NOT rapidjson_FIND_QUIETLY) | ||
message(STATUS "Found rapidjson header files in ${RAPIDJSON_INCLUDE_DIRS}") | ||
if(DEFINED RAPIDJSON_CXX_FLAGS) | ||
message(STATUS "Found rapidjson C++ extra compilation flags: ${RAPIDJSON_CXX_FLAGS}") | ||
endif() | ||
endif() | ||
elseif(rapidjson_FIND_REQUIRED) | ||
message(FATAL_ERROR "Could not find rapidjson") | ||
else() | ||
message(STATUS "Optional package rapidjson was not found") | ||
endif() |
This file contains 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,34 @@ | ||
#!/bin/bash | ||
mkdir obj | ||
set -xe | ||
|
||
apk add gcc g++ build-base linux-headers cmake make autoconf automake libtool | ||
apk add libressl-dev zlib-dev rapidjson-dev libevent-dev libevent-static zlib-static pcre-dev | ||
|
||
git clone https://github.com/curl/curl | ||
cd curl | ||
./buildconf | ||
./configure --with-ssl --disable-ldap --disable-ldaps --disable-rtsp --without-libidn2 > /dev/null | ||
make install -j4 > /dev/null | ||
cd .. | ||
|
||
git clone https://github.com/jbeder/yaml-cpp | ||
cd yaml-cpp | ||
cmake . > /dev/null | ||
make install -j4 > /dev/null | ||
cd .. | ||
|
||
git clone git://sourceware.org/git/bzip2.git | ||
cd bzip2 | ||
make install -j4 > /dev/null | ||
cd .. | ||
|
||
cmake . | ||
make -j4 | ||
g++ -o base/subconverter CMakeFiles/subconverter.dir/src/*.o -static -lpcrecpp -lpcre -levent -lyaml-cpp -lcurl -lssl -lcrypto -lz -lbz2 -ldl -lpthread -O3 -s | ||
|
||
cd base | ||
chmod +rx subconverter | ||
chmod +r * | ||
|
||
tar czf subconverter_linux64.tar.gz * |
File renamed without changes.
Oops, something went wrong.