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

Commit

Permalink
Merge pull request #21 from open-tool-forge/bugfix/broken-python-linux
Browse files Browse the repository at this point in the history
Bugfix/broken python linux
  • Loading branch information
edbordin authored May 21, 2020
2 parents 9bb60af + fdfbbd4 commit c3dd227
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 86 deletions.
52 changes: 0 additions & 52 deletions build-data/linux/0001-cmake-fix-static-build.patch

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ COMPILE_NEXTPNR_ECP5=1
COMPILE_ECPPROG=1
COMPILE_IVERILOG=1
COMPILE_GHDL=1
BUNDLE_PYTHON=1
CREATE_PACKAGE=1

# -- Store current dir
Expand Down Expand Up @@ -109,6 +110,11 @@ fi
print ">> Set build flags"
. $WORK_DIR/scripts/build_setup.sh

if [ $BUNDLE_PYTHON == "1" ]; then
print ">> Bundle Python"
$WORK_DIR/scripts/bundle_python.sh
fi

if [ $COMPILE_NEXTPNR_ECP5 == "1" ]; then
print ">> Compile nextpnr-ecp5"
$WORK_DIR/scripts/compile-nextpnr-ecp5.sh
Expand Down
9 changes: 1 addition & 8 deletions scripts/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if [ $ARCH == "linux_x86_64" ]; then
export CC="gcc"
export CXX="g++"
export ABC_ARCHFLAGS="-DLIN64 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8 -DSIZEOF_INT=4"
export EMBEDDED_PY_VER=$(python3 -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
fi

if [ $ARCH == "linux_i686" ]; then
Expand Down Expand Up @@ -58,11 +59,6 @@ if [ $ARCH == "windows_amd64" ]; then
export MAKE="mingw32-make"

export EMBEDDED_PY_VER=$(python.exe -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')
mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cp -L -R /mingw64/lib/python$EMBEDDED_PY_VER $PACKAGE_DIR/$NAME/lib
# this isn't necessary and takes up ~half the size
rm -rf $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER/test
cp /mingw64/bin/{libgcc_s_seh-1.dll,libstdc++-6.dll,libwinpthread-1.dll,libpython$EMBEDDED_PY_VER.dll} $PACKAGE_DIR/$NAME/bin

export J=$(($J*4))
fi
Expand All @@ -80,9 +76,6 @@ if [ $ARCH == "darwin" ]; then
export CONDA_ROOT=/tmp/conda
export EMBEDDED_PY_VER=$($CONDA_ROOT/bin/python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')

mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cp -L -R $CONDA_ROOT/lib/python$EMBEDDED_PY_VER $PACKAGE_DIR/$NAME/lib

GNAT_VERSION=9.1.0
GNAT_ARCHIVE=gcc-$GNAT_VERSION-x86_64-apple-darwin15-bin
export GNAT_ROOT=/tmp/gnat/$GNAT_ARCHIVE
Expand Down
29 changes: 29 additions & 0 deletions scripts/bundle_python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -x

set -e

if [ $ARCH == "linux_x86_64" ]; then
# Install a copy of Python, since Python libraries are not compatible
# across minor versions.
mkdir libpython3
cd libpython3
for pkg in $(ls -1 ${WORK_DIR}/build-data/$ARCH/*.deb)
do
echo "Extracting $pkg..."
ar p $pkg data.tar.xz | tar xJ
done
mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
mv usr/lib/python$EMBEDDED_PY_VER/* $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cd ..

elif [ $ARCH == "windows_amd64" ]; then
mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cp -L -R /mingw64/lib/python$EMBEDDED_PY_VER $PACKAGE_DIR/$NAME/lib
# this isn't necessary and takes up ~half the size
rm -rf $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER/test
cp /mingw64/bin/{libgcc_s_seh-1.dll,libstdc++-6.dll,libwinpthread-1.dll,libpython$EMBEDDED_PY_VER.dll} $PACKAGE_DIR/$NAME/bin

elif [ $ARCH == "darwin" ]; then
mkdir -p $PACKAGE_DIR/$NAME/lib/python$EMBEDDED_PY_VER
cp -L -R $CONDA_ROOT/lib/python$EMBEDDED_PY_VER $PACKAGE_DIR/$NAME/lib
fi
13 changes: 0 additions & 13 deletions scripts/compile-nextpnr-ecp5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,6 @@ else
-DBoost_USE_STATIC_LIBS=ON \
.
make -j$J CXX="$CXX" LIBS="-static -lstdc++ -lm"

# Install a copy of Python, since Python libraries are not compatible
# across minor versions.
mkdir libpython3
cd libpython3
for pkg in $(ls -1 ${WORK_DIR}/build-data/linux/*.deb)
do
echo "Extracting $pkg..."
ar p $pkg data.tar.xz | tar xvJ
done
mkdir -p $PACKAGE_DIR/$NAME
mv usr/* $PACKAGE_DIR/$NAME
cd ..
fi || exit 1

# -- Copy the executables to the bin dir
Expand Down
13 changes: 0 additions & 13 deletions scripts/compile_nextpnr-ice40.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ else
-DBoost_USE_STATIC_LIBS=ON \
.
make -j$J CXX="$CXX"

# Install a copy of Python, since Python libraries are not compatible
# across minor versions.
mkdir libpython3
cd libpython3
for pkg in $(ls -1 ${WORK_DIR}/build-data/$ARCH/*.deb)
do
echo "Extracting $pkg..."
ar p $pkg data.tar.xz | tar xJ
done
mkdir -p $PACKAGE_DIR/$NAME
mv usr/* $PACKAGE_DIR/$NAME
cd ..
fi || exit 1

# -- Copy the executable to the bin dir
Expand Down

0 comments on commit c3dd227

Please sign in to comment.