Skip to content

Commit

Permalink
Merge rebar3 support to master
Browse files Browse the repository at this point in the history
The rebar3-support branch has existed for years -- Duncan McGreggor
(<oubiwann@gmail.com>) first started it in April 2016 -- but has never
been merged to master because of problems preventing testing with
rebar3. This meant rebar3 users were usually stuck behind master until
the rebar3-support branch was rebased. To alleviate these issues, and
despite the testing problems with rebar3 still existing, merge rebar3
support into master.

Since rebar3 doesn't need a top-level ebin directory, move ebin to
ebin_src and make src/Makefile.am create the ebin directory as needed.

Rename the testsuite directory to test, which is the default rebar3
looks for. Note that running tests under rebar3 still doesn't work.

Use version 1.11.0 of the port_compiler.

Fix issues related to deterministic builds after rebasing yaws-2.1.1
to rebar3-support. Make rebar3 create the gen-yaws-generated script.

To avoid compilation errors, add nowarn_export_all to files using
export_all.

Change the README to no longer point users to the rebar3-support
branch.

Many thanks to Julius Andrikonis (<julius@erisata.lt>) for pushing
this merge forward.
  • Loading branch information
vinoski committed Feb 19, 2024
1 parent 421ea20 commit 251c8a8
Show file tree
Hide file tree
Showing 336 changed files with 188 additions and 101 deletions.
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ src/yaws_appdeps.hrl
ebin/yaws.app
ebin/yaws.appup
priv/epam
testsuite/logs
testsuite/*/temp
testsuite/analyze_coverdata.escript
testsuite/cover_to_html.sh
testsuite/run_common_test
testsuite/testsuite.hrl
testsuite/yaws.coverspec
test/logs
test/*/temp
test/analyze_coverdata.escript
test/cover_to_html.sh
test/run_common_test
test/testsuite.hrl
test/yaws.coverspec
www/yaws.pdf
www/yaws.ps
doc/a.pdf
Expand Down Expand Up @@ -73,6 +73,7 @@ yaws_logs/
.eunit/*
.rebar/*
.idea
_build/*
yaws-*.tar.gz
compile_commands.json
applications/yapp/doc/edoc-info
Expand Down
12 changes: 6 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ACLOCAL_FLAGS = -I m4
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src ebin include priv
SUBDIRS = src ebin_src include priv

APPDIRS = applications/chat applications/mail applications/wiki applications/yapp

Expand All @@ -17,12 +17,12 @@ if MINGW
endif

SUBDIRS += examples/src examples/ebin examples/include \
testsuite doc man scripts www/code www/shoppingcart
test doc man scripts www/code www/shoppingcart

EXTRA_DIST = ChangeLog known_dialyzer_warnings LICENSE \
EXTRA_DIST = ChangeLog known_dialyzer_warnings LICENSE \
README.md README.osx README.pkg-config \
rebar.config rebar.config.script two-mode-mode.el vsn.mk \
include.mk erlang_deps.mk ssl munin contrib www rel
include.mk erlang_deps.mk ssl munin contrib www

if !MINGW
pkgconfigdir = $(libdir)/pkgconfig
Expand Down Expand Up @@ -91,10 +91,10 @@ doc:
test: check

list-checks:
$(AM_V_at)( cd testsuite && $(MAKE) list-checks )
$(AM_V_at)( cd test && $(MAKE) list-checks )

cleantest:
$(AM_V_at)( cd testsuite && $(MAKE) clean )
$(AM_V_at)( cd test && $(MAKE) clean )

yaws.plt:
$(AM_V_GEN)$(DIALYZER) --build_plt -r ebin --output_plt yaws.plt\
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ command:

xcode-select --install

Finally, to run the testsuites, yaws need to install:
Finally, to run the test suites, yaws need to install:

* git
* wget
Expand All @@ -63,7 +63,7 @@ Finally, to run the testsuites, yaws need to install:
* erlang-inets
* erlang-mnesia
* erlang-ssl
* cadaver
* cadaver (optional)


Build
Expand All @@ -73,9 +73,8 @@ You can build via autotools:

$> ./configure --prefix=/usr/local

or via rebar3 on the `rebar3-support` branch:
or via rebar3:

$> git switch rebar3-support
$> rebar3 compile

If using rebar3, you'll get a "local installation" that you can run
Expand Down Expand Up @@ -179,8 +178,8 @@ Terminate through ^C, or ^G followed by q, or

> init:stop()

NOTE: If you've used rebar3 to build the system, none of the following
directions apply.
_NOTE: If you've used rebar3 to build the system, none of the following
directions apply._


Install and run
Expand Down
48 changes: 23 additions & 25 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ AC_PREREQ([2.64])
ECHO=echo
COLORED_ECHO_INIT


dnl ------------------------------------------------------------------
dnl Compiler and other tools.
dnl ------------------------------------------------------------------
Expand All @@ -36,15 +35,14 @@ AC_PROG_LD
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_SED

AC_PROG_MKDIR_P

AM_DISABLE_STATIC
AM_ENABLE_SHARED
AM_PROG_LIBTOOL

CFLAGS="-Werror -Wall -O3 $old_cflags"


dnl ------------------------------------------------------------------
dnl Handle configure options.
dnl ------------------------------------------------------------------
Expand Down Expand Up @@ -159,7 +157,7 @@ Erlang not found. Fill the ERL variable with erl(1) path or provide
Erlang prefix with --with-erlang.])
fi

dnl escript(1) is used by the testsuite.
dnl escript(1) is used by the test suite.
AC_ARG_VAR([ESCRIPT], [Erlang/OTP interpreter command [autodetected]])

if test "x${ESCRIPT}" = "x"; then
Expand All @@ -178,7 +176,7 @@ fi
if test "x${ESCRIPT}" = "x"; then
AC_MSG_WARN([
escript(1) not found. Fill the ESCRIPT variable with escript(1) path if
you want to use the testsuite.])
you want to use the test suite.])
fi


Expand Down Expand Up @@ -276,23 +274,23 @@ AC_ERLANG_CHECK_LIB([crypto],, [AC_MSG_ERROR(["crypto" Erlang application not
AC_ERLANG_CHECK_LIB([xmerl],, [AC_MSG_ERROR(["xmerl" Erlang application not found.])])

AC_ERLANG_CHECK_LIB([public_key],, [AC_MSG_WARN(["public_key" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([ssl],, [AC_MSG_WARN(["ssl" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([mnesia],, [AC_MSG_WARN(["mnesia" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([eunit],, [AC_MSG_WARN(["eunit" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([erlsom],, [AC_MSG_WARN(["erlsom" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([xmlrpc],, [AC_MSG_WARN(["xmlrpc" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([inets],, [AC_MSG_WARN(["inets" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([tools],, [AC_MSG_WARN(["tools" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])
AC_ERLANG_CHECK_LIB([common_test],,[AC_MSG_WARN(["common_test" Erlang application not found.
It could be required to run Yaws or its testsuites.])])
It could be required to run Yaws or its test suites.])])

cross_compiling=$tmp_cross_compiling

Expand Down Expand Up @@ -471,10 +469,10 @@ AC_SUBST([CONFIG_STATUS_DEPENDENCIES],
$(top_srcdir)/include.mk.in \
$(top_srcdir)/scripts/gen-yaws-generated.in \
$(top_srcdir)/applications/yapp/vsn.mk \
$(top_srcdir)/testsuite/run_common_test.in \
$(top_srcdir)/testsuite/yaws.coverspec.in \
$(top_srcdir)/testsuite/cover_to_html.sh.in \
$(top_srcdir)/testsuite/analyze_coverdata.escript.in'])
$(top_srcdir)/test/run_common_test.in \
$(top_srcdir)/test/yaws.coverspec.in \
$(top_srcdir)/test/cover_to_html.sh.in \
$(top_srcdir)/test/analyze_coverdata.escript.in'])

AC_CONFIG_FILES([
yaws.pc
Expand All @@ -488,16 +486,16 @@ AC_CONFIG_FILES([
doc/Makefile
scripts/Makefile
src/Makefile
ebin/Makefile
ebin_src/Makefile
examples/src/Makefile
examples/ebin/Makefile
examples/include/Makefile
www/code/Makefile
www/shoppingcart/Makefile
testsuite/Makefile
testsuite/${PACKAGE_NAME}.coverspec
testsuite/testsuite.hrl
test/Makefile
test/${PACKAGE_NAME}.coverspec
test/testsuite.hrl
applications/chat/Makefile
applications/chat/src/Makefile
Expand All @@ -516,9 +514,9 @@ AC_CONFIG_FILES([
src/yaws_appdeps.hrl
])

AC_CONFIG_FILES([testsuite/run_common_test], [chmod +x testsuite/run_common_test])
AC_CONFIG_FILES([testsuite/cover_to_html.sh], [chmod +x testsuite/cover_to_html.sh])
AC_CONFIG_FILES([testsuite/analyze_coverdata.escript], [chmod +x testsuite/analyze_coverdata.escript])
AC_CONFIG_FILES([test/run_common_test], [chmod +x test/run_common_test])
AC_CONFIG_FILES([test/cover_to_html.sh], [chmod +x test/cover_to_html.sh])
AC_CONFIG_FILES([test/analyze_coverdata.escript], [chmod +x test/analyze_coverdata.escript])

AC_CONFIG_FILES([scripts/make-release], [chmod +x scripts/make-release])
AC_CONFIG_FILES([scripts/gen-yaws-generated], [chmod +x scripts/gen-yaws-generated])
Expand Down
5 changes: 3 additions & 2 deletions ebin/Makefile.am → ebin_src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
beamdir = $(ERLANG_INSTALL_LIB_DIR_yaws)/ebin
EBIN_DIR=@top_builddir@/ebin

APP_FILES = yaws.app yaws.appup
BEAM_FILES = *.beam
APP_FILES = $(EBIN_DIR)/yaws.app $(EBIN_DIR)/yaws.appup
BEAM_FILES = $(EBIN_DIR)/*.beam

beam_DATA = $(APP_FILES) $(BEAM_FILES)

Expand Down
34 changes: 32 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

{sub_dirs, ["rel"]}.

{erl_opts, [{src_dirs, ["src", "examples/src"]}]}.
{erl_opts, [warnings_as_errors]}.

{port_env, [{"CFLAGS", "$CFLAGS -g -O3 -Wall"},
{extra_src_dirs, ["examples/src"]}.

{port_env, [{"CFLAGS", "$CFLAGS -g -O3 -Wall -I/usr/include/security"},
{"x86_64", "CFLAGS", "$CFLAGS -m$ERLANG_ARCH"},
{"x86_64", "LDFLAGS", "-m$ERLANG_ARCH $LDFLAGS"},
{"i[36]86", "CFLAGS", "$CFLAGS -m$ERLANG_ARCH"},
Expand All @@ -18,3 +20,31 @@

{pre_hooks, [{compile, "./scripts/rebar-pre-script"},
{clean, "./scripts/rebar-pre-script clean"}]}.

{plugins, [
{pc, ".*", {git, "https://github.com/blt/port_compiler.git", {tag, "v1.11.0"}}}
]}.

{provider_hooks, [
{pre, [{compile, {pc, compile}},
{clean, {pc, clean}}]}
]}.

{shell, [{apps, [yaws]}]}.

{relx, [{release, {yaws, {git, short}},
[yaws],
{dev_mode, true},
{include_erts, false},
{extended_start_script, true}}]}.

{profiles, [{dev, [{plugins,
[{ibrowse, {git,"git://github.com/cmullaparthi/ibrowse.git", {tag,"v3.0.4"}}}]
},
{relx, [{dev_mode, true},
{include_erts, false}]}]},
{prod, [{erl_opts, [no_debug_info]},
{relx, [{dev_mode, false},
{include_erts, true}]}]},
{test, [{erl_opts, [{i, "test"}]}]}
]}.
5 changes: 3 additions & 2 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ ok = file:write_file(filename:join(Dir, "src/yaws_charset.hrl"),
Charset, <<"\").\n">>]
end),

SoapDeps = [{erlsom, ".*", {git, "git://github.com/willemdj/erlsom.git", {branch, "master"}}},
{xmlrpc, ".*", {git, "git://github.com/rwbr/exmlrpc.git", {branch, "master"}}}],
SoapDeps = [{erlsom, ".*", {git, "git://github.com/willemdj/erlsom.git", {tag, "1.4.0"}}},
{xmlrpc, ".*", {git, "git://github.com/rwbr/exmlrpc.git",
{branch, "8813d049c9c426d86c57ac9f7325253255df9666"}}}],
Cfg0 = case os:getenv("YAWS_SOAP") of
false ->
CONFIG;
Expand Down
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions scripts/rebar-pre-script
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if [ "$1" = clean ]; then
rm -f ${YAWS_DIR}/src/mime_types.erl \
${YAWS_DIR}/src/yaws_generated.erl \
${YAWS_DIR}/src/yaws_charset.hrl \
${YAWS_DIR}/test/testsuite.hrl \
${YAWS_DIR}/scripts/gen-yaws-generated
exit 0
fi
Expand Down Expand Up @@ -87,6 +88,11 @@ need_mime=yes
if [ -f mime_types.erl ]; then
need_mime=`find mime_type_c.erl -newer mime_types.erl -print`
fi
rm_ebin=
if [ ! -d "${YAWS_DIR}/ebin" ]; then
mkdir "${YAWS_DIR}/ebin"
rm_ebin=yes
fi
if [ -n "$need_mime" ]; then
set yaws yaws_generated mime_type_c
for f; do
Expand All @@ -96,6 +102,7 @@ if [ -n "$need_mime" ]; then
for f; do
rm ${YAWS_DIR}/ebin/${f}.beam
done
[ -n "$rm_ebin" ] && rm -rf ${YAWS_DIR}/ebin
fi

## generate yaws scripts
Expand All @@ -122,4 +129,14 @@ else
keep_or_replace ${YAWS_ETCDIR}/yaws/yaws.conf $tmpgen
fi

## generate test suite files
cd ${YAWS_DIR}/test
srcdir=`echo "${YAWS_DIR}" | sed -e 's/\//\\\\\//g'`
[ -n "${REBAR_BUILD_DIR}" ] && builddir="${REBAR_BUILD_DIR}" || builddir="${YAWS_DIR}"
builddir=`echo "${builddir}" | sed -e 's/\//\\\\\//g'`
tmpgen=`mktemp /tmp/${SCRIPT}.XXXXXX` || fail
sed -e 's/@abs_top_srcdir@/'"${srcdir}"'/g' \
-e 's/@abs_top_builddir@/'"${builddir}"'/g' testsuite.hrl.in > $tmpgen || fail
mv -f $tmpgen testsuite.hrl || fail

exit 0
7 changes: 6 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ERLC_FLAGS = $(ERLC_GENERIC_FLAGS)

include @top_srcdir@/erlang_deps.mk

all-local: $(EBIN_DIR)/yaws.app $(EBIN_DIR)/yaws.appup $(EBIN_FILES)
all-local: $(EBIN_DIR) $(EBIN_DIR)/yaws.app $(EBIN_DIR)/yaws.appup $(EBIN_FILES)

tags: $(EBIN_DIR)/yaws_generated.beam $(EBIN_DIR)/yaws_debug.beam
$(AM_V_GEN)erl -noshell -pa $(EBIN_DIR) -s yaws_debug mktags
Expand All @@ -91,6 +91,7 @@ mime_types.erl: @top_builddir@/priv/mime.types $(EBIN_DIR)/mime_type_c.beam \
$(AM_V_GEN)$(ERL) -noshell -pa $(EBIN_DIR) -s mime_type_c generate

$(EBIN_DIR)/yaws.app: @srcdir@/yaws.app.src
$(AM_V_at)$(MKDIR_P) $(EBIN_DIR)
$(AM_V_GEN)$(AWK) -v src="$(MODULES)" \
"/{vsn, *{cmd,/ { \
line = \$$0; \
Expand Down Expand Up @@ -129,12 +130,16 @@ $(EBIN_DIR)/yaws.app: @srcdir@/yaws.app.src
{ print; }" $< > $@

$(EBIN_DIR)/yaws.appup: @srcdir@/yaws.appup.src
$(AM_V_at)$(MKDIR_P) $(EBIN_DIR)
$(AM_V_GEN)sed -e "s/%VSN%/@YAWS_VSN@/g" < $< > $@

$(EBIN_DIR)/%.beam: %.erl
$(AM_V_at)$(MKDIR_P) $(EBIN_DIR)
$(AM_V_at)$(ERLC) $(ERLC_FLAGS) -M $(PHONY_DEPS) -MF $(@:$(EBIN_DIR)/%.beam=$(DEPDIR)/%.Pbeam) -MT $@ $<
$(AM_V_ERLC)$(ERLC) $(ERLC_FLAGS) -o $(EBIN_DIR) $<

$(EBIN_DIR):
$(AM_V_at)$(MKDIR_P) $@

distclean-local:
$(AM_V_at)rm -fr $(DEPDIR)
Expand Down
2 changes: 1 addition & 1 deletion testsuite/Makefile.am → test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SUITE_MODULES_DATADIR_MODS = $(SUITE_MODULES_DATADIR_MODS_BLA:@srcdir@/%=%)

MODULES = $(SUITE_MODULES) $(SUITE_MODULES_DATADIR_MODS) testsuite.erl

EBIN_DIR=@top_builddir@/testsuite
EBIN_DIR=@top_builddir@/test
EBIN_FILES=$(MODULES:%.erl=$(EBIN_DIR)/%.beam)

LOG_DIR=@builddir@/logs
Expand Down
Loading

0 comments on commit 251c8a8

Please sign in to comment.