diff --git a/Makefile b/Makefile index e46e438a78..7628fc5356 100644 --- a/Makefile +++ b/Makefile @@ -331,9 +331,7 @@ clean-unpacked-source-dist: .PHONY: packages package-deb \ package-rpm package-rpm-fedora package-rpm-suse \ - package-windows package-standalone-macosx \ - package-standalone-linux-x86_64 \ - package-standalone-freebsd-x86_64 \ + package-windows \ package-generic-unix # This variable is exported so sub-make instances know where to find the @@ -343,9 +341,7 @@ PACKAGES_SOURCE_DIST_FILE ?= $(firstword $(SOURCE_DIST_FILES)) packages package-deb package-rpm \ package-rpm-redhat package-rpm-fedora package-rpm-rhel6 package-rpm-rhel7 \ package-rpm-rhel8 package-rpm-suse package-rpm-opensuse package-rpm-sles11 \ -package-windows package-standalone-macosx \ -package-standalone-linux-x86_64 \ -package-standalone-freebsd-x86_64 \ +package-windows \ package-generic-unix: $(PACKAGES_SOURCE_DIST_FILE) $(verbose) $(MAKE) -C packaging $@ \ SOURCE_DIST_FILE=$(abspath $(PACKAGES_SOURCE_DIST_FILE)) diff --git a/packaging/Makefile b/packaging/Makefile index 74346313a2..f4c0e764c2 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -38,9 +38,7 @@ all: packages package-rpm-redhat package-rpm-fedora \ package-rpm-rhel6 package-rpm-rhel7 package-rpm-rhel8 \ package-rpm-suse package-rpm-opensuse package-rpm-sles11 \ - package-windows package-standalone-macosx \ - package-standalone-linux-x86_64 \ - package-standalone-freebsd-x86_64 \ + package-windows \ package-generic-unix PACKAGES_DIR ?= ../PACKAGES @@ -110,30 +108,9 @@ package-windows: $(SOURCE_DIST_FILE) package-generic-unix: $(SOURCE_DIST_FILE) $(gen_verbose) $(MAKE) -C generic-unix $(VARS) all $(DO_CLEAN) -ifeq ($(PLATFORM),linux) -ifeq ($(shell uname -m),x86_64) -package-standalone-linux-x86_64: $(SOURCE_DIST_FILE) - $(gen_verbose) $(MAKE) -C standalone $(VARS) OS=linux-x86_64 all $(DO_CLEAN) -endif -endif - -ifeq ($(PLATFORM),freebsd) -ifeq ($(shell uname -m),amd64) -package-standalone-freebsd-x86_64: $(SOURCE_DIST_FILE) - $(gen_verbose) $(MAKE) -C standalone $(VARS) OS=freebsd-x86_64 all $(DO_CLEAN) -endif -endif - -ifeq ($(PLATFORM),darwin) -packages: package-standalone-macosx - -package-standalone-macosx: $(SOURCE_DIST_FILE) - $(gen_verbose) $(MAKE) -C standalone $(VARS) OS=mac all $(DO_CLEAN) -endif - .PHONY: clean clean: - for subdir in debs/Debian RPMS/Fedora windows windows-exe generic-unix standalone; do \ + for subdir in debs/Debian RPMS/Fedora windows windows-exe generic-unix; do \ $(MAKE) -C "$$subdir" clean; \ done diff --git a/packaging/standalone/Makefile b/packaging/standalone/Makefile deleted file mode 100644 index a56a549e69..0000000000 --- a/packaging/standalone/Makefile +++ /dev/null @@ -1,146 +0,0 @@ -SOURCE_DIST_FILE ?= $(wildcard ../../rabbitmq-server-*.tar.xz) - -ifneq ($(filter-out clean,$(MAKECMDGOALS)),) -ifeq ($(SOURCE_DIST_FILE),) -$(error Cannot find source archive; please specify SOURCE_DIST_FILE) -endif -ifneq ($(words $(SOURCE_DIST_FILE)),1) -$(error Multiple source archives found; please specify SOURCE_DIST_FILE) -endif - -VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE))) -ifeq ($(VERSION),) -$(error Cannot determine version; please specify VERSION) -endif -endif - -SOURCE_DIR=rabbitmq-server-$(VERSION) -TARGET_DIR=rabbitmq_server-$(VERSION) -TARGET_TARBALL=rabbitmq-server-$(OS)-standalone-$(VERSION) -RLS_DIR=$(TARGET_DIR)/release/$(TARGET_DIR) - -ERTS_VSN=$(shell erl -noshell -eval 'io:format("~s", [erlang:system_info(version)]), halt().') -ERTS_ROOT_DIR=$(shell erl -noshell -eval 'io:format("~s", [code:root_dir()]), halt().') -OTP_RELEASE=$(shell erl -noshell -eval 'io:format("~s", [erlang:system_info(otp_release)]), halt().') - -# used to generate the erlang release -RABBITMQ_HOME=$(TARGET_DIR) -RABBITMQ_EBIN_ROOT=$(RABBITMQ_HOME)/ebin -RABBITMQ_PLUGINS_DIR=$(RABBITMQ_HOME)/plugins -RABBITMQ_PLUGINS_EXPAND_DIR=$(RABBITMQ_PLUGINS_DIR)/expand - -RABBITMQ_DEFAULTS=$(TARGET_DIR)/sbin/rabbitmq-defaults -fix_defaults = sed -e $(1) $(RABBITMQ_DEFAULTS) > $(RABBITMQ_DEFAULTS).tmp \ - && mv $(RABBITMQ_DEFAULTS).tmp $(RABBITMQ_DEFAULTS) - -unexport DEPS_DIR -unexport ERL_LIBS -MAKEOVERRIDES = - -# See comment below about `$(HOME)` and Freedesktop.org variables. -XDG_DATA_HOME ?= $(HOME)/.local/share -XDG_CONFIG_HOME ?= $(HOME)/.config - -all: dist - @: - -dist: - rm -rf $(SOURCE_DIR) $(TARGET_DIR) - xzcat $(SOURCE_DIST_FILE) | tar -xf - - -# We explicitely set $HOME as a Make variable below because some package -# builders do that, as part of cleaning the build environment. It -# exercises our hack to convince mix(1) to work offline because that -# hack depends on `$HOME`. A Make variable on the command line takes -# precedence over variables declared in Makefiles, so our hack needs -# to consider this. We do the same with the Freedesktop.org-specified -# variables ($XDG_*_HOME). - $(MAKE) -C $(SOURCE_DIR) \ - HOME="$(HOME)" \ - XDG_DATA_HOME="$(XDG_DATA_HOME)" \ - XDG_CONFIG_HOME="$(XDG_CONFIG_HOME)" \ - PREFIX= RMQ_ROOTDIR= \ - RMQ_ERLAPP_DIR=$(abspath $(TARGET_DIR)) \ - MANDIR=$(abspath $(TARGET_DIR))/share/man \ - manpages install install-man - - mkdir -p $(TARGET_DIR)/etc/rabbitmq - cp $(SOURCE_DIR)/deps/rabbit/docs/rabbitmq.config.example \ - $(TARGET_DIR)/etc/rabbitmq - -## Here we set the RABBITMQ_HOME variable, -## then we make ERL_DIR point to our released erl -## and we add the paths to our released start_clean and start_sasl boot scripts - $(call fix_defaults,'s:^SYS_PREFIX=$$:SYS_PREFIX=\$${RABBITMQ_HOME}:') - $(call fix_defaults,'s:^ERL_DIR=$$:ERL_DIR=\$${RABBITMQ_HOME}/erts-$(ERTS_VSN)/bin/:') - $(call fix_defaults,'s:start_clean$$:"\$${SYS_PREFIX}/releases/$(VERSION)/start_clean":') - $(call fix_defaults,'s:start_sasl:"\$${SYS_PREFIX}/releases/$(VERSION)/start_sasl":') - - chmod 0755 $(RABBITMQ_DEFAULTS) - - mkdir -p $(TARGET_DIR)/etc/rabbitmq - - $(MAKE) generate_release - - mkdir -p $(RLS_DIR) - tar -C $(RLS_DIR) -xzf $(RABBITMQ_HOME)/rabbit.tar.gz - rm -rf $(RLS_DIR)/lib/rabbit-$(VERSION)/plugins/expand - rm $(RLS_DIR)/releases/rabbit.rel - -# add boot files - cp $(ERTS_ROOT_DIR)/bin/start_clean.boot $(RLS_DIR)/releases/$(VERSION) - cp $(ERTS_ROOT_DIR)/bin/start_sasl.boot $(RLS_DIR)/releases/$(VERSION) - cp $(ERTS_ROOT_DIR)/bin/no_dot_erlang.boot $(RLS_DIR)/releases/$(VERSION) - -# add OTP_VERSION file - mkdir -p $(RLS_DIR)/releases/$(OTP_RELEASE) - cp $(ERTS_ROOT_DIR)/releases/$(OTP_RELEASE)/OTP_VERSION $(RLS_DIR)/releases/$(OTP_RELEASE)/OTP_VERSION - -# copy boot scripts to bin folder as Erlang does. -# Required by rabbit_nodes:ensure_epmd/0 or escript(1). - mkdir -p $(RLS_DIR)/bin/ - cp $(RLS_DIR)/releases/$(VERSION)/*.boot $(RLS_DIR)/bin - -# move rabbitmq files to top level folder - mv $(RLS_DIR)/lib/rabbit-$(VERSION)/* $(RLS_DIR) - -# remove empty lib/rabbit-$(VERSION) folder - rm -rf $(RLS_DIR)/lib/rabbit-$(VERSION) - -# fix Erlang ROOTDIR - chmod +w $(RLS_DIR)/erts-$(ERTS_VSN)/bin/erl - patch -o $(RLS_DIR)/erts-$(ERTS_VSN)/bin/erl $(RLS_DIR)/erts-$(ERTS_VSN)/bin/erl.src < erl.diff - rm -f $(RLS_DIR)/erts-$(ERTS_VSN)/bin/erl.orig - - cd $(TARGET_DIR)/release && \ - find $(TARGET_DIR) | \ - LC_COLLATE=C sort > $(CURDIR)/manifest - - cd $(TARGET_DIR)/release && \ - tar -T $(CURDIR)/manifest --no-recursion -cf - | \ - xz > $(CURDIR)/$(TARGET_TARBALL).tar.xz - - if test "$(PACKAGES_DIR)"; then \ - mkdir -p "$(PACKAGES_DIR)"; \ - mv $(TARGET_TARBALL).tar.xz "$(PACKAGES_DIR)"; \ - fi - -clean: - rm -rf rabbitmq-server-* rabbitmq_server-* manifest src/rabbit_release.beam - -.PHONY : generate_release -generate_release: - erlc \ - -I $(TARGET_DIR)/include/ -o src -Wall \ - -v +debug_info -Duse_proper_qc \ - -pa $(TARGET_DIR)/ebin/ src/rabbit_release.erl - ERL_LIBS="$(TARGET_DIR)/plugins:$$ERL_LIBS" \ - erl \ - -pa "$(RABBITMQ_EBIN_ROOT)" \ - -pa src \ - -noinput \ - -hidden \ - -s rabbit_release \ - -extra "$(RABBITMQ_PLUGINS_DIR)" "$(RABBITMQ_PLUGINS_EXPAND_DIR)" "$(RABBITMQ_HOME)" - test -f $(RABBITMQ_HOME)/rabbit.tar.gz - rm src/rabbit_release.beam diff --git a/packaging/standalone/erl.diff b/packaging/standalone/erl.diff deleted file mode 100644 index 13b7d328d6..0000000000 --- a/packaging/standalone/erl.diff +++ /dev/null @@ -1,4 +0,0 @@ -21c21 -< ROOTDIR="%FINAL_ROOTDIR%" ---- -> ROOTDIR="$(cd $(dirname "$0") && pwd)/../.." diff --git a/packaging/standalone/src/rabbit_release.erl b/packaging/standalone/src/rabbit_release.erl deleted file mode 100644 index 6ffeb0c8ce..0000000000 --- a/packaging/standalone/src/rabbit_release.erl +++ /dev/null @@ -1,163 +0,0 @@ -%% The contents of this file are subject to the Mozilla Public License -%% Version 1.1 (the "License"); you may not use this file except in -%% compliance with the License. You may obtain a copy of the License -%% at https://www.mozilla.org/MPL/ -%% -%% Software distributed under the License is distributed on an "AS IS" -%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -%% the License for the specific language governing rights and -%% limitations under the License. -%% -%% The Original Code is RabbitMQ. -%% -%% The Initial Developer of the Original Code is GoPivotal, Inc. -%% Copyright (c) 2007-2012 GoPivotal, Inc. All rights reserved. -%% --module(rabbit_release). - --export([start/0]). - --include("rabbit.hrl"). - --define(BaseApps, [rabbit]). --define(ERROR_CODE, 1). - -%% We need to calculate all the ERTS apps we need to ship with a -%% standalone rabbit. To acomplish that we need to unpack and load the plugins -%% apps that are shiped with rabbit. -%% Once we get that we generate an erlang release inside a tarball. -%% Our make file will work with that release to generate our final rabbitmq -%% package. -start() -> - %% Determine our various directories - [PluginsDistDir, UnpackedPluginDir, RabbitHome] = - init:get_plain_arguments(), - RootName = UnpackedPluginDir ++ "/rabbit", - - %% extract the plugins so we can load their apps later - prepare_plugins(PluginsDistDir, UnpackedPluginDir), - - %% add the plugin ebin folder to the code path. - add_plugins_to_path(UnpackedPluginDir), - - PluginAppNames = [P#plugin.name || - P <- rabbit_plugins:list(PluginsDistDir, false)], - - %% Build the entire set of dependencies - this will load the - %% applications along the way - AllApps = case catch sets:to_list(expand_dependencies(PluginAppNames)) of - {failed_to_load_app, App, Err} -> - terminate("failed to load application ~s:~n~p", - [App, Err]); - AppList -> - AppList - end, - - %% we need a list of ERTS apps we need to ship with rabbit - RabbitMQAppNames = lists:umerge( - lists:sort(sets:to_list(expand_dependencies([rabbit]))), - [P#plugin.name || - P <- rabbit_plugins:list(PluginsDistDir, true)]) - -- PluginAppNames, - {ok, SslAppsConfig} = application:get_env(rabbit, ssl_apps), - - BaseApps = lists:umerge([ - lists:sort(RabbitMQAppNames), - lists:sort(SslAppsConfig), - lists:sort(AllApps -- PluginAppNames)]), - - AppVersions = [determine_version(App) || App <- BaseApps], - RabbitVersion = proplists:get_value(rabbit, AppVersions), - - %% Build the overall release descriptor - RDesc = {release, - {"rabbit", RabbitVersion}, - {erts, erlang:system_info(version)}, - AppVersions}, - - %% Write it out to $RABBITMQ_PLUGINS_EXPAND_DIR/rabbit.rel - rabbit_file:write_file(RootName ++ ".rel", io_lib:format("~p.~n", [RDesc])), - - %% Compile the script - systools:make_script(RootName), - systools:script2boot(RootName), - %% Make release tarfile - make_tar(RootName, RabbitHome), - rabbit_misc:quit(0). - -make_tar(Release, RabbitHome) -> - systools:make_tar(Release, - [ - {dirs, - [docs, escript, etc, include, plugins, sbin, share]}, - {erts, code:root_dir()}, - {outdir, RabbitHome} - ]). - -determine_version(App) -> - application:load(App), - {ok, Vsn} = application:get_key(App, vsn), - {App, Vsn}. - -delete_recursively(Fn) -> - case rabbit_file:recursive_delete([Fn]) of - ok -> ok; - {error, {Path, E}} -> {error, {cannot_delete, Path, E}}; - Error -> Error - end. - -prepare_plugins(PluginsDistDir, DestDir) -> - %% Eliminate the contents of the destination directory - case delete_recursively(DestDir) of - ok -> ok; - {error, E} -> terminate("Could not delete dir ~s (~p)", [DestDir, E]) - end, - case filelib:ensure_dir(DestDir ++ "/") of - ok -> ok; - {error, E2} -> terminate("Could not create dir ~s (~p)", [DestDir, E2]) - end, - - [prepare_plugin(Plugin, DestDir) || - Plugin <- rabbit_plugins:list(PluginsDistDir, true)]. - -prepare_plugin(#plugin{type = ez, location = Location}, PluginDestDir) -> - zip:unzip(Location, [{cwd, PluginDestDir}]); -prepare_plugin(#plugin{type = dir, name = Name, location = Location}, - PluginsDestDir) -> - rabbit_file:recursive_copy(Location, - filename:join([PluginsDestDir, Name])). - -expand_dependencies(Pending) -> - expand_dependencies(sets:new(), Pending). -expand_dependencies(Current, []) -> - Current; -expand_dependencies(Current, [Next|Rest]) -> - case sets:is_element(Next, Current) of - true -> - expand_dependencies(Current, Rest); - false -> - case application:load(Next) of - ok -> - ok; - {error, {already_loaded, _}} -> - ok; - {error, Reason} -> - throw({failed_to_load_app, Next, Reason}) - end, - {ok, Required} = application:get_key(Next, applications), - Unique = [A || A <- Required, not(sets:is_element(A, Current))], - expand_dependencies(sets:add_element(Next, Current), Rest ++ Unique) - end. - -add_plugins_to_path(PluginDir) -> - [add_plugin_to_path(PluginName) || - PluginName <- filelib:wildcard(PluginDir ++ "/*/ebin/*.app")]. - -add_plugin_to_path(PluginAppDescFn) -> - %% Add the plugin ebin directory to the load path - PluginEBinDirN = filename:dirname(PluginAppDescFn), - code:add_path(PluginEBinDirN). - -terminate(Fmt, Args) -> - io:format("ERROR: " ++ Fmt ++ "~n", Args), - rabbit_misc:quit(?ERROR_CODE).