Browse Source

build sip on windows

tags/v1.1
falkTX 1 year ago
parent
commit
f69bf2e000
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 210 additions and 7 deletions
  1. +27
    -7
      bootstrap-carla.sh
  2. +161
    -0
      patches/sip/win32/0001-mingw-python.patch
  3. +20
    -0
      patches/sip/win32/0002-add-exe-in-sipconfig.patch
  4. +1
    -0
      patches/sip/win64
  5. +1
    -0
      setup/versions.sh

+ 27
- 7
bootstrap-carla.sh View File

@@ -121,12 +121,28 @@ function build_pyqt() {

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
python3 configure.py ${extraconfrules}
# used in sip
${EXE_WRAPPER} "${PAWPAW_PREFIX}/bin/python3${APP_EXT}" configure.py ${extraconfrules}
# use env vars
sed -i -e 's/CC = gcc/CC ?= gcc/' */Makefile
sed -i -e 's/CXX = g++/CXX ?= g++/' */Makefile
sed -i -e 's/LINK = g++/LINK = $(CXX)/' */Makefile
sed -i -e 's/CFLAGS *=/CFLAGS +=/' */Makefile
sed -i -e 's/CXXFLAGS *=/CXXFLAGS +=/' */Makefile
sed -i -e 's/LIBS *=/LIBS += $(LDFLAGS)/' */Makefile
# use PREFIX var
sed -i -e 's|$(DESTDIR)/usr|$(DESTDIR)$(PREFIX)|g' */Makefile
# fix win32 linkage
if [ "${WIN32}" -eq 1 ]; then
sed -i -e 's|config -lpython|config-3.8 -Wl,-Bdynamic -lpython|' */Makefile
fi
# fix cross-compiling (wine)
if [ "${CROSS_COMPILING}" -eq 1 ]; then
sed -i -e 's|\\|/|g' Makefile */Makefile installed.txt
sed -i -e "s|H:|${HOME}|g" Makefile */Makefile installed.txt
sed -i -e "s|Z:||g" Makefile */Makefile installed.txt
sed -i -e "s|.exe.exe|.exe|g" installed.txt
sed -i -e "s|${PAWPAW_PREFIX}/bin/python3${APP_EXT}|python3|" Makefile */Makefile
fi
touch .stamp_configured
popd
fi
@@ -197,11 +213,6 @@ if [ "${PYTHON_VERSION}" = "3.7.4" ]; then
fi
build_conf_python Python "${PYTHON_VERSION}" "--prefix=${PAWPAW_PREFIX} --enable-shared ${PYTHON_EXTRAFLAGS}"

# TODO: finish this
if [ "${WIN32}" -eq 1 ]; then
exit 0
fi

# ---------------------------------------------------------------------------------------------------------------------
# sip

@@ -212,9 +223,18 @@ else
SIP_DOWNLOAD_URL="http://sourceforge.net/projects/pyqt/files/sip/sip-${SIP_VERSION}"
fi

if [ "${WIN32}" -eq 1 ]; then
SIP_EXTRAFLAGS+=" --platform win32-g++"
fi

download sip "${SIP_VERSION}" "${SIP_DOWNLOAD_URL}"
build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}"

# TODO: finish this
if [ "${WIN32}" -eq 1 ]; then
exit 0
fi

# ---------------------------------------------------------------------------------------------------------------------
# pyqt5



+ 161
- 0
patches/sip/win32/0001-mingw-python.patch View File

@@ -0,0 +1,161 @@
diff -uNr sip-4.16.2/configure.py sip-4.16.2-mingw/configure.py
--- sip-4.16.2/configure.py 2014-07-03 12:08:46.000000000 +0200
+++ sip-4.16.2-mingw/configure.py 2014-07-30 10:41:38.510622892 +0200
@@ -20,6 +20,7 @@
import glob
import optparse
from distutils import sysconfig
+_POSIX_BUILD = True
try:
from importlib import invalidate_caches
@@ -157,7 +158,9 @@
build_platform = "none"
if py_platform == "win32":
- if py_version >= 0x030500:
+ if _POSIX_BUILD:
+ build_platform = "win32-g++"
+ elif py_version >= 0x030500:
build_platform = "win32-msvc2015"
elif py_version >= 0x030300:
build_platform = "win32-msvc2010"
@@ -219,7 +219,7 @@
plat_py_venv_inc_dir = sysconfig.get_python_inc(prefix=sys.prefix)
plat_py_conf_inc_dir = os.path.dirname(sysconfig.get_config_h_filename())
- if sys.platform == "win32":
+ if sys.platform == "win32" and not _POSIX_BUILD:
bin_dir = sys.exec_prefix
try:
@@ -245,9 +245,22 @@
else:
lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1)
- plat_py_lib_dir = lib_dir + "/config"
- plat_bin_dir = sys.exec_prefix + "/bin"
- plat_sip_dir = sys.prefix + "/share/sip"
+ if "MSYSTEM" in os.environ:
+ plat_py_site_dir = os.popen(' '.join(['cygpath', '--unix', plat_py_site_dir])).readline().strip()
+ plat_py_inc_dir = os.popen(' '.join(['cygpath', '--unix', plat_py_inc_dir])).readline().strip()
+ plat_py_conf_inc_dir = os.popen(' '.join(['cygpath', '--unix', plat_py_conf_inc_dir])).readline().strip()
+ lib_dir = os.popen(' '.join(['cygpath', '--unix', lib_dir])).readline().strip()
+
+ plat_py_lib_dir = lib_dir + "/config"
+ temp_sys_exec_prefix = os.popen(' '.join(['cygpath', '--unix', sys.exec_prefix])).readline().strip()
+ plat_bin_dir = temp_sys_exec_prefix + "/bin"
+ temp_sys_prefix = os.popen(' '.join(['cygpath', '--unix', sys.prefix])).readline().strip()
+ plat_sip_dir = temp_sys_prefix + "/share/sip"
+ plat_py_venv_inc_dir = os.popen(' '.join(['cygpath', '--unix', plat_py_venv_inc_dir])).readline().strip()
+ else:
+ plat_py_lib_dir = lib_dir + "/config"
+ plat_bin_dir = sys.exec_prefix + "/bin"
+ plat_sip_dir = sys.prefix + "/share/sip"
def patch_files():
@@ -398,7 +413,10 @@
if not opts.static:
# These only need to be correct for Windows.
debug_suffix = "_d" if opts.debug else ""
- link_lib_dir = quote("-L" + cfg.py_lib_dir)
+ if "MSYSTEM" in os.environ:
+ link_lib_dir = quote("-L" + sys.prefix + "/" + cfg.py_lib_dir)
+ else:
+ link_lib_dir = quote("-L" + cfg.py_lib_dir)
pro.write("""
win32 {
diff -uNr sip-4.16.2/siputils.py sip-4.16.2-mingw/siputils.py
--- sip-4.16.2/siputils.py 2014-05-10 17:00:48.000000000 +0200
+++ sip-4.16.2-mingw/siputils.py 2014-07-30 10:41:24.250623520 +0200
@@ -22,7 +22,8 @@
import stat
import string
import re
-
+from distutils import sysconfig
+_POSIX_BUILD = True
# These are installation specific values created when SIP was configured.
# @SIP_CONFIGURATION@
@@ -321,7 +322,7 @@
self.extra_libs = []
# Get these once and make them available to sub-classes.
- if sys.platform == "win32":
+ if False:
def_copy = "copy"
def_rm = "del"
def_mkdir = "mkdir"
@@ -440,7 +441,7 @@
incdir.append(self.config.py_inc_dir)
incdir.append(self.config.py_conf_inc_dir)
- if sys.platform == "cygwin":
+ if sys.platform == "cygwin" or _POSIX_BUILD:
libdir.append(self.config.py_lib_dir)
py_lib = "python%u.%u" % ((self.config.py_version >> 16), ((self.config.py_version >> 8) & 0xff))
@@ -1625,7 +1626,7 @@
mfile is the file object.
"""
if self.static:
- if sys.platform == "win32":
+ if sys.platform == "win32" and not _POSIX_BUILD:
ext = "lib"
else:
ext = "a"
@@ -2021,7 +2026,7 @@
s is the string.
"""
# On Qt5 paths often includes forward slashes so convert them.
- if sys.platform == "win32":
+ if sys.platform == "win32" and not _POSIX_BUILD:
s = s.replace("/", "\\")
if s.find(" ") >= 0:
diff -uNr sip-4.16.2/specs/win32-g++ sip-4.16.2-mingw/specs/win32-g++
--- sip-4.16.2/specs/win32-g++ 2011-05-11 20:39:21.000000000 +0200
+++ sip-4.16.2-mingw/specs/win32-g++ 2014-07-30 10:41:24.250623520 +0200
@@ -69,23 +69,16 @@
QMAKE_LIBS_COMPAT = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
QMAKE_LIBS_QT_ENTRY = -lmingw32 -lqtmain
-MINGW_IN_SHELL = $$(MINGW_IN_SHELL)
-isEqual(MINGW_IN_SHELL, 1) {
- QMAKE_DIR_SEP = /
- QMAKE_COPY = cp
- QMAKE_COPY_DIR = xcopy /s /q /y /i
- QMAKE_MOVE = mv
- QMAKE_DEL_FILE = rm
- QMAKE_MKDIR = mkdir
- QMAKE_DEL_DIR = rmdir
-} else {
- QMAKE_COPY = copy /y
- QMAKE_COPY_DIR = xcopy /s /q /y /i
- QMAKE_MOVE = move
- QMAKE_DEL_FILE = del
- QMAKE_MKDIR = mkdir
- QMAKE_DEL_DIR = rmdir
-}
+MAKEFILE_GENERATOR = UNIX
+QMAKE_DIR_SEP = /
+QMAKE_COPY = cp
+QMAKE_COPY_DIR = cp -r
+QMAKE_MOVE = mv
+QMAKE_DEL_FILE = rm
+QMAKE_MKDIR = mkdir -p
+QMAKE_DEL_DIR = rmdir
+QMAKE_CHK_DIR_EXISTS = test -d
+
QMAKE_MOC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
QMAKE_IDC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
@@ -98,5 +91,4 @@
QMAKE_STRIP = strip
QMAKE_STRIPFLAGS_LIB += --strip-unneeded
-QMAKE_CHK_DIR_EXISTS = if not exist
load(qt_config)

+ 20
- 0
patches/sip/win32/0002-add-exe-in-sipconfig.patch View File

@@ -0,0 +1,20 @@
--- sip-4.19.12/configure.py.orig 2018-07-11 08:04:25.493353200 +0300
+++ sip-4.19.12/configure.py 2018-07-11 08:05:49.180700000 +0300
@@ -278,12 +278,16 @@
"""
siputils.inform("Creating %s..." % module)
+ sip_inst_exe = os.path.join(sip_bin_dir, "sip")
+ if sys.platform == 'win32':
+ sip_inst_exe += '.exe'
+
content = {
"sip_config_args": sys.argv[1:],
"sip_version": sip_version,
"sip_version_str": sip_version_str,
"platform": build_platform,
- "sip_bin": os.path.join(sip_bin_dir, "sip"),
+ "sip_bin": sip_inst_exe,
"sip_inc_dir": sip_inc_dir,
"sip_root_dir": sip_root_dir,
"sip_module_dir": sip_module_dir,

+ 1
- 0
patches/sip/win64 View File

@@ -0,0 +1 @@
win32

+ 1
- 0
setup/versions.sh View File

@@ -76,6 +76,7 @@ if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
ZIPP_VERSION=3.4.0
elif [ "${WIN32}" -eq 1 ]; then
PYTHON_VERSION=3.8.7
SIP_VERSION=4.19.19
else
CXFREEZE_VERSION=6.1
PYTHON_VERSION=3.7.4


Loading…
Cancel
Save