Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
M. Stoeckl
Waypipe
Commits
f1e25cf6
Commit
f1e25cf6
authored
May 15, 2019
by
Manuel Stoeckl
Browse files
Use meson as build system
parent
7b4b5515
Changes
9
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
f1e25cf6
waypipe
build/
Makefile
deleted
100644 → 0
View file @
7b4b5515
# todo, replace with meson
flags
=
-ggdb3
-fsanitize
=
address
way_libs
:=
$(
shell
pkg-config
--libs
wayland-client wayland-server
)
way_cflags
:=
$(
shell
pkg-config
--cflags
wayland-client wayland-server
)
all
:
waypipe
waypipe
:
waypipe.c server.c client.c util.c util.h Makefile
gcc
$(flags)
-std
=
c11
$(way_libs)
$(way_cflags)
-lrt
-o
waypipe waypipe.c server.c client.c util.h util.c
clean
:
rm
-f
waypipe
.phony
:
all clean
client.c
View file @
f1e25cf6
...
...
@@ -126,7 +126,7 @@ static int run_client_child(int chanfd, const char *socket_path)
free
(
tmpbuf
);
if
(
wc
==
-
1
)
{
wp_log
(
WP_ERROR
,
"dispfd write failure %d: %s
\n
"
,
"dispfd write failure %
l
d: %s
\n
"
,
wc
,
strerror
(
errno
));
break
;
}
...
...
meson.build
0 → 100644
View file @
f1e25cf6
project(
'waypipe',
'c',
license: 'MIT/Expat',
meson_version: '>=0.48.0',
default_options: [
'c_std=c11',
'warning_level=2',
'werror=true',
],
version: '0.0.0',
)
cc = meson.get_compiler('c')
# mention version
version = '"@0@"'.format(meson.project_version())
add_project_arguments('-DWAYPIPE_VERSION=@0@'.format(version), language: 'c')
# Make build reproducible if possible
if cc.get_id() == 'gcc'
r = run_command('python3', '-c', 'import os.path; print(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\'))'.format(meson.source_root(), meson.build_root()))
relative_dir = r.stdout().strip()
add_project_arguments(
'-fmacro-prefix-map=@0@='.format(relative_dir),
language: 'c',
)
else
length_finder = 'import os.path; print(len(os.path.join(os.path.relpath(\'@0@\', \'@1@\'),\'\')))'
rel_src_dir_length = run_command('python3', '-c',
length_finder.format(meson.source_root(), meson.build_root())).stdout().strip()
add_project_arguments(
'-DWAYPIPE_SRC_DIR_LENGTH=@0@'.format(rel_src_dir_length),
language: 'c',
)
endif
wayland_client = dependency('wayland-client', version: '>=1.17')
wayland_protos = dependency('wayland-protocols', version: '>=1.17')
wayland_server = dependency('wayland-server', version: '>=1.17')
rt = cc.find_library('rt')
executable(
'waypipe',
['waypipe.c', 'client.c', 'server.c', 'util.c'],
dependencies : [rt, wayland_client, wayland_protos, wayland_server],
install: true
)
scdoc = dependency('scdoc', version: '>=1.9.4', native: true)
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
custom_target(
'waypipe.1',
input: 'waypipe.scd',
output: 'waypipe.1',
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), 'waypipe.1')
],
install: true,
install_dir: '@0@/man1'.format(mandir)
)
# TODO: version!
server.c
View file @
f1e25cf6
...
...
@@ -173,13 +173,12 @@ int run_server(const char *socket_path, int app_argc, char *const app_argv[])
memset
(
fds
,
0
,
sizeof
(
fds
));
untranslate_ids
(
&
fdtransmap
,
nids
,
ids
,
fds
);
wp_log
(
WP_DEBUG
,
"Read from conn %d = %d bytes
\n
"
,
nbytes
,
nbytes
);
ssize_t
wc
=
iovec_write
(
appfd
,
waymsg
,
waylen
,
fds
,
nids
);
free
(
tmpbuf
);
if
(
wc
==
-
1
)
{
wp_log
(
WP_ERROR
,
"FD Write failure %d: %s
\n
"
,
wp_log
(
WP_ERROR
,
"appfd write failure %ld: %s
\n
"
,
wc
,
strerror
(
errno
));
break
;
}
...
...
test.sh
View file @
f1e25cf6
...
...
@@ -2,6 +2,8 @@
root
=
`
pwd
`
waypipe
=
`
which waypipe
`
program
=
`
which bash
`
program
=
`
which weston-terminal
`
#program=`which weston-flower`
...
...
@@ -11,9 +13,9 @@ debug=
debug
=
-d
(
$
root
/
waypipe
$debug
client /tmp/socket-client 2>&1 |
sed
's/.*/\x1b[33m&\x1b[0m/'
)
&
(
$waypipe
$debug
client /tmp/socket-client 2>&1 |
sed
's/.*/\x1b[33m&\x1b[0m/'
)
&
# ssh-to-self; should have a local keypair set up
(
ssh
-R
/tmp/socket-server:/tmp/socket-client localhost
$
root
/
waypipe
$debug
server /tmp/socket-server
--
$program
)
2>&1 |
sed
's/.*/\x1b[35m&\x1b[0m/'
(
ssh
-R
/tmp/socket-server:/tmp/socket-client localhost
$waypipe
$debug
server /tmp/socket-server
--
$program
)
2>&1 |
sed
's/.*/\x1b[35m&\x1b[0m/'
kill
%1
rm
-f
/tmp/socket-client
rm
-f
/tmp/socket-server
util.h
View file @
f1e25cf6
...
...
@@ -43,9 +43,13 @@ extern log_cat_t waypipe_loglevel;
const
char
*
static_timestamp
(
void
);
// no trailing ;, user must supply
#ifndef WAYPIPE_SRC_DIR_LENGTH
#define WAYPIPE_SRC_DIR_LENGTH 0
#endif
#define wp_log(level, fmt, ...) \
if ((level) >= waypipe_loglevel) \
fprintf(stderr, "%s [%s:%3d] " fmt, static_timestamp(), __FILE__, \
fprintf(stderr, "%s [%s:%3d] " fmt, static_timestamp(), \
((const char *)__FILE__) + WAYPIPE_SRC_DIR_LENGTH, \
__LINE__, ##__VA_ARGS__)
struct
fd_translation_map
{
...
...
waypipe.c
View file @
f1e25cf6
...
...
@@ -94,13 +94,15 @@ int main(int argc, char **argv)
argv
+=
optind
;
argc
-=
optind
;
if
(
fail
||
argc
<
2
)
{
if
(
fail
)
{
return
usage
(
EXIT_FAILURE
);
}
else
if
(
help
)
{
return
usage
(
EXIT_SUCCESS
);
}
else
if
(
version
)
{
fprintf
(
stdout
,
"waypipe
unversioned
\n
"
);
fprintf
(
stdout
,
"waypipe
"
WAYPIPE_VERSION
"
\n
"
);
return
EXIT_SUCCESS
;
}
else
if
(
argc
<
2
)
{
return
usage
(
EXIT_FAILURE
);
}
else
if
(
help
)
{
return
usage
(
EXIT_SUCCESS
);
}
else
if
(
!
strcmp
(
argv
[
0
],
"client"
))
{
is_client
=
true
;
}
else
if
(
!
strcmp
(
argv
[
0
],
"server"
))
{
...
...
waypipe.scd
View file @
f1e25cf6
...
...
@@ -17,6 +17,9 @@ waypipe - A transparent proxy for Wayland applications
*-
v
,
--
version
*
Show
the
version
number
and
quit
.
*-
d
,
--
debug
*
Print
debug
log
messages
.
#
DESCRIPTION
waypipe
is
a
proxy
for
Wayland
clients
,
with
the
aim
of
supporting
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment