Skip to content

Commit

Permalink
Add script to repack Boost, patch it and remove extra files
Browse files Browse the repository at this point in the history
Extra files are for example documentation files to slim down the archive to download and the number of files a lot.
Down from 71MB to 22MB.
  • Loading branch information
Orphis committed Jan 10, 2017
1 parent 328b3f1 commit 6a8fd7a
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
47 changes: 47 additions & 0 deletions patch/1.63.0/context_0001_arm64_cpu.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 26b61a67cf1d384796e5ae2f207c5b6fa56015e5 Mon Sep 17 00:00:00 2001
From: Oliver Kowalke <[email protected]>
Date: Thu, 5 Jan 2017 10:38:47 -0800
Subject: [PATCH] remove directive '.cpu' for ARM64/AAPCS/ELF

---
src/asm/jump_arm64_aapcs_elf_gas.S | 1 -
src/asm/make_arm64_aapcs_elf_gas.S | 1 -
src/asm/ontop_arm64_aapcs_elf_gas.S | 1 -
3 files changed, 3 deletions(-)

diff --git a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
index 7c0c2fa..1b8ce9e 100644
--- a/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
+++ b/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
@@ -51,7 +51,6 @@
* *
*******************************************************/

-.cpu generic+fp+simd
.text
.align 2
.global jump_fcontext
diff --git a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
index e71a91c..c1fa843 100644
--- a/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
+++ b/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
@@ -51,7 +51,6 @@
* *
*******************************************************/

-.cpu generic+fp+simd
.text
.align 2
.global make_fcontext
diff --git a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
index 7e3b047..02a3b07 100644
--- a/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
+++ b/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
@@ -51,7 +51,6 @@
* *
*******************************************************/

-.cpu generic+fp+simd
.text
.align 2
.global ontop_fcontext
23 changes: 23 additions & 0 deletions patch/1.63.0/context_0002_macOS_execution_context.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 3167d4dfb82aa74fcf41c755d6c9bc7a3401bfea Mon Sep 17 00:00:00 2001
From: Timo Sandmann <[email protected]>
Date: Sun, 8 Jan 2017 18:24:20 +0100
Subject: [PATCH] Fixes #38

Use correct type cast and tuple extracting for pointer to transfered data tuples
---
include/boost/context/execution_context_v2.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boost/context/execution_context_v2.hpp b/boost/context/execution_context_v2.hpp
index 33b9bda..bbd4eb1 100644
--- a/boost/context/execution_context_v2.hpp
+++ b/boost/context/execution_context_v2.hpp
@@ -103,7 +103,7 @@ class record {

transfer_t run( transfer_t t) {
Ctx from{ t.fctx };
- typename Ctx::args_tpl_t args = std::move( * static_cast< typename Ctx::args_tpl_t * >( t.data) );
+ typename Ctx::args_tpl_t args = std::move( std::get<1>( * static_cast< std::tuple< std::exception_ptr, typename Ctx::args_tpl_t > * >( t.data) ) );
auto tpl = std::tuple_cat(
params_,
std::forward_as_tuple( std::move( from) ),
41 changes: 41 additions & 0 deletions repack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -e

BOOST_VERSION=1.63.0

function finish {
rm -rf ${tmp_dir}
}
trap finish EXIT

out_dir=$(pwd)
patch_dir=$(pwd)/patch/${BOOST_VERSION}
tmp_dir=$(mktemp -d)

echo "Downloading Boost ${BOOST_VERSION}..."
curl -L "http://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION}/boost_${BOOST_VERSION//./_}.tar.bz2" > ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2

mkdir -p ${tmp_dir}/extract
cd ${tmp_dir}/extract
echo "Extracting archive..."
tar xf ${tmp_dir}/boost_${BOOST_VERSION}.tar.bz2

cd boost_*
mkdir patch
for f in ${patch_dir}/*.patch; do
echo "Applying patch ${f}..."
git apply --verbose $f
cp $f patch/
done

echo "Removing extra files..."
find . -name "doc" -print0 | xargs -0 -- rm -rf
find . -name "*.htm*" -delete
find . -name "*.png" -delete
find . -name "*.bmp" -delete
find . -name "*.jpg" -delete

cd ..
echo "Recompressing archive..."
tar cfJ ${out_dir}/boost_${BOOST_VERSION//./_}.tar.xz boost_*

0 comments on commit 6a8fd7a

Please sign in to comment.