Update build2 project

This commit is contained in:
Francois Kritzinger 2023-07-13 09:40:40 +02:00
parent dc5c11844f
commit 88c36ce773
18 changed files with 93 additions and 148 deletions

1
COPYING Symbolic link
View File

@ -0,0 +1 @@
upstream/asio/COPYING

1
LICENSE_1_0.txt Symbolic link
View File

@ -0,0 +1 @@
upstream/asio/LICENSE_1_0.txt

39
PACKAGE-README.md Normal file
View File

@ -0,0 +1,39 @@
# libasio
Asio is a cross-platform C++ library for network and low-level I/O programming
that provides developers with a consistent asynchronous model using a modern
C++ approach.
Asio provides the basic building blocks for C++ networking, concurrency and
other kinds of I/O. Asio is used in all kinds of applications, from phone apps
to the worlds fastest share markets.
For more information see: https://think-async.com/Asio/
This is a `build2` package for the standalone version of the Asio library.
# Usage
This package provides the `lib{asio}` library.
SSL support is disabled by default. To enable it, add the following to your
`manifest`:
```
depends:
\
libasio ^1.28.0
{
require
{
config.libasio.ssl = true
}
}
\
```
Note that on some platforms (such as MinGW) it may be necessary for
applications to define `_WIN32_WINNT` to an appropriate value. If it's not
defined the library's `config.hpp` header will issue a warning and choose a
default (currently `0x0601`, meaning Windows 7 and later; this is also the
value that the library is built with).

1
README Symbolic link
View File

@ -0,0 +1 @@
upstream/asio/README

View File

@ -1,3 +0,0 @@
# libasio
C++ library

View File

@ -6,10 +6,9 @@ cxx.std = latest
using cxx using cxx
hxx{*}: extension = hxx hxx{*}: extension = hpp
ixx{*}: extension = ixx ixx{*}: extension = ipp
txx{*}: extension = txx cxx{*}: extension = cpp
cxx{*}: extension = cxx
# Assume headers are importable unless stated otherwise. # Assume headers are importable unless stated otherwise.
# #
@ -18,3 +17,7 @@ hxx{*}: cxx.importable = true
# The test target for cross-testing (running tests under Wine, etc). # The test target for cross-testing (running tests under Wine, etc).
# #
test.target = $cxx.target test.target = $cxx.target
# If true, enable SSL support.
#
config [bool] config.libasio.ssl ?= false

View File

@ -1,4 +1,5 @@
./: {*/ -build/} doc{README.md} manifest ./: {*/ -build/ -upstream/} doc{README PACKAGE-README.md} \
legal{LICENSE_1_0.txt COPYING} manifest
# Don't install tests. # Don't install tests.
# #

View File

@ -1,15 +0,0 @@
#pragma once
#include <iosfwd>
#include <string>
#include <asio/export.hxx>
namespace asio
{
// Print a greeting for the specified name into the specified
// stream. Throw std::invalid_argument if the name is empty.
//
ASIO_SYMEXPORT void
say_hello (std::ostream&, const std::string& name);
}

View File

@ -1,14 +0,0 @@
pub_hdrs = {hxx ixx txx}{**}
./: $pub_hdrs
hxx{export}@./: cxx.importable = false
# Install into the asio/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx ixx txx}{*}:
{
install = include/asio/
install.subdirs = true
}

View File

@ -1,39 +0,0 @@
#pragma once
// Normally we don't export class templates (but do complete specializations),
// inline functions, and classes with only inline member functions. Exporting
// classes that inherit from non-exported/imported bases (e.g., std::string)
// will end up badly. The only known workarounds are to not inherit or to not
// export. Also, MinGW GCC doesn't like seeing non-exported functions being
// used before their inline definition. The workaround is to reorder code. In
// the end it's all trial and error.
#if defined(ASIO_STATIC) // Using static.
# define ASIO_SYMEXPORT
#elif defined(ASIO_STATIC_BUILD) // Building static.
# define ASIO_SYMEXPORT
#elif defined(ASIO_SHARED) // Using shared.
# ifdef _WIN32
# define ASIO_SYMEXPORT __declspec(dllimport)
# else
# define ASIO_SYMEXPORT
# endif
#elif defined(ASIO_SHARED_BUILD) // Building shared.
# ifdef _WIN32
# define ASIO_SYMEXPORT __declspec(dllexport)
# else
# define ASIO_SYMEXPORT
# endif
#else
// If none of the above macros are defined, then we assume we are being used
// by some third-party build system that cannot/doesn't signal the library
// type. Note that this fallback works for both static and shared libraries
// provided the library only exports functions (in other words, no global
// exported data) and for the shared case the result will be sub-optimal
// compared to having dllimport. If, however, your library does export data,
// then you will probably want to replace the fallback with the (commented
// out) error since it won't work for the shared case.
//
# define ASIO_SYMEXPORT // Using static or shared.
//# error define ASIO_STATIC or ASIO_SHARED preprocessor macro to signal libasio library type being linked
#endif

11
include/buildfile Normal file
View File

@ -0,0 +1,11 @@
pub_hdrs = {hxx ixx}{**}
./: $pub_hdrs
# Install into, say, /usr/include/, recreating subdirectories.
#
{hxx ixx}{*}:
{
install = include/
install.subdirs = true
}

View File

@ -1,13 +1,20 @@
: 1 : 1
name: libasio name: libasio
version: 0.1.0-a.0.z version: 1.28.0-a.0.z
language: c++ language: c++
summary: asio C++ library summary: Cross-platform C++ library for asynchronous network programming
license: other: proprietary ; Not free/open source. license: BSL-1.0 ; Boost Software License 1.0.
description-file: README.md description-file: README
url: https://example.org/libasio package-description-file: PACKAGE-README.md
email: francois@codesynthesis.com url: https://think-async.com/Asio/
#build-error-email: francois@codesynthesis.com src-url: https://github.com/chriskohlhoff/asio/
package-url: https://github.com/build2-packaging/libasio/
email: https://sourceforge.net/p/asio/mailman/asio-users/ ; Mailing list.
package-email: packaging@build2.org ; Mailing list.
build-error-email: builds@build2.org
depends: * build2 >= 0.16.0 depends: * build2 >= 0.16.0
depends: * bpkg >= 0.16.0 depends: * bpkg >= 0.16.0
#depends: libhello ^1.0.0 depends: libssl >= 1.1.1 ? ($config.libasio.ssl)
depends: libcrypto >= 1.1.1 ? ($config.libasio.ssl)
ssl-build-config: config.libasio.ssl=true ; Enable SSL support.

View File

@ -1,11 +1,7 @@
: 1 : 1
summary: libasio project repository summary: libasio project repository
#: :
#role: prerequisite role: prerequisite
#location: https://pkg.cppget.org/1/stable location: https://pkg.cppget.org/1/stable
#trust: ... trust: 70:64:FE:E4:E0:F3:60:F1:B4:51:E1:FA:12:5C:E0:B3:DB:DF:96:33:39:B9:2E:E5:C2:68:63:4C:A6:47:39:43
#:
#role: prerequisite
#location: https://git.build2.org/hello/libhello.git

View File

@ -1,17 +0,0 @@
#include <asio/asio.hxx>
#include <ostream>
#include <stdexcept>
using namespace std;
namespace asio
{
void say_hello (ostream& o, const string& n)
{
if (n.empty ())
throw invalid_argument ("empty name");
o << "Hello, " << n << '!' << endl;
}
}

View File

@ -1,3 +1,3 @@
import libs = libasio%lib{asio} import libs = libasio%lib{asio}
exe{driver}: {hxx ixx txx cxx}{**} $libs testscript{**} exe{driver}: cxx{driver} $libs

7
tests/basics/driver.cpp Normal file
View File

@ -0,0 +1,7 @@
#include <asio.hpp>
int
main ()
{
return 0;
}

View File

@ -1,34 +0,0 @@
#include <sstream>
#include <stdexcept>
#include <asio/asio.hxx>
#undef NDEBUG
#include <cassert>
int main ()
{
using namespace std;
using namespace asio;
// Basics.
//
{
ostringstream o;
say_hello (o, "World");
assert (o.str () == "Hello, World!\n");
}
// Empty name.
//
try
{
ostringstream o;
say_hello (o, "");
assert (false);
}
catch (const invalid_argument& e)
{
assert (e.what () == string ("empty name"));
}
}

View File

@ -2,10 +2,10 @@ cxx.std = latest
using cxx using cxx
hxx{*}: extension = hxx hxx{*}: extension = hpp
ixx{*}: extension = ixx ixx{*}: extension = ipp
txx{*}: extension = txx txx{*}: extension = tpp
cxx{*}: extension = cxx cxx{*}: extension = cpp
# Assume headers are importable unless stated otherwise. # Assume headers are importable unless stated otherwise.
# #