File 0162-otp-Add-erts-doc-to-prebuild.patch of Package erlang
From a1bcbba3ed15b45601bcadcedeee5f0f675b87e9 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 7 Apr 2021 11:20:52 +0200
Subject: [PATCH 2/2] otp: Add erts/doc to prebuild
The prebuilt tar would not include the documentation
in erts/doc as that entire folder i skipped. So we
introduce a new prebuild.keep that makes sure to keep
the file even if it is part of the .skip or .delete.
---
erts/prebuild.keep | 1 +
scripts/build-otp-tar | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+)
create mode 100644 erts/prebuild.keep
diff --git a/erts/prebuild.keep b/erts/prebuild.keep
new file mode 100644
index 0000000000..a2e6bd485b
--- /dev/null
+++ b/erts/prebuild.keep
@@ -0,0 +1 @@
+doc/
diff --git a/scripts/build-otp-tar b/scripts/build-otp-tar
index fa7ad2c19d..3f11026564 100755
--- a/scripts/build-otp-tar
+++ b/scripts/build-otp-tar
@@ -21,6 +21,7 @@ prebuilt_filename=prebuilt.files
configure_args="--disable-hybrid-heap"
pbskip_name=prebuild.skip
pbdel_name=prebuild.delete
+pbkeep_name=prebuild.keep
skip_name=SKIP
script_name=`basename $0`
verbose=true
@@ -498,6 +499,14 @@ else
error "Failed to build OTP"
fi
echo " " >> $build_log
+ echo " === Building OTP doc chunks ========================= " >> $build_log
+ echo " " >> $build_log
+ echo "make docs DOC_TARGETS=chunks" >> $build_log
+ make docs DOC_TARGETS=chunks >> $build_log 2>&1
+ if [ $? -ne 0 ]; then
+ error "Failed to build OTP"
+ fi
+ echo " " >> $build_log
echo " ==================================================== " >> $build_log
cd $start_dir
@@ -591,6 +600,33 @@ for delete_file in $delete_files; do
remove $src_root/$delete_file
done
+progress "Searching for $pbkeep_name files in source-directory"
+cd $src_root
+keep_files=`find . -name $pbkeep_name`
+
+for keep_file in $keep_files; do
+ progress "Removing $keep_file from source-directory"
+ remove $src_root/$keep_file
+done
+
+## We search for $pbkeep_name before we do the deletion as otherwise
+## the deletion may delete these files. However, we want to execute
+## the actions of the keep file after.
+progress "Searching for $pbkeep_name files in pre-build-directory"
+cd $prebld_root
+keep_files=`find . -name $pbkeep_name`
+kobjs=""
+for keep_file in $keep_files; do
+ dir=`dirname $keep_file`
+ keep_objs=`cat $keep_file`
+ for keep_obj in $keep_objs; do
+ kobj=`check_filename $keep_file $dir $keep_obj`
+ kobjs="$kobjs $kobj"
+ done
+
+ remove $prebld_root/$keep_file
+done
+
progress "Searching for $pbskip_name files in pre-build-directory"
cd $prebld_root
skip_files=`find . -name $pbskip_name`
@@ -623,6 +659,11 @@ for delete_file in $delete_files; do
remove $prebld_root/$delete_file
done
+for kobj in $kobjs; do
+ progress "Keeping $kobj in pre-build-directory"
+ copy $build_dir/../$kobj $prebld_root/$kobj
+done
+
cd $prebld_dir
prebuilt_files=$prebld_dir/$prebuilt_filename
progress "Creating $build_dir_name/$prebuilt_filename in pre-build-directory"
--
2.26.2