diff --git a/build-data/linux/0001-cmake-fix-static-build.patch b/build-data/linux/0001-cmake-fix-static-build.patch deleted file mode 100644 index 8eed9a6..0000000 --- a/build-data/linux/0001-cmake-fix-static-build.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 01a808f88c916b8804a31dbb9f351a1eef08e6de Mon Sep 17 00:00:00 2001 -From: Sean Cross -Date: Sun, 18 Aug 2019 16:16:43 +0800 -Subject: [PATCH] cmake: fix static build - -Hack to do a static build on Linux, with staticly-linked python. - -Signed-off-by: Sean Cross ---- - CMakeLists.txt | 18 +++++++++++++++--- - 1 file changed, 15 insertions(+), 3 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9ec078e..d889287 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -15,9 +15,12 @@ option(SERIALIZE_CHIPDB "Never build chipdb in parallel to reduce peak memory us - set(link_param "") - if (STATIC_BUILD) - set(Boost_USE_STATIC_LIBS ON) -- if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -- set(link_param "-static") -- endif() -+ set(Python_USE_STATIC_LIBS ON) -+ add_definitions(-DBOOST_PYTHON_STATIC_LIB) -+# set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) -+# if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -+# set(link_param "-static") -+# endif() - endif() - - if (EXTERNAL_CHIPDB) -@@ -270,7 +273,16 @@ foreach (family ${ARCH}) - target_link_libraries(${target} LINK_PUBLIC gui_${family} ${GUI_LIBRARY_FILES_${ufamily}}) - endif() - if (BUILD_PYTHON) -+ if(STATIC_BUILD) -+ string(REGEX REPLACE ".so$" ".a" PYTHON_LIBRARIES ${PYTHON_LIBRARIES}) -+ endif() -+ MESSAGE(Python Libraries: ${PYTHON_LIBRARIES}) - target_link_libraries(${target} LINK_PUBLIC ${PYTHON_LIBRARIES}) -+ if(STATIC_BUILD) -+ target_link_libraries(${target} LINK_PUBLIC "/usr/lib/x86_64-linux-gnu/libexpat.a") -+ target_link_libraries(${target} LINK_PUBLIC "/usr/lib/x86_64-linux-gnu/libz.a") -+ target_link_libraries(${target} LINK_PUBLIC "-lpthread -lc -lutil -lpthread -ldl") -+ endif() - endif() - endforeach (target) - endforeach (family) --- -2.7.4 - diff --git a/build-data/linux/libpython3.6-minimal_3.6.8-1~18.04.3_amd64.deb b/build-data/linux/libpython3.6-minimal_3.6.8-1~18.04.3_amd64.deb deleted file mode 100644 index 1ddc324..0000000 Binary files a/build-data/linux/libpython3.6-minimal_3.6.8-1~18.04.3_amd64.deb and /dev/null differ diff --git a/build-data/linux/libpython3.6-stdlib_3.6.8-1~18.04.3_amd64.deb b/build-data/linux/libpython3.6-stdlib_3.6.8-1~18.04.3_amd64.deb deleted file mode 100644 index c2533f7..0000000 Binary files a/build-data/linux/libpython3.6-stdlib_3.6.8-1~18.04.3_amd64.deb and /dev/null differ diff --git a/build-data/linux/python3-minimal_3.6.7-1~18.04_amd64.deb b/build-data/linux/python3-minimal_3.6.7-1~18.04_amd64.deb deleted file mode 100644 index 560dabf..0000000 Binary files a/build-data/linux/python3-minimal_3.6.7-1~18.04_amd64.deb and /dev/null differ diff --git a/build-data/linux/python3.6-minimal_3.6.8-1~18.04.3_amd64.deb b/build-data/linux/python3.6-minimal_3.6.8-1~18.04.3_amd64.deb deleted file mode 100644 index 39a5bfa..0000000 Binary files a/build-data/linux/python3.6-minimal_3.6.8-1~18.04.3_amd64.deb and /dev/null differ diff --git a/build-data/linux_x86_64/libpython3.6-minimal_3.6.8-1~18.04.2_amd64.deb b/build-data/linux_x86_64/libpython3.6-minimal_3.6.8-1~18.04.2_amd64.deb deleted file mode 100644 index 0a79b70..0000000 Binary files a/build-data/linux_x86_64/libpython3.6-minimal_3.6.8-1~18.04.2_amd64.deb and /dev/null differ diff --git a/build-data/linux_x86_64/libpython3.6-stdlib_3.6.8-1~18.04.2_amd64.deb b/build-data/linux_x86_64/libpython3.6-stdlib_3.6.8-1~18.04.2_amd64.deb deleted file mode 100644 index e4c568d..0000000 Binary files a/build-data/linux_x86_64/libpython3.6-stdlib_3.6.8-1~18.04.2_amd64.deb and /dev/null differ diff --git a/build-data/linux_x86_64/libpython3.8-minimal_3.8.2-1ubuntu1.1_amd64.deb b/build-data/linux_x86_64/libpython3.8-minimal_3.8.2-1ubuntu1.1_amd64.deb new file mode 100644 index 0000000..5a04ca9 Binary files /dev/null and b/build-data/linux_x86_64/libpython3.8-minimal_3.8.2-1ubuntu1.1_amd64.deb differ diff --git a/build-data/linux_x86_64/libpython3.8-stdlib_3.8.2-1ubuntu1.1_amd64.deb b/build-data/linux_x86_64/libpython3.8-stdlib_3.8.2-1ubuntu1.1_amd64.deb new file mode 100644 index 0000000..a3ed196 Binary files /dev/null and b/build-data/linux_x86_64/libpython3.8-stdlib_3.8.2-1ubuntu1.1_amd64.deb differ diff --git a/build-data/linux_x86_64/python3-minimal_3.6.7-1~18.04_amd64.deb b/build-data/linux_x86_64/python3-minimal_3.6.7-1~18.04_amd64.deb deleted file mode 100644 index 560dabf..0000000 Binary files a/build-data/linux_x86_64/python3-minimal_3.6.7-1~18.04_amd64.deb and /dev/null differ diff --git a/build-data/linux_x86_64/python3.6-minimal_3.6.8-1~18.04.2_amd64.deb b/build-data/linux_x86_64/python3.6-minimal_3.6.8-1~18.04.2_amd64.deb deleted file mode 100644 index f9032dd..0000000 Binary files a/build-data/linux_x86_64/python3.6-minimal_3.6.8-1~18.04.2_amd64.deb and /dev/null differ diff --git a/build.sh b/build.sh index bbbe25c..f94285a 100755 --- a/build.sh +++ b/build.sh @@ -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 @@ -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 diff --git a/scripts/build_setup.sh b/scripts/build_setup.sh index b51143b..5604b65 100755 --- a/scripts/build_setup.sh +++ b/scripts/build_setup.sh @@ -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 @@ -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 @@ -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 diff --git a/scripts/bundle_python.sh b/scripts/bundle_python.sh new file mode 100755 index 0000000..a47a2fd --- /dev/null +++ b/scripts/bundle_python.sh @@ -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 \ No newline at end of file diff --git a/scripts/compile-nextpnr-ecp5.sh b/scripts/compile-nextpnr-ecp5.sh index 251a7c2..bbbac54 100755 --- a/scripts/compile-nextpnr-ecp5.sh +++ b/scripts/compile-nextpnr-ecp5.sh @@ -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 diff --git a/scripts/compile_nextpnr-ice40.sh b/scripts/compile_nextpnr-ice40.sh index b7724d0..3e23b87 100755 --- a/scripts/compile_nextpnr-ice40.sh +++ b/scripts/compile_nextpnr-ice40.sh @@ -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