Skip to content

Commit

Permalink
Merge pull request #1 from uilianries/mozjpeg/apply-patch
Browse files Browse the repository at this point in the history
Use patches
  • Loading branch information
theirix authored Nov 25, 2019
2 parents 71a4f41 + dfcab8f commit f3917a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions recipes/mozjpeg/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ sources:
"3.3.1":
url: "https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz"
sha256: "aebbea60ea038a84a2d1ed3de38fdbca34027e2e54ee2b7d08a97578be72599d"
patches:
"3.3.1":
- base_path: "source_subfolder"
patch_file: "patches/3.3.1/mozjpeg.patch"
20 changes: 10 additions & 10 deletions recipes/mozjpeg/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MozjpegConan(ConanFile):
topics = ("conan", "image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics")
license = ("BSD", "BSD-3-Clause", "ZLIB")
homepage = "https://github.com/mozilla/mozjpeg"
exports_sources = ("CMakeLists.txt", "mozjpeg.patch")
exports_sources = ("CMakeLists.txt", "patches/*")
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {
Expand Down Expand Up @@ -79,7 +79,8 @@ def _configure_cmake(self):

def _configure_autotools(self):
if not self._autotools:
self.run('autoreconf -fiv')
with tools.chdir(self._source_subfolder):
self.run('autoreconf -fiv')
self._autotools = AutoToolsBuildEnvironment(self)
args = []
if self.options.shared:
Expand All @@ -96,28 +97,27 @@ def _configure_autotools(self):
args.append('--with-turbojpeg' if self.options.turbojpeg else '--without-turbojpeg')
args.append('--with-java' if self.options.java else '--without-java')
args.append('--with-12bit' if self.options.enable12bit else '--without-12bit')
self._autotools.configure(args=args)
self._autotools.configure(configure_dir=self._source_subfolder, args=args)
return self._autotools

def build(self):
tools.patch(base_path=self._source_subfolder, patch_file="mozjpeg.patch")
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)
if self.settings.os == 'Windows':
cmake = self._configure_cmake()
cmake.build()
else:
with tools.chdir(self._source_subfolder):
autotools = self._configure_autotools()
autotools.make()
autotools = self._configure_autotools()
autotools.make()

def package(self):
self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder)
if self.settings.os == 'Windows':
cmake = self._configure_cmake()
cmake.install()
else:
with tools.chdir(self._source_subfolder):
autotools = self._configure_autotools()
autotools.install()
autotools = self._configure_autotools()
autotools.install()
# drop pc and cmake file
tools.rmdir(os.path.join(self.package_folder, 'share'))
tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))
Expand Down
File renamed without changes.

0 comments on commit f3917a5

Please sign in to comment.