Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl: Add static PIE build #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions perl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Miniperl

Build the gzip data compressor as a static PIE ELF running on Linux.

## Requirements
Make sure the following packages are installed:
- gcc >= 8 (required for the -static-pie linking option)
- git
- GNU Make

## Building
The miniperl static PIE ELF file is located in the current directory. If you want to rebuild it, run:

'''bash
$ ./build.sh
'''

This script downloads, unpacks, patches, configures and builds the gzip static PIE ELF file.
34 changes: 34 additions & 0 deletions perl/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

APPNAME=miniperl
DIRNAME=perl5
URL=https://github.com/perl/perl5

# Clean up
rm -rf ${DIRNAME}

echo -n "Downloading ${APPNAME} sources ... "
git clone ${URL} --quiet
if test $? -ne 0; then
echo ""
echo "Unable to to clone git from ${URL}"
exit 1
fi
echo "DONE"

echo ""
echo -n "Building ${APPNAME} ... "
pushd ${DIRNAME} > /dev/null 2>&1 || exit 1

./Configure -des
make minitest

rm generate_uudmap.o
gcc $(ls | grep "\.o$") -lm -lcrypt -static-pie -o miniperl
mv miniperl ..

popd > /dev/null 2>&1 || exit 1

rm -rf ${DIRNAME}

echo "Build complete!"