######################################
Precompiled libraries from blender.org
######################################

Since blender-5.0.1, this SlackBuild uses a set of precompiled libraries
which are required to build Blender from source code.  They are
downloaded as a tarball and unpacked as required.

Historically, this tarball of precompiled libraries was created by
downloading them from blender.org using the 'make update' command,
along the lines of:

-  Install git-lfs from SBo
-  Next ensure ~10G disk space is available.

Then run:
-  git clone https://projects.blender.org/blender/blender.git
-  cd blender
-  git checkout v5.1.0
-  make update
-  cd lib
-  tar cvf blender-5.1.0-libs.tar linux_x64
-  plzip -9 --output=blender-5.1.0-libs.tar.lz blender-5.1.0-libs.tar

The resulting tarball was then uploaded to SourceForge from where
it could be downloaded by anyone when executing the SlackBuild.

Since then, the libraries have been compiled from source by the
maintainer and uploaded to SourceForge. Anyone wishing to build
these libraries from source code themselves may follow the
instructions below.


###################################################
Building the precompiled libraries from source code
###################################################

Since the method described above uses prebuilt libraries obtained
elsewhere, purists are provided with an alternative system which builds
the necessary precompiled libraries from source code. Since this is an
extremely resource expensive procedure (see Resources section below),
it is not used by default but is described here for those wanting to use
it.

## NOTE ##
From blender version 5.1.0 onward (including libraries building),
minimum GCC version is 14.2.0


Prerequisites (from SBo):
-  gcc14
-  cudatoolkit_12
-  cmake in testing/packages/graphics-updates
   (provides 3.31.8 - Slackware 15.0's cmake version 3.21.4 is insufficient!)

Run the blender-libs.sh script in this directory. The blender-libs.sh
and blender-libs.defs files are based on standard SBo .SlackBuild and
.info files but renamed to avoid confusion with real .SlackBuild and
.info files. Instead of creating a normal Slackware package, this
script generates a tarball of precompiled libraries. Running the
build script will perform the following steps:

- obtain a list of source tarballs from blender-libs.defs
- download the source tarballs from local cache or source repositories
- rename some source tarballs to names expected by blender
- unpack blender source tarball
- move source tarballs to location expected by blender
- build all libraries
- generate tarball of libraries
- move downloaded source tarballs to a local cache (in case of reuse).

If the source tarballs have previously been downloaded and stored
somewhere to avoid repeated downloading, the storage location may be
specified with the SOURCES_CACHE environment variable when running the
script e.g.
    SOURCES_CACHE=/var/cache/blender-sources bash blender-libs.sh

While not mandatory, AMD graphics hardware support depends on prior
installation of the rocmtoolkit_6 package.

## NOTE ##
Even if not targeting the Nvidia GPU, the cudatoolkit_12 package is
still mandatory for building the libraries (not Blender itself).


##################################################
Resources for source build of precompiled libraries
##################################################

- library source tarballs:          2 GB
- time to download source tarballs: depends on internet connection
                                    (downloading 2GB)
- time to build & install cudatoolkit_12 and rocmtoolkit_6
                                    (both very large)
- time to build library tarball:    2 hours
- disk space to build:              70 GB (over and above full
                                           Slackware installation)


