Commit 7f2504ced6edf267ef80b3e5efc143e28f6fd726

Authored by Marcin Woliński
1 parent 87be0a84

Python wheels na Windows

buildDarwin.sh
... ... @@ -164,7 +164,7 @@ function buildegg {
164 164 pythonIncl=python36
165 165 if [ "$os-$arch" == "Windows-i386" ]
166 166 then
167   - pythonDir=$CROSSMORFEUSZ_ROOT/windows32/Python36-32
  167 + pythonDir=$CROSSMORFEUSZ_ROOT/windows32/Python36
168 168 elif [ "$os-$arch" == "Linux-i386" ]
169 169 then
170 170 pythonDir=$CROSSMORFEUSZ_ROOT/linux32/python3/include/python3.4m
... ...
buildWindows.sh
... ... @@ -6,7 +6,7 @@
6 6 # • kod źródłowy Morfeusza jest w MORFEUSZ_SRC
7 7 # • słowniki są już skompilowane w katalogu DICT_DIR
8 8 # • kompilacja odbędzie się w katalogu BUILD_DIR (który zostanie skasowany i utworzony)
9   -# • wyniki zostaną umieszczone w TARGET_DIR
  9 +# • wyniki zostaną umieszczone w podkatalogu TARGET_ROOT
10 10  
11 11 #set -ex -o pipefail
12 12 set -x
... ... @@ -157,7 +157,7 @@ function buildegg {
157 157 pythonIncl=python36
158 158 if [ "$os-$arch" == "Windows-i386" ]
159 159 then
160   - pythonDir=$CROSSMORFEUSZ_ROOT/windows32/Python36-32
  160 + pythonDir=$CROSSMORFEUSZ_ROOT/windows32/Python36
161 161 elif [ "$os-$arch" == "Linux-i386" ]
162 162 then
163 163 pythonDir=$CROSSMORFEUSZ_ROOT/linux32/python3/include/python3.4m
... ... @@ -269,14 +269,14 @@ export -f log
269 269 mkdir -p log
270 270  
271 271 build Windows $BITS true 2.7 package package-java gui-installer 2>&1 | log Windows $BITS
272   -build Windows $BITS true 2.7 package-python2-egg-info 2>&1 | log Windows $BITS
  272 +build Windows $BITS true 2.7 package-python2-fatwhl package-python2-egg-info 2>&1 | log Windows $BITS
273 273 buildegg Windows $BITS true 2.7 2>&1 | log Windows $BITS
274   -build Windows $BITS true 3.6 package-python3-egg-info 2>&1 | log Windows $BITS
275   -buildegg Windows $BITS true 3.6 2>&1 | log Windows $BITS
276   -build Windows $BITS true 3.7 package-python3-egg-info 2>&1 | log Windows $BITS
277   -buildegg Windows $BITS true 3.7 2>&1 | log Windows $BITS
278   -build Windows $BITS true 3.8 package-python3-egg-info 2>&1 | log Windows $BITS
279   -buildegg Windows $BITS true 3.8 2>&1 | log Windows $BITS
280   -build Windows $BITS true 3.9 package-python3-egg-info 2>&1 | log Windows $BITS
281   -buildegg Windows $BITS true 3.9 2>&1 | log Windows $BITS
282 274  
  275 +for py in 3.6 3.7 3.8 3.9 3.10
  276 +do
  277 + if [ -d ${CROSSMORFEUSZ_ROOT}/windows${BITS}/Python${py//\./}/ ]; then
  278 + echo Building package for Python ${py}
  279 + build Windows $BITS true $py package-python3-fatwhl package-python3-egg-info 2>&1 | log Windows $BITS
  280 + buildegg Windows $BITS true $py 2>&1 | log Windows $BITS
  281 + fi
  282 +done
... ...
morfeusz/wrappers/python2/CMakeLists.txt
... ... @@ -93,6 +93,26 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND CMAKE_CROSSCOMPILING)
93 93 COMMAND python ${SETUP_PY} egg_info
94 94 DEPENDS generate_python2_wrapper generate_python2_setup_file libmorfeusz
95 95 )
  96 + add_custom_target (package-python2-dist-info
  97 + COMMAND python2 ${SETUP_PY} dist_info
  98 + DEPENDS generate_python2_setup_file generate_python2_wrapper
  99 + )
  100 + add_custom_target (build_pyd2
  101 + COMMAND echo Building pyd2 using ${CMAKE_CXX_COMPILER}
  102 + COMMAND ${CMAKE_CXX_COMPILER} -pthread -static-libgcc -static-libstdc++ -std=c++98 -DNDEBUG -DMS_WIN64 -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fno-stack-protector -Wformat -Werror=format-security -fPIC -I${PROJECT_SOURCE_DIR}/morfeusz -I${PYTHON_INCLUDE_DIRS} -c ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.o
  103 + COMMAND ${CMAKE_CXX_COMPILER} -pthread -static-libgcc -static-libstdc++ -DMS_WIN64 -shared -Wl,-O1 -Wl,-Bsymbolic-functions -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wdate-time -D_FORTIFY_SOURCE=2 -g -fno-stack-protector -Wformat -Werror=format-security ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.o -L${CMAKE_CURRENT_BINARY_DIR}/../.. -L${PYTHON_LIBRARIES} -lmorfeusz2 -lpython27 -o ${CMAKE_CURRENT_BINARY_DIR}/_morfeusz2.pyd
  104 + DEPENDS generate_python2_setup_file generate_python2_wrapper libmorfeusz
  105 + )
  106 + configure_file (WHEEL.win.in WHEEL)
  107 + add_custom_target (package-python2-fatwhl
  108 + COMMAND mkdir win-wheel
  109 + COMMAND mv morfeusz2.dist-info win-wheel/morfeusz2-${PY2MORFEUSZ_VERSION}.dist-info
  110 + COMMAND cp morfeusz2.py _morfeusz2.pyd ../../morfeusz2.dll win-wheel
  111 + COMMAND cp WHEEL win-wheel/morfeusz2-${PY2MORFEUSZ_VERSION}.dist-info/
  112 + COMMAND python2 -m wheel pack --build-number ${DICT_VERSION} --dest-dir ${TARGET_DIR} win-wheel/
  113 + COMMAND rm -r win-wheel
  114 + DEPENDS package-python2-dist-info build_pyd2
  115 + )
96 116 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND CMAKE_CROSSCOMPILING)
97 117 add_custom_target (package-python2-egg-info
98 118 COMMAND python ${SETUP_PY} egg_info
... ...
morfeusz/wrappers/python2/WHEEL.win.in 0 → 100644
  1 +Wheel-Version: 1.0
  2 +Root-Is-Purelib: false
  3 +Tag: cp27-cp27-win_${ARCHITECTURE}
... ...
morfeusz/wrappers/python2/setup.py.in
1 1 # -*- coding: utf-8 -*-
2 2 from setuptools import setup, Extension
3 3  
4   -
5   -
6 4 morfeusz2 = Extension('_morfeusz2',
7 5 libraries=['morfeusz2'],
8 6 library_dirs=['${CMAKE_CURRENT_BINARY_DIR}/../..'],
... ... @@ -13,8 +11,15 @@ if __name__ == '__main__':
13 11 setup(name='morfeusz2',
14 12 author='${CPACK_PACKAGE_VENDOR}',
15 13 author_email='${CPACK_PACKAGE_CONTACT}',
16   - description='Python bindings for Morfeusz',
  14 + description='Python 2 bindings for Morfeusz 2',
  15 + long_description="""
  16 +${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
  17 +
  18 +${CPACK_PACKAGE_DESCRIPTION}
  19 +""",
  20 + url='http://morfeusz.sgjp.pl',
  21 + license='http://morfeusz.sgjp.pl/doc/license/',
17 22 version='${PY2MORFEUSZ_VERSION}',
18   - package_dir={ '': '${CMAKE_CURRENT_BINARY_DIR}'},
19   - py_modules = ['morfeusz2'],
20   - ext_modules = [morfeusz2])
  23 + package_dir={'': '${CMAKE_CURRENT_BINARY_DIR}'},
  24 + py_modules=['morfeusz2'],
  25 + ext_modules=[morfeusz2])
... ...
morfeusz/wrappers/python3/CMakeLists.txt
... ... @@ -96,6 +96,26 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND CMAKE_CROSSCOMPILING)
96 96 COMMAND python3 ${SETUP_PY} egg_info
97 97 DEPENDS generate_python3_wrapper generate_python3_setup_file libmorfeusz
98 98 )
  99 + add_custom_target (package-python3-dist-info
  100 + COMMAND python3 ${SETUP_PY} dist_info
  101 + DEPENDS generate_python3_setup_file generate_python3_wrapper
  102 + )
  103 + add_custom_target (build_pyd
  104 + COMMAND echo Building pyd using ${CMAKE_CXX_COMPILER}
  105 + COMMAND ${CMAKE_CXX_COMPILER} -pthread -static-libgcc -static-libstdc++ -std=c++98 -DNDEBUG -DMS_WIN64 -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fno-stack-protector -Wformat -Werror=format-security -fPIC -I${PROJECT_SOURCE_DIR}/morfeusz -I${PYTHON_INCLUDE_DIRS} -c ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.o
  106 + COMMAND ${CMAKE_CXX_COMPILER} -pthread -static-libgcc -static-libstdc++ -DMS_WIN64 -shared -Wl,-O1 -Wl,-Bsymbolic-functions -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wdate-time -D_FORTIFY_SOURCE=2 -g -fno-stack-protector -Wformat -Werror=format-security ${CMAKE_CURRENT_BINARY_DIR}/swigPYTHON.o -L${CMAKE_CURRENT_BINARY_DIR}/../.. -L${PYTHON_LIBRARIES} -lmorfeusz2 -lpython${PY_SHORT} -o ${CMAKE_CURRENT_BINARY_DIR}/_morfeusz2.pyd
  107 + DEPENDS generate_python3_setup_file generate_python3_wrapper libmorfeusz
  108 + )
  109 + configure_file (WHEEL.win.in WHEEL)
  110 + add_custom_target (package-python3-fatwhl
  111 + COMMAND mkdir win-wheel
  112 + COMMAND mv morfeusz2.dist-info win-wheel/morfeusz2-${PY3MORFEUSZ_VERSION}.dist-info
  113 + COMMAND cp morfeusz2.py _morfeusz2.pyd ../../morfeusz2.dll win-wheel
  114 + COMMAND cp WHEEL win-wheel/morfeusz2-${PY3MORFEUSZ_VERSION}.dist-info/
  115 + COMMAND python3 -m wheel pack --build-number ${DICT_VERSION} --dest-dir ${TARGET_DIR} win-wheel/
  116 + COMMAND rm -r win-wheel
  117 + DEPENDS package-python3-dist-info build_pyd
  118 + )
99 119 elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND CMAKE_CROSSCOMPILING)
100 120 add_custom_target (package-python3-egg-info
101 121 COMMAND python3 ${SETUP_PY} egg_info
... ...
morfeusz/wrappers/python3/WHEEL.win.in 0 → 100644
  1 +Wheel-Version: 1.0
  2 +Root-Is-Purelib: false
  3 +Tag: cp${PY_SHORT}-cp${PY_SHORT}-win_${ARCHITECTURE}
... ...
morfeusz/wrappers/python3/setup.py.in
... ... @@ -17,7 +17,14 @@ if __name__ == '__main__':
17 17 setup(name='morfeusz2',
18 18 author='${CPACK_PACKAGE_VENDOR}',
19 19 author_email='${CPACK_PACKAGE_CONTACT}',
20   - description='Python3 bindings for Morfeusz',
  20 + description='Python 3 bindings for Morfeusz 2',
  21 + long_description="""
  22 +${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
  23 +
  24 +${CPACK_PACKAGE_DESCRIPTION}
  25 +""",
  26 + url='http://morfeusz.sgjp.pl',
  27 + license='http://morfeusz.sgjp.pl/doc/license/',
21 28 version='${PY3MORFEUSZ_VERSION}',
22 29 package_dir={'': '${CMAKE_CURRENT_BINARY_DIR}'},
23 30 py_modules=['morfeusz2'],
... ...
toolchains/Toolchain-Windows-i386.cmake
... ... @@ -11,9 +11,13 @@ set (CMAKE_SYSTEM_PROCESSOR "x86")
11 11 set (WIN32_ROOT ${CROSSMORFEUSZ_ROOT}/windows32)
12 12 set (PYTHON_ROOT ${WIN32_ROOT}/Python27)
13 13 if(${PY})
14   - if("${PY}" MATCHES "3.*")
15   - set (PYTHON_ROOT ${WIN32_ROOT}/Python36-32)
16   - endif()
  14 + if("${PY}" MATCHES "3.*")
  15 + string(REPLACE "." "" PY_SHORT "${PY}")
  16 +
  17 + set (PYTHON_ROOT ${WIN32_ROOT}/Python36)
  18 + set (PYTHON_LIBRARIES ${PYTHON_ROOT}/libs)
  19 + set (PYTHON_INCLUDE_DIRS ${PYTHON_ROOT}/include)
  20 + endif()
17 21 endif()
18 22 set (JAVA_ROOT ${WIN32_ROOT}/Java/jdk1.7.0_45)
19 23 set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${JAVA_ROOT} ${PYTHON_ROOT})
... ...