Browse Source

SQLite 3P Conversion (#77)

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 3 years ago
parent
commit
4461a44131

+ 1 - 1
Scripts/extras/pull_and_build_from_git.py

@@ -498,7 +498,7 @@ class BuildInfo(object):
                     raise BuildError(f"Invalid/missing license file '{self.package_info.package_license_file}' specified in the build config.")
 
             license_file_content = package_license_src.read_text("UTF-8", "ignore")
-            if "Copyright" not in license_file_content and "OPEN 3D ENGINE LICENSING" not in license_file_content:
+            if "Copyright" not in license_file_content and "OPEN 3D ENGINE LICENSING" not in license_file_content and "copyright" not in license_file_content:
                 raise BuildError(f"Unable to find 'Copyright' or the O3DE licensing text in the license file {str(self.package_info.package_license_file)}. Is this a valid license file?")
             target_license_copy = self.build_install_folder / os.path.basename(package_license_src)
             if target_license_copy.is_file():

+ 31 - 0
package-system/sqlite/FindSQLite.cmake

@@ -0,0 +1,31 @@
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+# this file actually ingests the library and defines targets.
+set(TARGET_WITH_NAMESPACE "3rdParty::SQLite")
+if (TARGET ${TARGET_WITH_NAMESPACE})
+    return()
+endif()
+
+set(MY_NAME "SQLite")
+
+
+set(${MY_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/SQLite)
+set(${MY_NAME}_LIBS_DIR ${CMAKE_CURRENT_LIST_DIR}/SQLite/lib)
+set(${MY_NAME}_LIBRARY ${${MY_NAME}_LIBS_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}sqlite3${CMAKE_STATIC_LIBRARY_SUFFIX})
+
+add_library(${TARGET_WITH_NAMESPACE} STATIC IMPORTED GLOBAL)
+
+set_target_properties(${TARGET_WITH_NAMESPACE} PROPERTIES IMPORTED_LOCATION "${${MY_NAME}_LIBRARY}")
+
+ly_target_include_system_directories(TARGET ${TARGET_WITH_NAMESPACE} INTERFACE ${${MY_NAME}_INCLUDE_DIR})
+
+target_link_libraries(${TARGET_WITH_NAMESPACE} 
+                      INTERFACE ${CMAKE_DL_LIBS})
+
+set(${MY_NAME}_FOUND True)

+ 46 - 0
package-system/sqlite/build_config.json

@@ -0,0 +1,46 @@
+{
+   "git_url":"https://github.com/sqlite/sqlite.git",
+   "git_tag":"version-3.32.2",
+   "package_name":"SQLite",
+   "package_version":"3.32.2-rev1",
+   "package_url":"https://www.sqlite.org",
+   "package_license":"CUSTOM",
+   "package_license_file":"copyright.txt",
+   "cmake_find_source":"FindSQLite.cmake",
+   "cmake_find_target":"FindSQLite.cmake",
+   "additional_src_files":[
+      "copyright.txt"
+   ],
+   "Platforms":{
+      "Windows":{
+         "Windows":{
+            "custom_build_cmd": [
+               "build_windows.cmd"
+            ],
+            "custom_install_cmd": [
+               "package_windows.cmd"
+            ]
+         }
+      },
+      "Darwin":{
+         "Mac":{
+            "custom_build_cmd": [
+               "./build_unix_like.sh"
+            ],
+            "custom_install_cmd": [
+               "./package_unix_like.sh"
+            ]
+         }
+      },
+      "Linux":{
+         "Linux":{
+            "custom_build_cmd": [
+               "./build_unix_like.sh"
+            ],
+            "custom_install_cmd": [
+               "./package_unix_like.sh"
+            ]
+         }
+      }
+   }
+}

+ 45 - 0
package-system/sqlite/build_unix_like.sh

@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+
+BUILD_FOLDER=$TEMP_FOLDER/build
+
+
+# TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script
+echo Building source
+pushd $TEMP_FOLDER/build
+
+# Run configure 
+../src/configure --enable-debug=no --disable-tcl --enable-shared=no --prefix=$TEMP_FOLDER/install --with-pic=yes
+if [ $? -ne 0 ]
+then
+    echo "Unable to configure sqlite" >&2
+    exit 1
+fi
+
+# Run the make and build
+make
+if [ $? -ne 0 ]
+then
+    echo "Unable to build sqlite" >&2
+    exit 1
+fi
+
+# Install to a temp install folder
+make install
+if [ $? -ne 0 ]
+then
+    echo "Unable to install sqlite (release)" >&2
+    exit 1
+fi
+
+popd
+
+exit 0

+ 31 - 0
package-system/sqlite/build_windows.cmd

@@ -0,0 +1,31 @@
+@echo off
+REM
+REM 
+REM Copyright (c) Contributors to the Open 3D Engine Project.
+REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
+REM 
+REM SPDX-License-Identifier: Apache-2.0 OR MIT
+REM 
+REM 
+
+SET SRC_PATH=%TEMP_FOLDER%\src
+SET BLD_PATH=%TEMP_FOLDER%\build
+
+
+ECHO In order to build sqlite for windows, you must have the visual studio command environment
+ECHO setup by running the appropriate vcvars.bat. You also need tclsh installed and in the system 
+ECHO path as tcl is required to build for windows
+
+
+cd %BLD_PATH%
+
+REM Build the release library
+call nmake /f ..\src\Makefile.msc TOP=..\src libsqlite3.lib DEBUG=0
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO "nmake for debug Command Failed"
+    exit /b 1
+)
+
+ECHO Build Successful
+
+exit /b 0

+ 27 - 0
package-system/sqlite/copyright.txt

@@ -0,0 +1,27 @@
+SQLite Is Public Domain
+
+All of the code and documentation in SQLite has been dedicated to the public domain by the authors. All code authors, and representatives of the companies they work for, have signed affidavits dedicating their contributions to the public domain and originals of those signed affidavits are stored in a firesafe at the main offices of Hwaci. Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original SQLite code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
+
+The previous paragraph applies to the deliverable code and documentation in SQLite - those parts of the SQLite library that you actually bundle and ship with a larger application. Some scripts used as part of the build process (for example the "configure" scripts generated by autoconf) might fall under other open-source licenses. Nothing from these build scripts ever reaches the final deliverable SQLite library, however, and so the licenses associated with those scripts should not be a factor in assessing your rights to copy and use the SQLite library.
+
+All of the deliverable code in SQLite has been written from scratch. No code has been taken from other projects or from the open internet. Every line of code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects.
+
+Open-Source, not Open-Contribution
+SQLite is open-source, meaning that you can make as many copies of it as you want and do whatever you want with those copies, without limitation. But SQLite is not open-contribution. In order to keep SQLite in the public domain and ensure that the code does not become contaminated with proprietary or licensed content, the project does not accept patches from unknown persons.
+
+All of the code in SQLite is original, having been written specifically for use by SQLite. No code has been copied from unknown sources on the internet.
+
+Warranty of Title
+SQLite is in the public domain and does not require a license. Even so, some organizations want legal proof of their right to use SQLite. Circumstances where this occurs include the following:
+
+Your company desires indemnity against claims of copyright infringement.
+You are using SQLite in a jurisdiction that does not recognize the public domain.
+You are using SQLite in a jurisdiction that does not recognize the right of an author to dedicate their work to the public domain.
+You want to hold a tangible legal document as evidence that you have the legal right to use and distribute SQLite.
+Your legal department tells you that you have to purchase a license.
+If any of the above circumstances apply to you, Hwaci, the company that employs all the developers of SQLite, will sell you a Warranty of Title for SQLite. A Warranty of Title is a legal document that asserts that the claimed authors of SQLite are the true authors, and that the authors have the legal right to dedicate the SQLite to the public domain, and that Hwaci will vigorously defend against challenges to those claims. All proceeds from the sale of SQLite Warranties of Title are used to fund continuing improvement and support of SQLite.
+
+Contributed Code
+In order to keep SQLite completely free and unencumbered by copyright, the project does not accept patches. If you would like to make a suggested change, and include a patch as a proof-of-concept, that would be great. However please do not be offended if we rewrite your patch from scratch.
+
+This copyright can be found at https://www.sqlite.org/copyright.html

+ 34 - 0
package-system/sqlite/package_unix_like.sh

@@ -0,0 +1,34 @@
+#!/bin/bash
+
+#
+# Copyright (c) Contributors to the Open 3D Engine Project.
+# For complete copyright and license terms please see the LICENSE at the root of this distribution.
+# 
+# SPDX-License-Identifier: Apache-2.0 OR MIT
+#
+#
+
+
+PACKAGE_BASE=$TARGET_INSTALL_ROOT
+
+INSTALL_SOURCE=$TEMP_FOLDER/build
+
+cp $TEMP_FOLDER/src/copyright.txt $PACKAGE_BASE/
+
+# Copy extra source files just for reference
+cp $INSTALL_SOURCE/shell.c $PACKAGE_BASE/
+cp $INSTALL_SOURCE/sqlite3.c $PACKAGE_BASE/
+
+# Copy the header files
+cp $INSTALL_SOURCE/sqlite3ext.h $PACKAGE_BASE/
+cp $INSTALL_SOURCE/sqlite3.h $PACKAGE_BASE/
+
+# Copy the debug and release static libraries
+mkdir $PACKAGE_BASE/lib
+
+mkdir $PACKAGE_BASE/lib
+cp $TEMP_FOLDER/install/lib/libsqlite3.a $PACKAGE_BASE/lib/
+cp $TEMP_FOLDER/install/lib/libsqlite3.la $PACKAGE_BASE/lib/
+cp -r $TEMP_FOLDER/install/lib/pkgconfig $PACKAGE_BASE/lib/
+
+exit 0

+ 30 - 0
package-system/sqlite/package_windows.cmd

@@ -0,0 +1,30 @@
+ @echo off
+
+REM Copyright (c) Contributors to the Open 3D Engine Project.
+REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
+REM 
+REM SPDX-License-Identifier: Apache-2.0 OR MIT
+REM
+
+
+SET PACKAGE_BASE=%TARGET_INSTALL_ROOT%
+SET BLD_PATH=%TEMP_FOLDER%\build
+
+SET INSTALL_SOURCE=%TEMP_FOLDER%\build
+
+cp %TEMP_FOLDER%\src\copyright.txt %PACKAGE_BASE%\
+
+REM Copy extra source files just for reference
+cp %INSTALL_SOURCE%\shell.c %PACKAGE_BASE%\
+cp %INSTALL_SOURCE%\sqlite3.c %PACKAGE_BASE%\
+
+REM Copy the header files
+cp %INSTALL_SOURCE%\sqlite3ext.h %PACKAGE_BASE%\
+cp %INSTALL_SOURCE%\sqlite3.h %PACKAGE_BASE%\
+
+REM Copy the static library
+mkdir %PACKAGE_BASE%\lib
+copy %TEMP_FOLDER%\build\libsqlite3.lib %PACKAGE_BASE%\lib\sqlite3.lib
+
+exit /b 0
+

+ 2 - 1
package_build_list_host_darwin.json

@@ -31,6 +31,7 @@
         "poly2tri-7f0487a-rev1-mac": "package-system/poly2tri/build_package_image.py --platform-name mac",
         "v-hacd-2.3-1a49edf-rev1-mac": "package-system/v-hacd/build_package_image.py --platform-name mac",
         "SPIRVCross-2021.04.29-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Mac --package-root ../../package-system --clean",
+        "SQLite-3.32.2-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Mac --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Mac --package-root ../../package-system --clean",
         "astc-encoder-3.2-rev5-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
@@ -86,7 +87,7 @@
         "astc-encoder-3.2-rev5-mac": "package-system/astc-encoder-mac",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-mac": "package-system/DirectXShaderCompilerDxc-mac",
         "azslc-1.7.34-rev1-mac": "package-system/azslc-mac",
-        "SQLite-3.32.2-rev3-multiplatform": "package-system/SQLite-multiplatform",
+        "SQLite-3.32.2-rev1-mac": "package-system/SQLite-mac",
         "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform",
         "qt-5.15.2-rev5-mac": "package-system/qt-mac",
         "zlib-1.2.11-rev5-mac": "package-system/zlib-mac",

+ 2 - 1
package_build_list_host_linux.json

@@ -23,6 +23,7 @@
         "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri/build_package_image.py --platform-name linux",
         "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd/build_package_image.py --platform-name linux",
         "SPIRVCross-2021.04.29-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux --package-root ../../package-system --clean",
+        "SQLite-3.32.2-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --package-root ../../package-system --clean",
         "astc-encoder-3.2-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Linux --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Linux --package-root ../../package-system --clean",
@@ -63,7 +64,7 @@
         "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri-linux",
         "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd-linux",
         "unwind-1.2.1-linux": "package-system/unwind-linux",
-        "SQLite-3.32.2-rev3-multiplatform": "package-system/SQLite-multiplatform",
+        "SQLite-3.32.2-rev1-linux": "package-system/SQLite-linux",
         "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform",
         "qt-5.15.2-rev5-linux": "package-system/qt-linux",
         "zlib-1.2.11-rev5-linux": "package-system/zlib-linux",

+ 2 - 1
package_build_list_host_windows.json

@@ -29,6 +29,7 @@
         "OpenSSL-1.1.1b-rev1-android": "package-system/OpenSSL/build_package_image.py --platform-name android",
         "ilmbase-2.3.0-rev4-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/OpenEXR --platform-name Windows --package-root ../../package-system --clean",
         "SPIRVCross-2021.04.29-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Windows --package-root ../../package-system --clean",
+        "SQLite-3.32.2-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Windows --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Windows --package-root ../../package-system --clean",
         "astc-encoder-3.2-rev2-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Windows --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2104-o3de-rev3-windows": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Windows --package-root ../../package-system --clean",
@@ -106,7 +107,7 @@
     "DirectXShaderCompilerDxc-1.6.2104-o3de-rev2-windows": "package-system/DirectXShaderCompilerDxc-windows",
     "azslc-1.7.23-rev2-windows": "package-system/azslc-windows",
     "zstd-1.35-multiplatform": "package-system/zstd-multiplatform",
-    "SQLite-3.32.2-rev3-multiplatform": "package-system/SQLite-multiplatform",
+    "SQLite-3.32.2-rev1-windows": "package-system/SQLite-windows",
     "glad-2.0.0-beta-rev2-multiplatform": "package-system/glad-multiplatform",
     "xxhash-0.7.4-rev1-multiplatform": "package-system/xxhash-multiplatform",
     "PVRTexTool-4.24.0-rev4-multiplatform": "package-system/PVRTexTool-multiplatform",