Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Do not embed debug symbols in macOS libraries
Browse files Browse the repository at this point in the history
This dramatically lowers the produced binary size.
  • Loading branch information
Jb Aviat authored and ignisf committed Feb 27, 2017
1 parent fe8bb9f commit 9c50f36
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
8 changes: 4 additions & 4 deletions patches/0001-Build-a-standalone-static-library.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From d10394091dcd5bdc623c456243e49966f22e1f71 Mon Sep 17 00:00:00 2001
From b042a96f069c0fd35adbceb43bd9db78f8420008 Mon Sep 17 00:00:00 2001
From: Petko Bordjukov <bordjukov@gmail.com>
Date: Mon, 25 Jul 2016 00:00:19 +0300
Subject: [PATCH 1/3] Build a standalone static library
Subject: [PATCH 1/4] Build a standalone static library

---
gypfiles/standalone.gypi | 3 +++
1 file changed, 3 insertions(+)

diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
index 6599bb8..c81ae2c 100644
index 6599bb8351..c81ae2caa0 100644
--- a/gypfiles/standalone.gypi
+++ b/gypfiles/standalone.gypi
@@ -531,6 +531,9 @@
Expand All @@ -22,5 +22,5 @@ index 6599bb8..c81ae2c 100644
'defines!': [
'DEBUG',
--
2.10.0
2.11.1

10 changes: 5 additions & 5 deletions patches/0002-Don-t-compile-unnecessary-stuff.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From 785a8197ebefd37592f15f0b23c13a44faa5c239 Mon Sep 17 00:00:00 2001
From 78d8850d13bf24b0c07e6470f4af5a3cee7289df Mon Sep 17 00:00:00 2001
From: Petko Bordjukov <bordjukov@gmail.com>
Date: Sat, 15 Oct 2016 15:05:01 +0300
Subject: [PATCH 2/3] Don't compile unnecessary stuff
Subject: [PATCH 2/4] Don't compile unnecessary stuff

---
Makefile | 7 +------
gypfiles/all.gyp | 33 +--------------------------------
2 files changed, 2 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index a6d4d13..bd73b13 100644
index a6d4d135da..bd73b13263 100644
--- a/Makefile
+++ b/Makefile
@@ -258,12 +258,7 @@ GYPFILES = third_party/icu/icu.gypi third_party/icu/icu.gyp \
Expand All @@ -27,7 +27,7 @@ index a6d4d13..bd73b13 100644
# If vtunejit=on, the v8vtune.gyp will be appended.
ifeq ($(vtunejit), on)
diff --git a/gypfiles/all.gyp b/gypfiles/all.gyp
index 6b4ef82..9b02b4d 100644
index 6b4ef82d69..9b02b4d305 100644
--- a/gypfiles/all.gyp
+++ b/gypfiles/all.gyp
@@ -15,38 +15,7 @@
Expand Down Expand Up @@ -71,5 +71,5 @@ index 6b4ef82..9b02b4d 100644
}
]
--
2.10.0
2.11.1

8 changes: 4 additions & 4 deletions patches/0003-Use-the-fPIC-flag-for-the-static-library.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From cd49967fd692ad4ec76e6d40a35118dfcc9b2029 Mon Sep 17 00:00:00 2001
From 4792a3b2cca0ac92fef185c4f7394e3580d8ac23 Mon Sep 17 00:00:00 2001
From: Petko Bordjukov <bordjukov@gmail.com>
Date: Mon, 25 Jul 2016 00:05:47 +0300
Subject: [PATCH 3/3] Use the -fPIC flag for the static library
Subject: [PATCH 3/4] Use the -fPIC flag for the static library

---
gypfiles/standalone.gypi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
index c81ae2c..b3e4d67 100644
index c81ae2caa0..b3e4d67a6e 100644
--- a/gypfiles/standalone.gypi
+++ b/gypfiles/standalone.gypi
@@ -803,7 +803,7 @@
Expand All @@ -21,5 +21,5 @@ index c81ae2c..b3e4d67 100644
}],
[ 'clang==0 and coverage==1', {
--
2.10.0
2.11.1

25 changes: 25 additions & 0 deletions patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From ca12923b30009a29f4be8b93d44bdccf0cce44a0 Mon Sep 17 00:00:00 2001
From: Jb Aviat <jb@sqreen.io>
Date: Mon, 27 Feb 2017 11:14:42 +0200
Subject: [PATCH 4/4] Do not embed debug symbols in macOS libraries

This lowers dramatically the produced binary size
---
gypfiles/standalone.gypi | 1 +
1 file changed, 1 insertion(+)

diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
index b3e4d67a6e..e9ed2437a7 100644
--- a/gypfiles/standalone.gypi
+++ b/gypfiles/standalone.gypi
@@ -1062,6 +1062,7 @@
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO', # No -gdwarf-2
# GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
--
2.11.1

0 comments on commit 9c50f36

Please sign in to comment.