def build(self): if self.settings.os == "Linux" or self.settings.os == "Macos": env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') else: env_line = env.command_line self.run("cd %s && %s ./autogen.sh" % (self.ZIP_FOLDER_NAME, env_line)) self.run("chmod +x ./%s/configure" % self.ZIP_FOLDER_NAME) if self.settings.os == "Macos": old_str = '-install_name \$rpath/\$soname' new_str = '-install_name \$soname' replace_in_file("./%s/configure" % self.ZIP_FOLDER_NAME, old_str, new_str) self.run("cd %s && %s ./configure" % (self.ZIP_FOLDER_NAME, env_line)) self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env_line)) else: cmake = CMake(self.settings) self.run("cd %s && mkdir _build" % self.ZIP_FOLDER_NAME) cd_build = "cd %s/_build" % self.ZIP_FOLDER_NAME self.output.warn('%s && cmake .. %s' % (cd_build, cmake.command_line)) self.run('%s && cmake .. %s' % (cd_build, cmake.command_line)) self.output.warn("%s && cmake --build . %s" % (cd_build, cmake.build_config)) self.run("%s && cmake --build . %s" % (cd_build, cmake.build_config))
def build(self): if self.settings.os == "Windows": args = ['-DBUILD_TESTING=OFF'] args += ['-DBUILD_SHARED_LIBS=%s' % ('ON' if self.options.shared else 'OFF')] cmake = CMake(self.settings) self.run('cd protobuf-2.6.1/cmake && cmake . %s %s' % (cmake.command_line, ' '.join(args))) self.run("cd protobuf-2.6.1/cmake && cmake --build . %s" % cmake.build_config) else: env = ConfigureEnvironment(self.deps_cpp_info, self.settings) concurrency = 1 try: import multiprocessing concurrency = multiprocessing.cpu_count() except (ImportError, NotImplementedError): pass self.run("chmod +x protobuf-2.6.1/autogen.sh") self.run("chmod +x protobuf-2.6.1/configure") self.run("cd protobuf-2.6.1 && ./autogen.sh") args = [] if not self.options.shared: args += ['--disable-shared'] self.run("cd protobuf-2.6.1 && %s ./configure %s" % (env.command_line, ' '.join(args))) self.run("cd protobuf-2.6.1 && make -j %s" % concurrency)
def build_with_make(self): self.run("cd %s" % self.folder) self.run("chmod a+x %s/configure" % self.folder) suffix = "" with_fpic = "" if self.settings.arch == "x86": suffix = 'CFLAGS="-m32" LDFLAGS="-m32"' # not working the env, dont know why env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') with_fpic += " --with-pic" else: env_line = env.command_line env_line = env_line.replace('LIBS="', 'LIBS2="') # Rare error if LIBS is kept if self.settings.os == "Macos": # Fix rpath, we want empty rpaths, just pointing to lib file old_str = "-install_name \$rpath/" new_str = "-install_name " replace_in_file("%s/configure" % self.folder, old_str, new_str) self.run("chmod a+x %s/build-scripts/gcc-fat.sh" % self.folder) configure_command = 'cd %s && CC=$(pwd)/build-scripts/gcc-fat.sh && %s ./configure %s' % (self.folder, env_line, suffix) else: configure_command = 'cd %s && %s ./configure %s %s --enable-mir-shared=no' % (self.folder, env_line, suffix, with_fpic) self.output.warn("Configure with: %s" % configure_command) self.run(configure_command) self.run("cd %s && %s make %s" % (self.folder, env_line, suffix))
def build(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.settings.os == "Linux" or self.settings.os == "Macos": env_line = env.command_line # compose configure options suffix = '' if self.options.shared: suffix += " --enable-shared --disable-static" else: suffix += " --disable-shared --enable-static" # disable rpath build old_str = "-install_name \$rpath/" new_str = "-install_name " replace_in_file("%s/%s/configure" % (self.conanfile_directory, self.FOLDER_NAME), old_str, new_str) cmd = 'cd %s/%s && %s ./configure %s' % (self.conanfile_directory, self.FOLDER_NAME, env_line, suffix) self.output.warn('Running: ' + cmd) self.run(cmd) cmd = 'cd %s/%s && %s make' % (self.conanfile_directory, self.FOLDER_NAME, env_line) self.output.warn('Running: ' + cmd) self.run(cmd)
def build_with_configure(self): flags = '--prefix=%s' % self.package_folder env = ConfigureEnvironment(self.deps_cpp_info, self.settings) self.run("cd %s && chmod +x configure install-sh" % self.ZIP_FOLDER_NAME) self.run("cd %s && %s ./configure %s" % (self.ZIP_FOLDER_NAME, env.command_line, flags)) self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env.command_line)) self.run("cd %s && %s make install" % (self.ZIP_FOLDER_NAME, env.command_line))
def build(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) installFolder = "%s/installFolder" % os.getcwd() n_cores = tools.cpu_count() self.run("mkdir %s" % installFolder) self.run("cd %s && ./configure \ --enable-pic \ --enable-shared \ --disable-static \ --disable-symver \ --disable-ffplay \ --disable-ffprobe \ --enable-pthreads \ --disable-devices \ --disable-avdevice \ --disable-nonfree \ --disable-gpl \ --disable-doc \ --enable-avresample \ --enable-demuxer=rtsp \ --enable-muxer=rtsp \ --disable-bzlib \ --prefix=%s" % (self.FOLDER_NAME, installFolder)) self.run("cd %s && %s make -j%s" % (self.FOLDER_NAME, env.command_line, n_cores)) self.run("cd %s && make install" % self.FOLDER_NAME)
def build(self): if self.settings.os == 'Windows': flags = 'nosign' if self.options.shared: flags += ' shared' if self.settings.build_type == 'Debug': flags += ' debug' if self.settings.arch == 'x86': flags += ' x86' elif self.settings.arch == 'x86_64': flags += ' x64' build_command = 'cd %s & vcbuild.bat %s' % (self.source_dir, flags) self.output.info('build_command: %s' % build_command) self.run(build_command) else: env = ConfigureEnvironment(self.deps_cpp_info, self.settings) flags = '--enable-shared' if self.options.shared else '' if self.settings.build_type == 'Debug': flags += ' --debug' configure_command = 'cd %s && %s ./configure %s' % ( self.source_dir, env.command_line, flags) self.output.info('Configure with: %s' % configure_command) self.run(configure_command) self.run('cd %s && %s make -j2' % (self.source_dir, env.command_line))
def build(self): self.output.info("ChakraCore build:") self.output.info("arch %s" % self.settings.arch) # Use msbuild in Windows, and cmake in linux and macos env = ConfigureEnvironment(self.deps_cpp_info, self.settings) # Set options: msbuild_options="/m" # Available platforms: x86, x64 and arm if (self.settings.arch == "x86"): msbuild_options += " /p:Platform=x86" elif (self.settings.arch == "x86_64"): msbuild_options += " /p:Platform=x64" elif (self.settings.arch == "arm"): msbuild_options += " /p:Platform=arm" else: self.output.error("Invalid arch %s" % self.settings.arch) # Available configurations: Debug, Release and Test. Debug and Release are used msbuild_options += (" /p:Configuration=%s" % self.settings.build_type) # Link static runtime if(self.settings.compiler.runtime == "MT" or self.settings.compiler.runtime == "MTd"): msbuild_options += " /p:RuntimeLib=static_library" # Launch build process command = ('%s && cd %s && msbuild %s Build\\Chakra.Core.sln' \ % (env.command_line_env, self.ZIP_FOLDER_NAME, msbuild_options)) self.run(command)
def build_with_make(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') else: env_line = env.command_line custom_vars = "LIBPNG_LIBS=0 BZIP2_LIBS=0" # Trick: This way it didn't look for system libs and take the env variables from env_line self.run("cd %s" % self.folder) self.output.warn(env_line) if self.settings.os == "Macos": # Fix rpath, we want empty rpaths, just pointing to lib file old_str = "-install_name \$rpath/" new_str = "-install_name " replace_in_file("%s/builds/unix/configure" % self.folder, old_str, new_str) libpng_libs = 'LIBPNG_LIBS=%s' configure_command = 'cd %s && %s ./configure --with-harfbuzz=no %s' % ( self.folder, env_line, custom_vars) self.output.warn("Configure with: %s" % configure_command) self.run(configure_command) self.run("cd %s && %s make" % (self.folder, env_line))
def build(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) concurrency = 1 try: import multiprocessing concurrency = multiprocessing.cpu_count() except (ImportError, NotImplementedError): pass self.run("chmod +x libuv-v1.9.1/autogen.sh") self.run("cd libuv-v1.9.1 && ./autogen.sh") if self.settings.os == "Macos": old_str = '-install_name \$rpath/\$soname' new_str = '-install_name \$soname' replace_in_file("./libuv-v1.9.1/configure", old_str, new_str) args = [] self.run("chmod +x libuv-v1.9.1/configure") self.run("cd libuv-v1.9.1 && %s ./configure %s" % (env.command_line, ' '.join(args))) cppflags = "" if self.settings.os == "Linux": cppflags = "CPPFLAGS=-fPIC " self.run("cd libuv-v1.9.1 && make " + cppflags + "-j %s" % concurrency)
def build(self): self.output.info("c-ares build:") self.output.info("Shared? %s" % self.options.shared) # Use configure && make in linux and Macos, and nmake in windows env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.settings.os == "Linux" or self.settings.os == "Macos": self.run("cd %s && %s ./configure" % (self.ZIP_FOLDER_NAME, env.command_line_env)) self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env.command_line_env)) else: # Generate the cmake options nmake_options = "CFG=" nmake_options += "dll-" if self.options.shared else "lib-" nmake_options += "debug" if self.settings.build_type == "Debug" else "release" # Check if it must be built using static CRT if (self.settings.compiler.runtime == "MT" or self.settings.compiler.runtime == "MTd"): nmake_options += " RTLIBCFG=static" # command_line_env comes with /. In Windows, \ are used self.output.info(nmake_options) command = ('%s && cd %s && buildconf.bat && nmake /f Makefile.msvc %s' \ % (env.command_line_env, self.ZIP_FOLDER_NAME, nmake_options)) self.run(command)
def build_windows(self): iconv_headers_paths = self.deps_cpp_info["winiconv"].include_paths[0] iconv_lib_paths = " ".join([ 'lib="%s"' % lib for lib in self.deps_cpp_info["winiconv"].lib_paths ]) compiler = "msvc" if self.settings.compiler == "Visual Studio" else self.settings.compiler == "gcc" env = ConfigureEnvironment(self.deps_cpp_info, self.settings) vc_command = env.command_line_env debug = "yes" if self.settings.build_type == "Debug" else "no" configure_command = "%s && cd %s/win32 && cscript configure.js " \ "zlib=1 compiler=%s cruntime=/%s debug=%s include=\"%s\" %s" % (vc_command, self.ZIP_FOLDER_NAME, compiler, self.settings.compiler.runtime, debug, iconv_headers_paths, iconv_lib_paths) self.output.warn(configure_command) self.run(configure_command) makefile_path = os.path.join(self.ZIP_FOLDER_NAME, "win32", "Makefile.msvc") # Zlib library name is not zlib.lib always, it depends on configuration replace_in_file( makefile_path, "LIBS = $(LIBS) zlib.lib", "LIBS = $(LIBS) %s.lib" % self.deps_cpp_info["zlib"].libs[0]) make_command = "nmake /f Makefile.msvc" if self.settings.compiler == "Visual Studio" else "make -f Makefile.mingw" make_command = "%s && cd %s/win32 && %s" % ( vc_command, self.ZIP_FOLDER_NAME, make_command) self.output.warn(make_command) self.run(make_command)
def makefile_build(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.shared: self.run('%s make dynamic' % env.command_line) else: self.run('%s make static' % env.command_line) if self.scope.build_tests: self.run('%s make test check' % env.command_line)
def build_with_configure(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) self.run( "cd %s && chmod +x ./autogen.sh && %s ./autogen.sh --prefix=%s %s" % (self.src_dir, env.command_line, self.package_folder, self.configure_options)) self.run("cd %s && %s make -j5" % (self.src_dir, env.command_line)) self.run("cd %s &&%s make install" % (self.src_dir, env.command_line))
def build(self): """ Define your project building. You decide the way of building it to reuse it later in any other project. """ env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.settings.os == "Linux" or self.settings.os == "Macos": self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env.command_line))
def build(self): #Make build dir self.build_dir = self.try_make_dir(os.path.join(".", "build")) cmake = CMake(self.settings) env = ConfigureEnvironment(self) self.cmake_configure(cmake, env, self.build_dir) self.cmake_build_and_install(cmake, env, self.build_dir)
def build(self): if self.settings.os == "Linux" or self.settings.os == "Macos": env = ConfigureEnvironment(self.deps_cpp_info, self.settings) env_line = env.command_line self.run("cd %s && %s ./configure --prefix=%s/out" % (self.folderName, env_line, self.conanfile_directory)) self.run("cd %s && %s make" % (self.folderName, env_line)) self.run("cd %s && %s make install " % (self.folderName, env_line))
def build(self): env = ConfigureEnvironment(self) configure_opts = "--prefix={} --enable-static --enable-shared --enable-far --enable-ngram-fsts LIBS=\"-ldl\"".format( self.package_folder) self.run("{} {}/{}/configure {}".format(env.command_line_env, self.conanfile_directory, self.unzipped_path, configure_opts)) self.run("{} make -j{} install ".format(env.command_line_env, cpu_count()))
def build(self): self.build_path = path.abspath("build") env = ConfigureEnvironment(self) cmd = "waf configure build -o %s" % (self.build_path) self.output.info("ENV:\n{}".format(env.command_line_env)) self.output.info(cmd) self.run("{} {}".format(env.command_line_env, cmd), cwd=self.conanfile_directory)
def build(self): #waf = os.path.join(".", 'waf') opts = self.get_options() self.build_path = path.abspath("build") env = ConfigureEnvironment(self) cmd = "%s waf configure build %s -o %s" % (env.command_line_env, opts, self.build_path) #self.run('%s configure build %s' % (waf, opts), cwd = self.conanfile_directory) self.run(cmd, cwd=self.conanfile_directory)
def build_with_make(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') else: env_line = env.command_line env_line = env.command_line.replace('LDFLAGS="', 'LDFLAGS="-Wl,--no-as-needed ') custom_vars = '' # Original: 'LIBPNG_LIBS= SDL_LIBS= LIBPNG_CFLAGS=' TODO SDL_VERSION sdl2_config_path = os.path.join( self.deps_cpp_info["SDL2"].lib_paths[0], "sdl2-config") self.run("cd %s" % self.folder) self.run("chmod a+x %s/configure" % self.folder) self.run("chmod a+x %s" % sdl2_config_path) configure_args = [ "--disable-music-cmd", "--disable-music-mod-modplug", "--disable_music_mod_mikmod", "--disable-music-midi", # Stuff we give a shit about "--disable-music-ogg", "--disable-music-flac", "--disable-music-mp3", # Stuff we declare broken atm "--disable_sdltest", "--disable_smpegtest", "" ] # We disable all manual tests self.output.warn(env_line) if self.settings.os == "Macos": # Fix rpath, we want empty rpaths, just pointing to lib file old_str = "-install_name \$rpath/" new_str = "-install_name " replace_in_file("%s/configure" % self.folder, old_str, new_str) configure_command = 'cd %s && %s SDL2_CONFIG=%s %s ./configure %s' % ( self.folder, env_line, sdl2_config_path, custom_vars, " ".join(configure_args)) self.output.warn("Configure with: %s" % configure_command) self.run(configure_command) old_str = '\n# Commented by conan: CFLAGS =' fpic = "-fPIC" if self.options.fPIC else "" m32 = "-m32" if self.settings.arch == "x86" else "" debug = "-g" if self.settings.build_type == "Debug" else "-s -DNDEBUG" new_str = '\nCFLAGS =%s %s %s %s\n# Commented by conan: CFLAGS =' % ( " ".join(self.deps_cpp_info.cflags), fpic, m32, debug) replace_in_file("%s/Makefile" % self.folder, old_str, new_str) self.run("cd %s && %s make" % (self.folder, env_line))
def build(self): static = "--enable-shared=yes --enable-static=yes --with-postgresql=no --with-mysql=no --with-python=no --with-ruby=no --with-java=no" if self.options.static else "" quickfix_folder = "quickfix-v.%s" % self.version env = ConfigureEnvironment(self.deps_cpp_info, self.settings) #self.run('cd %s %s %s' % (self.quickfix_folder, cmake.command_line, static)) self.run('cd %s && %s && sh ./bootstrap' % (quickfix_folder, env.command_line_env)) self.run('cd %s/spec && sh ./generate_c++.sh' % quickfix_folder) self.run('cd %s && %s && sh ./configure %s' % (quickfix_folder, env.command_line_env, static)) self.run('cd %s && %s && make' % (quickfix_folder, env.command_line_env))
def build(self): if self.settings.os == "Linux" or self.settings.os == "Macos": env = ConfigureEnvironment(self.deps_cpp_info, self.settings) env_line = env.command_line_env.replace('CFLAGS="', 'CFLAGS="-fPIC ') # if self.settings.os == "Macos": # old_str = '-install_name $libdir/$SHAREDLIBM' # new_str = '-install_name $SHAREDLIBM' # replace_in_file("./%s/configure" % self.ZIP_FOLDER_NAME, old_str, new_str) # print(env_line) self.run("cd %s && %s ./configure --with-pic" % (self.zipped_folder, env_line)) self.run("cd %s && %s make" % (self.zipped_folder, env_line))
def build_with_configure(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) command_env = env.command_line_env xml_config = self.normalize_prefix_path( self.deps_cpp_info["libxml2"].rootpath) + "/bin/xml2-config" if os_info.is_windows: command_env += " &&" command_env += ' set "XML_CONFIG=%s" &&' % xml_config else: command_env += ' XML_CONFIG="%s"' % xml_config self.run("%s sh %s/configure --prefix=%s %s" % (command_env, self.src_dir, self.normalize_prefix_path( self.package_folder), self.configure_options)) self.run("%s make -j %s" % (command_env, cpu_count())) self.run("%s make install" % command_env)
def build(self): """ Define your project building. You decide the way of building it to reuse it later in any other project. """ env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.settings.os == "Linux" or self.settings.os == "Macos": if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') else: env_line = env.command_line if self.settings.os == "Macos": old_str = '-install_name \$rpath/\$soname' new_str = '-install_name \$soname' replace_in_file("./%s/configure" % self.ZIP_FOLDER_NAME, old_str, new_str) configure = "cd %s && %s ./configure" % (self.ZIP_FOLDER_NAME, env_line) self.output.warn(configure) self.run(configure) self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env_line)) else: conan_magic_lines = '''project(libpng) cmake_minimum_required(VERSION 3.0) include(../conanbuildinfo.cmake) CONAN_BASIC_SETUP() ''' replace_in_file("%s/CMakeLists.txt" % self.ZIP_FOLDER_NAME, "cmake_minimum_required(VERSION 2.8.3)", conan_magic_lines) replace_in_file("%s/CMakeLists.txt" % self.ZIP_FOLDER_NAME, "project(libpng C)", "") cmake = CMake(self.settings) shared_options = "-DPNG_SHARED=ON -DPNG_STATIC=OFF" if self.options.shared else "-DPNG_SHARED=OFF -DPNG_STATIC=ON" self.run("cd %s && mkdir _build" % self.ZIP_FOLDER_NAME) cd_build = "cd %s/_build" % self.ZIP_FOLDER_NAME self.run('%s && cmake .. %s %s' % (cd_build, cmake.command_line, shared_options)) self.run("%s && cmake --build . %s" % (cd_build, cmake.build_config))
def build(self): """ Define your project building. You decide the way of building it to reuse it later in any other project. """ if self.settings.os == "Linux" or self.settings.os == "Macos": env = ConfigureEnvironment(self.deps_cpp_info, self.settings) env_line = env.command_line_env.replace('CFLAGS="', 'CFLAGS="-fPIC ') if self.settings.arch == "x86" or self.settings.arch == "x86_64": env_line = env_line.replace('CFLAGS="', 'CFLAGS="-mstackrealign ') self.output.warn(env_line) if self.settings.os == "Macos": old_str = '-install_name $libdir/$SHAREDLIBM' new_str = '-install_name $SHAREDLIBM' replace_in_file("./%s/configure" % self.ZIP_FOLDER_NAME, old_str, new_str) self.run("cd %s && %s ./configure" % (self.ZIP_FOLDER_NAME, env_line)) #self.run("cd %s && %s make check" % (self.ZIP_FOLDER_NAME, env.command_line_env)) self.run("cd %s && %s make" % (self.ZIP_FOLDER_NAME, env_line)) else: cmake = CMake(self.settings) if self.settings.os == "Windows": self.run("IF not exist _build mkdir _build") else: self.run("mkdir _build") cd_build = "cd _build" self.output.warn('%s && cmake .. %s' % (cd_build, cmake.command_line)) self.run('%s && cmake .. %s' % (cd_build, cmake.command_line)) self.output.warn("%s && cmake --build . %s" % (cd_build, cmake.build_config)) self.run("%s && cmake --build . %s" % (cd_build, cmake.build_config))
def package(self): env = ConfigureEnvironment(self) # Install your project files on destination (package_folder) self.run("{} waf install".format(env.command_line_env))
def build(self): env = ConfigureEnvironment(self) self.run("cd coin-clp && {} ./configure".format(env.command_line_env)) self.run("cd coin-clp && {} make".format(env.command_line_env)) self.run("cd coin-clp && {} make".format(env.command_line_env)) self.run("cd coin-clp && make install DESTDIR=`pwd`/tmp")
def build_with_make(self): env = ConfigureEnvironment(self.deps_cpp_info, self.settings) if self.options.fPIC: env_line = env.command_line.replace('CFLAGS="', 'CFLAGS="-fPIC ') else: env_line = env.command_line custom_vars = 'LIBPNG_LIBS= SDL_LIBS= LIBPNG_CFLAGS=' sdl2_config_path = os.path.join( self.deps_cpp_info["SDL2"].lib_paths[0], "sdl2-config") self.run("cd %s" % self.folder) self.run("chmod a+x %s/configure" % self.folder) self.run("chmod a+x %s" % sdl2_config_path) self.output.warn(env_line) if self.settings.os == "Macos": # Fix rpath, we want empty rpaths, just pointing to lib file old_str = "-install_name \$rpath/" new_str = "-install_name " replace_in_file("%s/configure" % self.folder, old_str, new_str) old_str = '#define LOAD_PNG_DYNAMIC "$png_lib"' new_str = '' replace_in_file("%s/configure" % self.folder, old_str, new_str) old_str = '#define LOAD_JPG_DYNAMIC "$jpg_lib"' new_str = '' replace_in_file("%s/configure" % self.folder, old_str, new_str) configure_command = 'cd %s && %s SDL2_CONFIG=%s %s ./configure' % ( self.folder, env_line, sdl2_config_path, custom_vars) self.output.warn("Configure with: %s" % configure_command) self.run(configure_command) old_str = 'DEFS = ' new_str = 'DEFS = -DLOAD_JPG=1 -DLOAD_PNG=1 ' # Trust conaaaan! replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nLIBS = ' new_str = '\n# Removed by conan: LIBS2 = ' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nLIBTOOL = ' new_str = '\nLIBS = %s \nLIBTOOL = ' % " ".join( ["-l%s" % lib for lib in self.deps_cpp_info.libs]) # Trust conaaaan! replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nLIBPNG_CFLAGS =' new_str = '\n# Commented by conan: LIBPNG_CFLAGS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nLIBPNG_LIBS =' new_str = '\n# Commented by conan: LIBPNG_LIBS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nOBJCFLAGS' new_str = '\n# Commented by conan: OBJCFLAGS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nSDL_CFLAGS =' new_str = '\n# Commented by conan: SDL_CFLAGS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nSDL_LIBS =' new_str = '\n# Commented by conan: SDL_LIBS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\nCFLAGS =' new_str = '\n# Commented by conan: CFLAGS =' replace_in_file("%s/Makefile" % self.folder, old_str, new_str) old_str = '\n# Commented by conan: CFLAGS =' fpic = "-fPIC" if self.options.fPIC else "" m32 = "-m32" if self.settings.arch == "x86" else "" debug = "-g" if self.settings.build_type == "Debug" else "-s -DNDEBUG" new_str = '\nCFLAGS =%s %s %s %s\n# Commented by conan: CFLAGS =' % ( " ".join(self.deps_cpp_info.cflags), fpic, m32, debug) replace_in_file("%s/Makefile" % self.folder, old_str, new_str) self.run("cd %s && %s make" % (self.folder, env_line))
def build(self): if self.settings.os == "Windows": cmake = CMake(self.settings) args = [ '-DBUILD_SHARED_LIBS=%s' % ('ON' if self.options.shared else 'OFF') ] args += ['-DCMAKE_INSTALL_PREFIX=.'] self.run( 'cd %s && cmake . %s %s ' % (self.ZIP_FOLDER_NAME, ' '.join(args), cmake.command_line)) self.run('cd %s && cmake --build . --target INSTALL %s' % (self.ZIP_FOLDER_NAME, cmake.build_config)) else: prefix = os.path.join(os.getcwd(), self.ZIP_FOLDER_NAME) concurrency = 1 try: import multiprocessing concurrency = multiprocessing.cpu_count() except (ImportError, NotImplementedError): pass base_args = [ '--disable-fortran', '--disable-dependency-tracking', '--enable-threads', '--prefix=%s' % prefix ] if self.options.shared: base_args += ['--enable-shared', '--disable-static'] else: base_args += ['--disable-shared', '--enable-static'] if self.settings.build_type == 'Release': base_args += ['--disable-debug'] else: base_args += ['--enable-debug'] env = ConfigureEnvironment(self.deps_cpp_info, self.settings) precision_option = { 'single': '--enable-single', 'double': '', 'long double': '--enable-long-double' } suffix = {'single': 'f', 'double': '', 'long double': 'l'} for precision in ['single', 'double', 'long double']: args = base_args + [precision_option[precision]] self.run( 'cd %s && %s ./configure %s' % (self.ZIP_FOLDER_NAME, env.command_line, ' '.join(args))) self.run('cd %s && make -j %s' % (self.ZIP_FOLDER_NAME, concurrency)) self.run('cd %s && make install' % self.ZIP_FOLDER_NAME) # Copy 'tests/bench' (or 'tests/.libs/bench') to 'bin/bench{,f,l}' bench_name = 'bench%s' % suffix[precision] bench_dest = os.path.join(self.ZIP_FOLDER_NAME, 'bin', bench_name) bench = os.path.join(self.ZIP_FOLDER_NAME, 'tests', '.libs', 'bench') if not os.path.isfile(bench): bench = os.path.join(self.ZIP_FOLDER_NAME, 'tests', 'bench') shutil.copyfile(bench, bench_dest) self.run('cd %s && make clean' % self.ZIP_FOLDER_NAME) self.run('cd %s && chmod +x bin/bench*' % self.ZIP_FOLDER_NAME) for binary in glob('%s/bin/*' % prefix) + glob( '%s/lib/*.dylib' % prefix): if os.path.islink(binary): continue self._change_dylib_names(binary, prefix)