From 9d0691b47ad9f85920f027a05abb367da4e2f339 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 8 Jun 2017 11:56:14 +0200 Subject: Include license and warranty statement with solc. --- CMakeLists.txt | 4 ++++ cmake/templates/license.h.in | 3 +++ solc/CommandLineInterface.cpp | 28 +++++++++++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 cmake/templates/license.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index e53917cb..2dbc521d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,10 @@ include(EthExecutableHelper) # Include utils include(EthUtils) +# Create license.h from LICENSE.txt and template +file(READ ${CMAKE_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT) +configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/license.h.in" "license.h") + include(EthOptions) configure_project(TESTS) diff --git a/cmake/templates/license.h.in b/cmake/templates/license.h.in new file mode 100644 index 00000000..48801347 --- /dev/null +++ b/cmake/templates/license.h.in @@ -0,0 +1,3 @@ +#pragma once + +static char const* licenseText = R"(@LICENSE_TEXT@)"; diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index b2e257ee..fcd58cb3 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -23,6 +23,7 @@ #include "CommandLineInterface.h" #include "solidity/BuildInfo.h" +#include "license.h" #include #include @@ -94,6 +95,7 @@ static string const g_strHelp = "help"; static string const g_strInputFile = "input-file"; static string const g_strInterface = "interface"; static string const g_strJulia = "julia"; +static string const g_strLicense = "license"; static string const g_strLibraries = "libraries"; static string const g_strLink = "link"; static string const g_strMetadata = "metadata"; @@ -186,6 +188,13 @@ static void version() exit(0); } +static void license() +{ + // This is a static variable generated by cmake from LICENSE.txt + cout << licenseText << endl; + exit(0); +} + static bool needsHumanTargetedStdout(po::variables_map const& _args) { if (_args.count(g_argGas)) @@ -510,8 +519,13 @@ void CommandLineInterface::createFile(string const& _fileName, string const& _da bool CommandLineInterface::parseArguments(int _argc, char** _argv) { // Declare the supported options. - po::options_description desc( - R"(solc, the Solidity commandline compiler. + po::options_description desc(R"(solc, the Solidity commandline compiler. + +Solidity Copyright (C) 2014-2017 Solidity contributors. +This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you +are welcome to redistribute it under certain conditions. See 'solc --license' +for details. + Usage: solc [options] [input_file...] Compiles the given Solidity input files (or the standard input if none given or "-" is used as a file name) and outputs the components specified in the options @@ -523,10 +537,12 @@ Example: Allowed options)", po::options_description::m_default_line_length, - po::options_description::m_default_line_length - 23); + po::options_description::m_default_line_length - 23 + ); desc.add_options() (g_argHelp.c_str(), "Show help message and exit.") (g_argVersion.c_str(), "Show version and exit.") + (g_strLicense.c_str(), "Show licensing information and exit.") (g_argOptimize.c_str(), "Enable bytecode optimizer.") ( g_argOptimizeRuns.c_str(), @@ -633,6 +649,12 @@ Allowed options)", return false; } + if (m_args.count(g_strLicense)) + { + license(); + return false; + } + if (m_args.count(g_argCombinedJson)) { vector requests; -- cgit v1.2.3 From f583008c7376bc7c9323331fe6a9c580752c08dd Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 12 Jun 2017 12:28:17 +0200 Subject: Remove copyright notice. --- solc/CommandLineInterface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index fcd58cb3..cae05b18 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -521,7 +521,6 @@ bool CommandLineInterface::parseArguments(int _argc, char** _argv) // Declare the supported options. po::options_description desc(R"(solc, the Solidity commandline compiler. -Solidity Copyright (C) 2014-2017 Solidity contributors. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See 'solc --license' for details. -- cgit v1.2.3