Skip to content

Instantly share code, notes, and snippets.

@TimSC
Last active April 14, 2017 19:03
Show Gist options
  • Select an option

  • Save TimSC/db76144189148d2965ee27c84fb61177 to your computer and use it in GitHub Desktop.

Select an option

Save TimSC/db76144189148d2965ee27c84fb61177 to your computer and use it in GitHub Desktop.
Notes on compiling OpenCV on Ubunut/Mint
http://unix.stackexchange.com/questions/46122/how-can-i-create-a-deb-package-with-my-compiled-opencv-build
Inspired by https://launchpad.net/~sbadia/+archive/ubuntu/opencv
Interesting: https://github.com/sbadia/opencv-deb
In CMakeCache.txt
//Enable to build Debian packages
CPACK_BINARY_DEB:BOOL=ON
//Where to install the python packages.
PYTHON3_PACKAGES_PATH:PATH=lib/python3.5/dist-packages
//Where to install the python packages.
PYTHON2_PACKAGES_PATH:PATH=lib/python2.7/dist-packages
In CMakeLists.txt
project(OpenCV3 CXX C)
In OpenCVPackaging.cmake:
string( TOLOWER "${CMAKE_PROJECT_NAME}" CMAKE_PROJECT_NAME_LOWER )
set(CPACK_DEBIAN_SAMPLES_PACKAGE_DEPENDS "${CMAKE_PROJECT_NAME_LOWER}-libs")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CMAKE_PROJECT_NAME_LOWER}-libs")
set(CPACK_DEBIAN_JAVA_PACKAGE_DEPENDS "${CMAKE_PROJECT_NAME_LOWER}-libs")
set(CPACK_DEBIAN_PYTHON_PACKAGE_DEPENDS "${CMAKE_PROJECT_NAME_LOWER}-libs")
set(CPACK_DEBIAN_TESTS_PACKAGE_DEPENDS "${CMAKE_PROJECT_NAME_LOWER}-libs")
==Using deb source approach==
https://askubuntu.com/questions/155410/how-do-i-add-create-a-source-changes-file
https://wiki.debian.org/BuildingTutorial
https://help.launchpad.net/Packaging/PPA/Uploading
https://askubuntu.com/questions/184391/uploaded-a-package-to-ppa-but-its-not-showing-and-no-email-from-launchpad
dh_make -f ../opencv-3.2.0.tar.gz
dpkg-source --include-binaries --include-removal -b opencv-3.2/
dpkg-source --include-binaries --commit
gpg --list-keys --fingerprint
#Add to the end of .bashrc
export DEBFULLNAME="My name"
export DEBEMAIL="my@email.com"
#Install tools
sudo apt install devscripts equivs gdebi-core
#Rename source tar blob to appropriate name
#Update debian folder to remove patches (as needed)
#Update desc file (with file names, file sizes and hashes)
#Extract sources
dpkg-source -x ../opencv_3.2.0+dfsg-1~xenial1.dsc
#Get dependencies
mk-build-deps -i
sudo gdebi whatever.deb
#Update changelog, particularly the version number
dch -n
#Rebuild source library
debuild -S --source-option=--include-binaries
#Create change
debuild -S -sa
#Upload change to PPA
dput ppa:timsc/opencv-3.2 opencv_3.2.0+dfsg-1~xenial1_source.changes
#Build debs locally
debuild -b -uc -us -j4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment