$ git clone https://git.samba.org/samba.git
$ brew install jansson
$ brew install readline && brew link --force readline
$ cpan # then w/in cpan install Parse::Yapp module (might be 'install Term::Parse::Yapp')
$ brew intsall libarchive
$ export LDFLAGS="-L/usr/local/opt/libarchive/lib"
$ export CPPFLAGS="-I/usr/local/opt/libarchive/include"
$ ./configure --prefix=/opt/samba --without-ad-dc --without-acl-support
Patch $ samba/libcli/smbreadline/smbreadline.c as follows
Note there are 2 patches: { .part1, .part2 }. It's possible that .part1 proves to be unnecessary. You'll know if you get a compiler error with some noise about type mismatch with 'aka int (*)(void)...'. If this happens to you, skip .part1 altogether.
Patch.part1 @ line ~50 to add external ref to rl_event_hook b/c similar to rl_done, it's not in osx's readline.h but is in the library (or something along this line...)
#ifdef HAVE_LIBREADLINE
/* ... */
extern int rl_done;
extern Function *rl_event_hook;
Patch.part2 @ line ~150 to use Fuction* or rl_hook_func_t* based on avialability
#ifdef HAVE_DECL_RL_EVENT_HOOK
if (callback)
#if defined(_RL_FUNCTION_TYPEDEF)
rl_event_hook = (rl_hook_func_t *)callback;
#else
rl_event_hook = (Function *)callback;
#endif
#endif
ret = readline(prompt);
and hopefully it builds for you with just the typical set of warnings..
$ make
and optionally
$ sudo make install
FYR - some reference docs which are actually useful now that you have $ make; working. https://wiki.samba.org/index.php/Build_Samba_from_Source
tx @movalex