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

Add OpenJDK static PIE ELF #73

Open
wants to merge 2 commits 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
2 changes: 2 additions & 0 deletions openjdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/jdk/
/out/
31 changes: 31 additions & 0 deletions openjdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Building OpenJDK as static PIE

Build the [OpenJDK](https://openjdk.org/)(v20) as a static PIE ELF.

## Requirements:

Make sure the following packages are installed:
* gcc >= 8
* autoconf
* zip
* alsa
* cups
* fontconfig
* X11
* JDK v19

## Build

If you want to build `OpenJDK`, run:

```
$ bash build.sh
```

This will create a directory named 'out' where the `OpenJDK` will be located.

If you want to clean everything and rebuild it, run:

```
$ bash build.sh clean
```
31 changes: 31 additions & 0 deletions openjdk/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Clean.
if [[ $@ == "clean" ]]; then \
echo "Cleaning up ..."
rm -rf jdk out 2> /dev/null
echo ""
fi

# Clone OpenJDK.
if [ ! -d jdk ]; then \
echo "Cloning OpenJDK ..."
git clone https://github.com/openjdk/jdk.git
echo ""
fi

# Create out dir.
if [ ! -d out ]; then \
mkdir out
fi

# Configure
echo "Configuring OpenJDK ... "
C_DIR=$PWD

pushd jdk > /dev/null 2>&1 || exit 1

bash configure --prefix="$C_DIR/out" --with-extra-ldflags="-static-pie"
echo ""

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