Compiling "file" with spksrc for synology NAS
Read the disclaimer
This article describes how to compile "file" for synology devices, package it and install it.
You can get "file" sources at:
- https://github.com/file/file
- ftp://ftp.astron.com/pub/file/
The "file" command is "a file type guesser", that is, a command-line tool that tells you in words what kind of data a file contains.
The original spksrc already contains a file package, that only compiles the binaries :
https://github.com/SynoCommunity/spksrc/tree/master/cross/file
This package fills the gap and provides the command line utilities from the shell:
- file
https://dayandnightcoding.blogspot.com/2020/04/compiling-cpulimit-with-spksrc-for.html
You can follow the different steps there.
I'll document only the steps referring specifically to "file".
Clone the repository and make setup
It's documented here : https://github.com/SynoCommunity/spksrc/wiki/Developers-HOW-TO
- on the ubuntu host
- start a terminal
- choose a folder for the git clone root
- git clone https://github.com/youpla/spksrc.git
- cd spksrc/
- make setup
- on the ubuntu host
- start a terminal
- choose a folder for the git clone root
- git clone https://github.com/youpla/spksrc.git
- cd spksrc/
- make setup
Compile the "file" package for your architecture
in a terminal navigate to the file folderexample:
/home/userprofile/test-git/spksrc/spk/file
make arch-armada375
At the time writing this article I have a Ubuntu 18 with file 5.32.
The spksrc package is file 5.35
The cross compilation fails with this message:
Cannot use the installed version of file (5.32) to
cross-compile file 5.35
Please install file 5.35 locally first
From a console type : file --version
If the version displayed is not the one in the spksrc package, you can apply one of the following workaround.
Workaround 1
Install file 5.35 to your ubuntu system
- Uninstall the current package from the console : sudo apt remove file
- Download the sources : ftp://ftp.astron.com/pub/file/file-5.35.tar.gz
- Download and check the signature : ftp://ftp.astron.com/pub/file/file-5.35.tar.gz.asc
(see below) - Unpack the file-5.35.tar.gz archive
- Navigate to the unpack directory from the console
- Follow the installation documentation at : https://github.com/file/file
- run the configure script : ./configure
- run make : make
- run make install as sudo : sudo make install
- On ubuntu 18: I also had to correct the libraries.
- From a console navigate to : /usr/lib/x86_64-linux-gnu
- backup the existing libraries :
- sudo mv libmagic.so* /root/
- sudo mv libmagic.la /root/
- copy the new ones :
- sudo cp /usr/local/lib/libmagic.la .
- sudo cp /usr/local/lib/libmagic.so.1.0.0 .
- make the symbolic links : sudo ln -s libmagic.so.1.0.0 libmagic.so
- make the symbolic links : sudo ln -s libmagic.so.1.0.0 libmagic.so.1
- From the console go back to: /home/userprofile/test-git/spksrc/spk/file
- Clean up the last build : make clean
- Build again : make arch-armada375
Workaround 2
You can alter the spksrc source you downloaded in order to compile the same version that is already installed on your computer.
- edit : /home/userprofile/test-git/spksrc/cross/file/Makefile
- change : PKG_VERS = 5.35 to the version on your computer
- edit : /home/userprofile/test-git/spksrc/cross/file/digests
- you can empty the file. Important : please read "check the checksum" section in this article.
- edit : /home/userprofile/test-git/spksrc/spk/file/Makefile
- SPK_VERS = 5.35 to the version on your computer
You can now cross compile the package for your synology.
- From the console go back to: /home/userprofile/test-git/spksrc/spk/file
- Clean up the last build : make clean
- Build again : make arch-armada375
- From the console go back to: /home/userprofile/test-git/spksrc/spk/file
- Clean up the last build : make clean
- Build again : make arch-armada375
Check the checksum
- If you already run the cross compilation, the archive is in : /home/userprofile/test-git/spksrc/distrib/file-5.35.tar.gz
- If you did not alter the source file, the checksum has already been performed by the cross compilation script.
- If you emptied : /home/userprofile/test-git/spksrc/cross/file/digests
- Then the script did NOT perform a checksum. You have no warranty that the file has not been altered during the transfer.
- If you downloaded the archive yourself or altered the script you can check the signature following the documentation:
- https://github.com/file/file
- gpg --verify file-5.32.tar.gz.asc file-5.32.tar.gz
- you'll get :
- gpg: Signature made Sa 02 Sep 2017 11:08:32 CESTgpg:
using DSA key 71112AB16CB33B3A - gpg --keyserver hkp://keys.gnupg.net --recv-keys 71112AB16CB33B3A
- You have now checked the file signature.
Install the package
Go to the file explorer and find the generated file.
example
/home/userprofile/test-git/spksrc/packages/file_armada375-6.1_5.35-1.spk
example
/home/userprofile/test-git/spksrc/packages/file_armada375-6.1_5.35-1.spk
How to install the package to your device :
https://dayandnightcoding.blogspot.com/2020/04/testing-package-compiled-with-spksrc.html
https://dayandnightcoding.blogspot.com/2020/04/testing-package-compiled-with-spksrc.html
Testing
See :
https://dayandnightcoding.blogspot.com/2020/04/testing-package-compiled-with-spksrc.html
The package "file" has been tested for install and uninstall on my DS-115 with no noticed problem.
https://dayandnightcoding.blogspot.com/2020/04/testing-package-compiled-with-spksrc.html
The package "file" has been tested for install and uninstall on my DS-115 with no noticed problem.
Comments
Post a Comment