tdf#116412 include bz2 module in internal python

This commit includes the changes in 5e3510dbb6
and 219bef04b7, as well as the following changes:

* add bzip2 as permissable build target when cross compiling for Windows ARM64.
* add external/bzip2/disable-test.patch.0 for cross-compiling.
* revert the changes to configure.ac in 5e3510dbb6.
* change the argument of gb_UnpackedTarball_fix_end_of_line.

Change-Id: Iad8b1ed48d6c56e1302d9ac11620dc8084e79276
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157101
Tested-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
Reviewed-by: Taichi Haradaguchi <20001722@ymail.ne.jp>
This commit is contained in:
Taichi Haradaguchi 2023-09-20 20:12:54 +09:00
parent 3d0a8020f9
commit c72d5d787f
8 changed files with 75 additions and 20 deletions

View file

@ -4147,7 +4147,6 @@ endef
endif
ifneq ($(ENABLE_ONLINE_UPDATE_MAR),)
ifneq ($(SYSTEM_BZIP2),)
define gb_LinkTarget__use_bzip2
@ -4186,8 +4185,7 @@ define gb_ExternalProject__use_bzip2
$(call gb_ExternalProject_use_external_project,$(1),bzip2)
endef
endif
endif
endif # SYSTEM_BZIP2
define gb_LinkTarget__use_clew
$(call gb_LinkTarget_set_include,$(1), \

View file

@ -2199,7 +2199,8 @@ AC_ARG_WITH(system-libs,
AC_ARG_WITH(system-bzip2,
AS_HELP_STRING([--with-system-bzip2],
[Use bzip2 already on system. Used only when --enable-online-update=mar]),,
[Use bzip2 already on system. Used when --enable-online-update=mar
or --enable-python=internal]),,
[with_system_bzip2="$with_system_libs"])
AC_ARG_WITH(system-headers,
@ -5827,6 +5828,7 @@ if test "$cross_compiling" = "yes"; then
PERMITTED_BUILD_TARGETS="
AVMEDIA
BOOST
BZIP2
CAIRO
CLUCENE
CURL
@ -13593,7 +13595,7 @@ dnl ===================================================================
dnl Test whether we need bzip2
dnl ===================================================================
SYSTEM_BZIP2=
if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE" -o "$enable_python" = internal; then
AC_MSG_CHECKING([whether to use system bzip2])
if test "$with_system_bzip2" = yes; then
SYSTEM_BZIP2=TRUE

View file

@ -27,6 +27,7 @@ $(call gb_ExternalProject_get_state_target,bzip2,build):
$(call gb_Trace_StartRange,bzip2,EXTERNAL)
$(call gb_ExternalProject_run,build,\
$(MAKE) \
CC="$(CC) -fPIC" \
)
$(call gb_Trace_EndRange,bzip2,EXTERNAL)
endif

View file

@ -12,13 +12,13 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,bzip2))
$(eval $(call gb_UnpackedTarball_set_tarball,bzip2,$(BZIP2_TARBALL)))
$(eval $(call gb_UnpackedTarball_fix_end_of_line,bzip2,\
blocksort.c \
bzlib.c \
compress.c \
crctable.c \
decompress.c \
huffman.c \
randtable.c \
makefile.msc \
))
ifneq ($(CROSS_COMPILING),)
$(eval $(call gb_UnpackedTarball_add_patches,bzip2,\
external/bzip2/disable-test.patch.0 \
))
endif
# vim: set noet sw=4 ts=4:

49
external/bzip2/disable-test.patch.0 vendored Normal file
View file

@ -0,0 +1,49 @@
Disable bzip2 tests when cross compiling on Windows to avoid this error:
> Doing 6 tests (3 compress, 3 uncompress) ...
> If there's a problem, things might stop at this point.
>
> .\\bzip2 -1 < sample1.ref > sample1.rb2
> This version of C:\sources\libo-core\workdir\UnpackedTarball\bzip2\bzip2.exe is not compatible with the version of Windows you're running.
> Check your computer's system information and then contact the software publisher.
> NMAKE : fatal error U1077: '.\\bzip2' : return code '0x1'
> Stop.
--- makefile.msc.orig 2019-07-14 02:50:05.000000000 +0900
+++ makefile.msc 2023-09-20 20:00:14.124370100 +0900
@@ -14,7 +14,7 @@
decompress.obj \
bzlib.obj
-all: lib bzip2 test
+all: lib bzip2
bzip2: lib
$(CC) $(CFLAGS) -o bzip2 bzip2.c libbz2.lib setargv.obj
@@ -23,26 +23,6 @@
lib: $(OBJS)
lib /out:libbz2.lib $(OBJS)
-test: bzip2
- type words1
- .\\bzip2 -1 < sample1.ref > sample1.rb2
- .\\bzip2 -2 < sample2.ref > sample2.rb2
- .\\bzip2 -3 < sample3.ref > sample3.rb2
- .\\bzip2 -d < sample1.bz2 > sample1.tst
- .\\bzip2 -d < sample2.bz2 > sample2.tst
- .\\bzip2 -ds < sample3.bz2 > sample3.tst
- @echo All six of the fc's should find no differences.
- @echo If fc finds an error on sample3.bz2, this could be
- @echo because WinZip's 'TAR file smart CR/LF conversion'
- @echo is too clever for its own good. Disable this option.
- @echo The correct size for sample3.ref is 120,244. If it
- @echo is 150,251, WinZip has messed it up.
- fc sample1.bz2 sample1.rb2
- fc sample2.bz2 sample2.rb2
- fc sample3.bz2 sample3.rb2
- fc sample1.tst sample1.ref
- fc sample2.tst sample2.ref
- fc sample3.tst sample3.ref

View file

@ -27,6 +27,7 @@ $(eval $(call gb_ExternalPackage_add_file,python3,$(LIBO_BIN_FOLDER)/python$(PYT
endif
python3_EXTENSION_MODULES= \
PCbuild/$(python_arch_subdir)_asyncio$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)_bz2$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)_ctypes$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)_decimal$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
PCbuild/$(python_arch_subdir)_elementtree$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd \
@ -65,6 +66,7 @@ python3_EXTENSION_MODULES= \
LO_lib/binascii.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_bisect.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_blake2.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_bz2.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/cmath.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_codecs_cn.$(python3_EXTENSION_MODULE_SUFFIX).so \
LO_lib/_codecs_hk.$(python3_EXTENSION_MODULE_SUFFIX).so \

View file

@ -10,6 +10,7 @@
$(eval $(call gb_ExternalProject_ExternalProject,python3))
$(eval $(call gb_ExternalProject_use_externals,python3,\
bzip2 \
expat \
$(if $(filter WNT LINUX,$(OS)),libffi) \
openssl \
@ -36,6 +37,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(call gb_Trace_StartRange,python3,EXTERNAL)
$(call gb_ExternalProject_run,build,\
MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build $(gb_MSBUILD_CONFIG_AND_PLATFORM) \
/p:bz2Dir=$(call gb_UnpackedTarball_get_dir,bzip2) \
/p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl) \
/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
@ -107,6 +109,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
) \
CC="$(strip $(CC) \
$(if $(filter -fsanitize=undefined,$(CC)),-fno-sanitize=function) \
$(if $(SYSTEM_BZIP2),,-I$(call gb_UnpackedTarball_get_dir,bzip2)) \
$(if $(SYSTEM_EXPAT),,-I$(call gb_UnpackedTarball_get_dir,expat)/lib) \
$(if $(SYSBASE), -I$(SYSBASE)/usr/include) \
)" \
@ -114,6 +117,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
$(if $(filter -fsanitize=%,$(CC)),LINKCC="$(CXX) -pthread") \
LDFLAGS="$(strip $(LDFLAGS) \
$(if $(filter LINUX,$(OS)),-L$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs) \
$(if $(SYSTEM_BZIP2),,-L$(call gb_UnpackedTarball_get_dir,bzip2)) \
$(if $(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
$(if $(SYSTEM_ZLIB),,-L$(gb_StaticLibrary_WORKDIR)) \
$(if $(SYSBASE), -L$(SYSBASE)/usr/lib) \

View file

@ -1,8 +1,8 @@
Disable some stuff LO does not need, especially stuff with external dependencies
diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
--- python3.orig/PCbuild/pcbuild.sln 2017-08-10 00:04:44.359879894 +0200
+++ python3/PCbuild/pcbuild.sln 2017-08-10 00:13:51.179873748 +0200
--- python3.orig/PCbuild/pcbuild.sln 2023-08-25 04:36:32.000000000 +0900
+++ python3/PCbuild/pcbuild.sln 2023-09-20 17:43:05.442089400 +0900
@@ -15,8 +15,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
@ -12,7 +12,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_decimal", "_decimal.vcxproj", "{0E9791DB-593A-465F-98BC-681011311617}"
@@ -31,34 +29,20 @@
@@ -31,8 +29,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
EndProject
@ -21,15 +21,14 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcxproj", "{C6E20F84-3247-4AD6-B051-B073268F73BA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcxproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testinternalcapi", "_testinternalcapi.vcxproj", "{900342D7-516A-4469-B1AD-59A66E49A25F}"
@@ -41,24 +37,14 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testimportmultiple", "_testimportmultiple.vcxproj", "{36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcxproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcxproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bz2", "_bz2.vcxproj", "{73FCD2BD-F133-46B7-8EC1-144CD82A59D5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "select", "select.vcxproj", "{18CAE28C-B454-46C1-87A0-493D91D97F03}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_lzma", "_lzma.vcxproj", "{F9D71780-F393-11E0-BE50-0800200C9A66}"
@ -47,7 +46,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcxproj", "{9E48B300-37D1-11DD-8C41-005056C00008}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
@@ -93,8 +77,6 @@
@@ -93,8 +79,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_queue", "_queue.vcxproj", "{78D80A15-BD8C-44E2-B49E-1F05B0A0A687}"
EndProject