Commit 3c9ac14b authored by lyxell's avatar lyxell Committed by GitHub

Merge pull request #802 from jam7/refactor/crew-strip

Change crew to strip binaries and libraries at install time
parents e556df31 6a3a93dc
......@@ -27,6 +27,9 @@ else
CREW_NPROC = ENV["CREW_NPROC"]
end
# Set CREW_NOT_STRIP from environment variable
CREW_NOT_STRIP = ENV["CREW_NOT_STRIP"]
# Set XZ_OPT environment variable for build command.
# If CREW_XZ_OPT is defined, use it by default. Use `-7e`, otherwise.
if ENV["CREW_XZ_OPT"].to_s == ''
......@@ -435,6 +438,16 @@ def install_package (pkgdir)
FileUtils.mv 'dlist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.directorylist"
FileUtils.mv 'filelist', CREW_CONFIG_PATH + "meta/#{@pkg.name}.filelist"
# Strip libraries with -S
system "find . -name 'lib*.a' -print | xargs chmod u+w 2>/dev/null" unless CREW_NOT_STRIP
system "find . -name 'lib*.a' -print | xargs strip -S 2>/dev/null" unless CREW_NOT_STRIP
system "find . -name 'lib*.so*' -print | xargs chmod u+w 2>/dev/null" unless CREW_NOT_STRIP
system "find . -name 'lib*.so*' -print | xargs strip -S 2>/dev/null" unless CREW_NOT_STRIP
# Strip binaries
system "find . -type f -perm /111 -print | sed -e '/lib.*\.a$/d' -e '/lib.*\.so/d' | xargs chmod u+w 2>/dev/null" unless CREW_NOT_STRIP
system "find . -type f -perm /111 -print | sed -e '/lib.*\.a$/d' -e '/lib.*\.so/d' | xargs strip 2>/dev/null" unless CREW_NOT_STRIP
system "tar cf - ./usr/* | (cd /; tar xp --keep-directory-symlink -f -)"
end
end
......
......@@ -9,8 +9,6 @@ class Package
attr_accessor :in_upgrade
end
@@debug_symbol = ENV['CREW_DEBUG_SYMBOL'] || false
def self.dependencies
# We need instance variable in derived class, so not define it here,
# base class. Instead of define it, we initialize it in a function
......
......@@ -16,11 +16,10 @@ class Bison < Package
def self.build
system './configure --prefix=/usr/local'
system "make"
system "find . -name '*.a' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -37,11 +37,6 @@ class Bz2 < Package
system "mkdir", "-p", "#{CREW_DEST_DIR}#{CREW_LIB_PREFIX}"
system "cp", "-p", "libbz2.so.1.0.6", "#{CREW_DEST_DIR}#{CREW_LIB_PREFIX}"
system "ln", "-s", "libbz2.so.1.0.6", "#{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/libbz2.so.1.0"
# Strip binaries and libraries
system "strip #{CREW_DEST_DIR}/usr/local/bin/bzip2"
system "strip #{CREW_DEST_DIR}/usr/local/bin/bzip2recover"
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/*"
end
def self.check
......
......@@ -18,10 +18,7 @@ class Curl < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
# strip debug symbol from library
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/libcurl.so.*"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -15,7 +15,7 @@ class Diffutils < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -9,7 +9,6 @@ class Dos2unix < Package
def self.build
system 'make'
system 'make strip'
end
def self.install
......
......@@ -16,7 +16,7 @@ class Ed < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -14,10 +14,6 @@ class Expat < Package
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
# strip binary and library
system "strip #{CREW_DEST_DIR}/usr/local/bin/xmlwf"
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/libexpat.so.*"
end
def self.check
......
......@@ -12,8 +12,6 @@ class Expect < Package
def self.build
system "./configure", "--prefix=/usr/local"
system "make"
system "find . -name '*.so' -print | xargs strip -S"
system "strip expect"
end
def self.install
......
......@@ -10,11 +10,10 @@ class Filecmd < Package
def self.build
system "./configure"
system "make"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -13,11 +13,10 @@ class Flex < Package
def self.build
system "./configure", "--with-pic", "--disable-static", "--enable-shared"
system "make"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -16,11 +16,10 @@ class Gawk < Package
def self.build
system './configure', '--prefix=/usr/local'
system 'make'
system "find . -name '*.so' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -12,11 +12,10 @@ class Gdbm < Package
def self.build
system './configure', '--disable-static', '--enable-shared', '--with-pic'
system 'make'
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -14,11 +14,10 @@ class Gettext < Package
def self.build
system "./configure", "--enable-shared", "--disable-static", "--with-pic"
system "make"
system "find . -name '*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -22,7 +22,6 @@ class Git < Package
def self.build
system "#{@make_cmd} all"
system "#{@make_cmd} strip"
end
def self.install
......
......@@ -16,7 +16,7 @@ class Less < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -10,11 +10,10 @@ class Libffi < Package
def self.build
system "./configure", "--enable-shared", "--disable-static", "--with-pic", "--disable-debug", "--disable-dependency-tracking"
system "make"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -10,11 +10,10 @@ class Libpipeline < Package
def self.build
system './configure', '--disable-static', '--enable-shared', '--with-pic'
system 'make'
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -17,9 +17,6 @@ class Libssh2 < Package
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
# strip debug symbol from library
system "strip -S #{CREW_DEST_DIR}/usr/local/lib/libssh2.so.*"
end
def self.check
......
......@@ -19,8 +19,6 @@ class Libunbound < Package
system "sed", "-i", "Makefile", "-e", '/$(LEX) -t $(srcdir)\/util\/configlexer.lex/s:-t:-t -Pub_c_:'
system "make"
system "make", "strip"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
......
......@@ -13,10 +13,7 @@ class Libxml2 < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
# strip debug symbol from library
system "strip -S #{CREW_DEST_DIR}/usr/local/lib/libxml2.so.*"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -14,7 +14,7 @@ class Lzip < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -15,7 +15,7 @@ class M4 < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -16,7 +16,7 @@ class Make < Package
end
def self.install
system "./make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "./make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -20,11 +20,10 @@ class Mandb < Package
'--disable-cache-owner', # we can't create the user 'man'
'--with-pager=/usr/local/bin/less' # the pager is not at the default location
system 'make'
system "find . -name 'lib*.so*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
puts ""
puts "You will have to change the default PAGER environment variable to be able to use mandb:"
puts "echo \"export PAGER=/usr/local/bin/less\" >> ~/.bashrc && . ~/.bashrc"
......
......@@ -23,17 +23,5 @@ class Ncurses < Package
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
# strip binaries
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/clear"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/infocmp"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/tabs"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/tic"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/tput"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/tset"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/toe"
# strip libraries here since `make install` re-link libraries again
system "find #{CREW_DEST_DIR}#{CREW_LIB_PREFIX} -name 'lib*.so.*' -print | xargs strip -S"
end
end
......@@ -42,8 +42,5 @@ class Ncursesw < Package
system "rm", "#{CREW_DEST_DIR}/usr/local/bin/tput"
system "rm", "#{CREW_DEST_DIR}/usr/local/bin/tset"
system "rm", "#{CREW_DEST_DIR}/usr/local/bin/toe"
# strip libraries here since `make install` re-link libraries again
system "find #{CREW_DEST_DIR}#{CREW_LIB_PREFIX} -name 'lib*.so.*' -print | xargs strip -S"
end
end
......@@ -26,13 +26,10 @@ class Openssl < Package
end
system "./config --prefix=/usr/local --openssldir=/etc/ssl #{options}"
system "make"
system "find . -name '*.so' -print | xargs strip -S"
system "find . -name '*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "INSTALL_PREFIX=#{CREW_DEST_DIR}", "install"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/openssl"
system "find #{CREW_DEST_DIR}/usr/local -name 'lib*.a' -print | xargs rm"
# move man to /usr/local/man
......
......@@ -13,7 +13,7 @@ class Patch < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -13,8 +13,7 @@ class Pcre < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/lib*.so.*"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -14,11 +14,10 @@ class Perl < Package
# Create shared library
system "BUILD_ZLIB=False BUILD_BZIP2=0 ./Configure -de -Duseshrplib"
system "make"
system "find . -name '*.so' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -21,7 +21,7 @@ class Pkgconfig < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -16,22 +16,13 @@ class Python27 < Package
def self.build
system "./configure", "CPPFLAGS=-I/usr/local/include/ncurses -I/usr/local/include/ncursesw", "--with-ensurepip=install", "--enable-shared"
system "make"
# strip debug symbols from library
system "find . -name '*.so' -print | xargs strip -S" unless @@debug_symbol
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
# strip binary
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/python2" unless @@debug_symbol
# remove static library
system "find #{CREW_DEST_DIR}/usr/local -name 'libpython*.a' -print | xargs rm"
# remove cache (byte-code) files from install package
system "find #{CREW_DEST_DIR}/usr/local -name '*.pyc' -o -name '*.pyo' | xargs rm"
end
def self.check
......
......@@ -17,22 +17,13 @@ class Python3 < Package
system "./configure", "CPPFLAGS=-I/usr/local/include/ncurses -I/usr/local/include/ncursesw",
"--with-ensurepip=install", "--enable-shared"
system "make"
# strip debug symbols from library
system "find . -name '*.so' -print | xargs strip -S" unless @@debug_symbol
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
# strip binary
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/python3" unless @@debug_symbol
# remove static library
system "find #{CREW_DEST_DIR}/usr/local -name 'libpython*.a' -print | xargs rm"
# remove cache (byte-code) files from install package
system "find #{CREW_DEST_DIR}/usr/local -name '__pycache__' -print | xargs rm -rf"
end
def self.check
......@@ -54,10 +45,6 @@ class Python3 < Package
"bpo-30175: FIXME: cyrus.andrew.cmu.edu doesn\'t accept "\
"our randomly generated client x509 certificate anymore")'
# skip gdb test since we are stripping debug symbols
system "sed", "-i", "Lib/test/test_gdb.py",
"-e", '/get_gdb_version/iraise unittest.SkipTest("only for python install with debug symbols")' unless @@debug_symbol
# Using /tmp breaks test_distutils, test_subprocess
# Proxy setting breaks test_httpservers, test_ssl,
# test_urllib, test_urllib2, test_urllib2_localnet
......
......@@ -24,7 +24,7 @@ class R < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -25,7 +25,6 @@ class Readline < Package
system "CC='gcc' ./configure --libdir=#{CREW_LIB_PREFIX} --disable-static --with-curses"
system "make"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
......
......@@ -16,12 +16,10 @@ class Ruby < Package
def self.build
system "CC='gcc' ./configure"
system "make"
system "find . -name '*.so' | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
system "strip #{CREW_DEST_DIR}/usr/local/bin/ruby"
end
def self.check
......
......@@ -10,10 +10,9 @@ class Sqlite < Package
def self.build
system "./configure", "--disable-static", "--enable-shared", "--with-pic"
system "make"
system "find . -name 'lib*.so.*' -print | xargs strip -S"
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
end
......@@ -20,7 +20,6 @@ class Vim < Package
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
system "strip", "#{CREW_DEST_DIR}/usr/local/bin/vim"
puts "\nMake sure to put your .vim directory in a subdirectory of /usr/local so it has execute permissions"
puts "You can then symlink to your home directory so vim can see it"
......
......@@ -14,10 +14,7 @@ class Xzutils < Package
end
def self.install
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install-strip"
# strip debug symbol from library
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/liblzma.so.*"
system "make", "DESTDIR=#{CREW_DEST_DIR}", "install"
end
def self.check
......
......@@ -17,9 +17,6 @@ class Zlibpkg < Package
# remove static library since there is no configuration option to not create it.
system "rm", "#{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/libz.a"
# strip library
system "strip -S #{CREW_DEST_DIR}#{CREW_LIB_PREFIX}/libz.so.*"
end
def self.check
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment