diff --git a/COPYING b/COPYING new file mode 120000 index 0000000..0924360 --- /dev/null +++ b/COPYING @@ -0,0 +1 @@ +upstream/asio/COPYING \ No newline at end of file diff --git a/LICENSE_1_0.txt b/LICENSE_1_0.txt new file mode 120000 index 0000000..a264391 --- /dev/null +++ b/LICENSE_1_0.txt @@ -0,0 +1 @@ +upstream/asio/LICENSE_1_0.txt \ No newline at end of file diff --git a/PACKAGE-README.md b/PACKAGE-README.md new file mode 100644 index 0000000..0c1e6b9 --- /dev/null +++ b/PACKAGE-README.md @@ -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 world’s 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). diff --git a/README b/README new file mode 120000 index 0000000..b8e9ba2 --- /dev/null +++ b/README @@ -0,0 +1 @@ +upstream/asio/README \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index fdd7dc4..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# libasio - -C++ library diff --git a/build/root.build b/build/root.build index ae3d2a6..204feaa 100644 --- a/build/root.build +++ b/build/root.build @@ -6,10 +6,9 @@ cxx.std = latest using cxx -hxx{*}: extension = hxx -ixx{*}: extension = ixx -txx{*}: extension = txx -cxx{*}: extension = cxx +hxx{*}: extension = hpp +ixx{*}: extension = ipp +cxx{*}: extension = cpp # 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). # test.target = $cxx.target + +# If true, enable SSL support. +# +config [bool] config.libasio.ssl ?= false diff --git a/buildfile b/buildfile index 9a5145b..eee0f9a 100644 --- a/buildfile +++ b/buildfile @@ -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. # diff --git a/include/asio/asio.hxx b/include/asio/asio.hxx deleted file mode 100644 index 8568f0b..0000000 --- a/include/asio/asio.hxx +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include - -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); -} diff --git a/include/asio/buildfile b/include/asio/buildfile deleted file mode 100644 index f347575..0000000 --- a/include/asio/buildfile +++ /dev/null @@ -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 -} diff --git a/include/asio/export.hxx b/include/asio/export.hxx deleted file mode 100644 index fa394e7..0000000 --- a/include/asio/export.hxx +++ /dev/null @@ -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 diff --git a/include/buildfile b/include/buildfile new file mode 100644 index 0000000..9719d50 --- /dev/null +++ b/include/buildfile @@ -0,0 +1,11 @@ +pub_hdrs = {hxx ixx}{**} + +./: $pub_hdrs + +# Install into, say, /usr/include/, recreating subdirectories. +# +{hxx ixx}{*}: +{ + install = include/ + install.subdirs = true +} diff --git a/manifest b/manifest index 0ffb704..f243904 100644 --- a/manifest +++ b/manifest @@ -1,13 +1,20 @@ : 1 name: libasio -version: 0.1.0-a.0.z +version: 1.28.0-a.0.z language: c++ -summary: asio C++ library -license: other: proprietary ; Not free/open source. -description-file: README.md -url: https://example.org/libasio -email: francois@codesynthesis.com -#build-error-email: francois@codesynthesis.com +summary: Cross-platform C++ library for asynchronous network programming +license: BSL-1.0 ; Boost Software License 1.0. +description-file: README +package-description-file: PACKAGE-README.md +url: https://think-async.com/Asio/ +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: * 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. diff --git a/repositories.manifest b/repositories.manifest index 121112f..418dbf2 100644 --- a/repositories.manifest +++ b/repositories.manifest @@ -1,11 +1,7 @@ : 1 summary: libasio project repository -#: -#role: prerequisite -#location: https://pkg.cppget.org/1/stable -#trust: ... - -#: -#role: prerequisite -#location: https://git.build2.org/hello/libhello.git +: +role: prerequisite +location: https://pkg.cppget.org/1/stable +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 diff --git a/src/asio.cxx b/src/asio.cxx deleted file mode 100644 index 7dd420f..0000000 --- a/src/asio.cxx +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#include -#include - -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; - } -} diff --git a/tests/basics/buildfile b/tests/basics/buildfile index 3b108d7..45a1ca0 100644 --- a/tests/basics/buildfile +++ b/tests/basics/buildfile @@ -1,3 +1,3 @@ import libs = libasio%lib{asio} -exe{driver}: {hxx ixx txx cxx}{**} $libs testscript{**} +exe{driver}: cxx{driver} $libs diff --git a/tests/basics/driver.cpp b/tests/basics/driver.cpp new file mode 100644 index 0000000..61b03c6 --- /dev/null +++ b/tests/basics/driver.cpp @@ -0,0 +1,7 @@ +#include + +int +main () +{ + return 0; +} diff --git a/tests/basics/driver.cxx b/tests/basics/driver.cxx deleted file mode 100644 index 849fc91..0000000 --- a/tests/basics/driver.cxx +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include - -#include - -#undef NDEBUG -#include - -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")); - } -} diff --git a/tests/build/root.build b/tests/build/root.build index 8fafbfe..706e686 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -2,10 +2,10 @@ cxx.std = latest using cxx -hxx{*}: extension = hxx -ixx{*}: extension = ixx -txx{*}: extension = txx -cxx{*}: extension = cxx +hxx{*}: extension = hpp +ixx{*}: extension = ipp +txx{*}: extension = tpp +cxx{*}: extension = cpp # Assume headers are importable unless stated otherwise. #