diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index a7f6dc3897ec..82a3478a1ac4 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -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), \ diff --git a/configure.ac b/configure.ac index f04904541cdc..32c2eecfbc7a 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/external/bzip2/ExternalProject_bzip2.mk b/external/bzip2/ExternalProject_bzip2.mk index 8b37bcd27151..b4c93a356ccc 100644 --- a/external/bzip2/ExternalProject_bzip2.mk +++ b/external/bzip2/ExternalProject_bzip2.mk @@ -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 diff --git a/external/bzip2/UnpackedTarball_bzip2.mk b/external/bzip2/UnpackedTarball_bzip2.mk index f22ca2b5ca8f..350b45c76e0a 100644 --- a/external/bzip2/UnpackedTarball_bzip2.mk +++ b/external/bzip2/UnpackedTarball_bzip2.mk @@ -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: diff --git a/external/bzip2/disable-test.patch.0 b/external/bzip2/disable-test.patch.0 new file mode 100644 index 000000000000..10d95ed25a7a --- /dev/null +++ b/external/bzip2/disable-test.patch.0 @@ -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 + + + diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk index 143e64700dc1..0a6d2f8bff8a 100644 --- a/external/python3/ExternalPackage_python3.mk +++ b/external/python3/ExternalPackage_python3.mk @@ -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 \ diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk index 76cfe6675586..a9e75bac4efc 100644 --- a/external/python3/ExternalProject_python3.mk +++ b/external/python3/ExternalProject_python3.mk @@ -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) \ diff --git a/external/python3/python-3.5.4-msvc-disable.patch.1 b/external/python3/python-3.5.4-msvc-disable.patch.1 index d5b4e3f6264b..880e4a9cfb5b 100644 --- a/external/python3/python-3.5.4-msvc-disable.patch.1 +++ b/external/python3/python-3.5.4-msvc-disable.patch.1 @@ -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