Skip to content

Commit

Permalink
Merge pull request #2612 from kubo39/bye-libevent
Browse files Browse the repository at this point in the history
(chore): Remove libevent related things entirely
  • Loading branch information
s-ludwig authored Sep 30, 2021
2 parents 42e26d0 + 19a18dd commit 1960964
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 54 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dub.selections.json
# Auto-downloaded 3rd-party
lib/subprojects/allocator
lib/subprojects/diet/
lib/subprojects/libevent/
lib/subprojects/openssl/

# Mono-D files
Expand Down
29 changes: 5 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Similarly, you can run an example by invoking `dub` from any of the
example project directories.

Note that on non-Windows operating systems, you also need to have
libevent and OpenSSL installed - and of course a D compiler. See below
OpenSSL installed - and of course a D compiler. See below
for instructions.


Expand All @@ -88,18 +88,15 @@ Additional setup on Windows

### Note for building on Win64

There are currently no 64-bit Windows binaries of libevent included, so you'll either need to build those yourself, or you can switch to the "win32" event driver by inserting `"subConfigurations": {"vibe-d": "win32"}` into the dub.json file of your project.

You can switch to the "win32" event driver by inserting `"subConfigurations": {"vibe-d": "win32"}` into the dub.json file of your project.

Additional setup on Mac using brew
----------------------------------

If you don't have brew installed, install it according to their [install
instructions](<https://www.brew.sh>) and
install libevent.
instructions](<https://brew.sh>).

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install libevent

You can then also install DUB using brew:

Expand All @@ -117,7 +114,7 @@ Additional setup on Linux (Debian/Ubuntu/Mint)

Install vibe.d's dependencies (*)

sudo apt-get install libevent-dev libssl-dev
sudo apt-get install libssl-dev


On 32-bit linux: Install DMD-i386
Expand Down Expand Up @@ -147,30 +144,14 @@ You need to have the following dependencies installed:
- [DMD 2.077.1 or greater](http://dlang.org/download)
- [libssl](http://www.openssl.org/source/)

If using the (now deprecated) "libevent" configuration, libevent is also required:
- [libevent 2.0.x](http://libevent.org/) (*)

Optionally, run `./setup-linux.sh` to create a user/group pair for privilege lowering.

(*) Note that some Linux distributions such as Debian Squeeze or CentOS 6 may only ship libevent 1.4, in this case you will have to manually compile the latest 2.0.x version:

```
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
make install
ldconfig
```


Additional setup on FreeBSD
---------------------------

Install the DMD compiler and vibe.d's dependencies using portupgrade or a similar mechanism:

sudo portupgrade -PN devel/libevent2 devel/pkgconf
sudo portupgrade -PN devel/pkgconf

Optionally, run `./setup-freebsd.sh` to create a user/group pair for privilege lowering.

Expand Down
3 changes: 1 addition & 2 deletions examples/unix_socket/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"vibe-d:web": {"path": "../../"},
"vibe-d:core": {"path": "../../"}
},
"versions": ["VibeNoSSL"],
"subConfigurations": { "vibe-d:core": "libevent"}
"versions": ["VibeNoSSL"]
}
2 changes: 1 addition & 1 deletion http/vibe/http/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void handleHTTPConnection(TCPConnection connection, HTTPServerContext context)
// Set NODELAY to true, to avoid delays caused by sending the response
// header and body in separate chunks. Note that to avoid other performance
// issues (caused by tiny packets), this requires using an output buffer in
// the event driver, which is the case at least for the default libevent
// the event driver, which is the case at least for the legacy libevent
// based driver.
connection.tcpNoDelay = true;

Expand Down
Binary file removed lib/win-i386/event2.lib
Binary file not shown.
Binary file removed lib/win-i386/libevent.dll
Binary file not shown.
20 changes: 0 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pkgc = import('pkgconfig')
zlib_dep = dependency('zlib')
crypto_dep = dependency('libcrypto')
ssl_dep = dependency('libssl')
libevent_dep = dependency('libevent')

#
# Compiler flags
Expand Down Expand Up @@ -81,25 +80,6 @@ else
endif
openssl_inc = include_directories(openssl_src_dir)

# Try to find system LibEvent bindings, if not found, download
# a Git copy.
libevent_src_dir = ''
if run_command('[', '-d', '/usr/include/d/common/deimos/event2/', ']').returncode() == 0
libevent_src_dir = '/usr/include/d/common'
else
libevent_src_dir = subproject_dir + '/libevent'
if run_command('[', '-d', libevent_src_dir, ']').returncode() != 0
message('Fetching LibEvent bindings from Github...')
git_get_requests = run_command(['git', 'clone', 'https://github.com/s-ludwig/libevent.git', libevent_src_dir])
if git_get_requests.returncode() != 0
error('Unable to fetch LibEvent bindings.\n' + git_get_requests.stderr())
endif
endif

message('Using non-system LibEvent D bindings.')
endif
libevent_inc = include_directories(libevent_src_dir)

#
# Modules
#
Expand Down
3 changes: 1 addition & 2 deletions setup-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,8 @@ finstall()
# if everything went fine
echo -e "\n \033[32;40;7;1mvibe.d installed successfully!\033[0m\n"
echo "You need to have the following dependencies installed:"
echo " ·dmd 2.061 - http://dlang.org"
echo " ·dmd - http://dlang.org"
echo " ·libssl (development files) - http://www.openssl.org/"
echo " ·libevent 2.0.x (development files) - http://libevent.org/"
echo -e "\ntake a look at examples on $BASE_DIR/examples/"
}

Expand Down
6 changes: 2 additions & 4 deletions utils/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ install_subdir('vibe/', install_dir: 'include/d/vibe/')
# Low level utility functionality
vibe_utils_lib = library('vibe-utils',
[vibe_utils_src],
include_directories: [openssl_inc, libevent_inc],
include_directories: [openssl_inc],
install: true,
dependencies: [crypto_dep,
ssl_dep,
libevent_dep,
zlib_dep,
allocator_dep],
version: project_version,
Expand All @@ -52,10 +51,9 @@ pkgc.generate(name: 'vibe-utils',

vibe_utils_dep = declare_dependency(
link_with: [vibe_utils_lib],
include_directories: [vibe_utils_src_dir, openssl_inc, libevent_inc],
include_directories: [vibe_utils_src_dir, openssl_inc],
dependencies: [crypto_dep,
ssl_dep,
libevent_dep,
zlib_dep,
allocator_dep],
)
Expand Down

0 comments on commit 1960964

Please sign in to comment.