[DO-978] openssl package (!8)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/8
This commit is contained in:
21
recipes/nasm/all/conandata.yml
Normal file
21
recipes/nasm/all/conandata.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
sources:
|
||||
"2.16.01":
|
||||
sha256: "c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558"
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-nasm-us/pub/nasm/releasebuilds/2.16.01/nasm-2.16.01.tar.xz"
|
||||
"2.15.05":
|
||||
sha256: "3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f"
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-nasm-us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.xz"
|
||||
"2.14":
|
||||
sha256: "97c615dbf02ef80e4e2b6c385f7e28368d51efc214daa98e600ca4572500eec0"
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-nasm-us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.xz"
|
||||
"2.13.02":
|
||||
sha256: "8ac3235f49a6838ff7a8d7ef7c19a4430d0deecc0c2d3e3e237b5e9f53291757"
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-nasm-us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.xz"
|
||||
"2.13.01":
|
||||
sha256: "aa0213008f0433ecbe07bb628506a5c4be8079be20fc3532a5031fd639db9a5e"
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-nasm-us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz"
|
||||
patches:
|
||||
"2.16.01":
|
||||
- patch_file: "patches/2.16.01-0001-disable-newly-integrated-dependency-tracking.patch"
|
||||
"2.15.05":
|
||||
- patch_file: "patches/2.15.05-0001-disable-newly-integrated-dependency-tracking.patch"
|
||||
130
recipes/nasm/all/conanfile.py
Normal file
130
recipes/nasm/all/conanfile.py
Normal file
@@ -0,0 +1,130 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.env import VirtualBuildEnv
|
||||
from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rmdir
|
||||
from conan.tools.gnu import Autotools, AutotoolsToolchain
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.microsoft import NMakeToolchain, is_msvc
|
||||
import os
|
||||
import shutil
|
||||
|
||||
required_conan_version = ">=1.55.0"
|
||||
|
||||
|
||||
class NASMConan(ConanFile):
|
||||
name = "nasm"
|
||||
package_type = "application"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "http://www.nasm.us"
|
||||
description = "The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler"
|
||||
license = "BSD-2-Clause"
|
||||
topics = ("asm", "installer", "assembler",)
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
|
||||
@property
|
||||
def _settings_build(self):
|
||||
return getattr(self, "settings_build", self.settings)
|
||||
|
||||
@property
|
||||
def _nasm(self):
|
||||
suffix = "w.exe" if is_msvc(self) else ""
|
||||
return os.path.join(self.package_folder, "bin", f"nasm{suffix}")
|
||||
|
||||
@property
|
||||
def _ndisasm(self):
|
||||
suffix = "w.exe" if is_msvc(self) else ""
|
||||
return os.path.join(self.package_folder, "bin", f"ndisasm{suffix}")
|
||||
|
||||
def _chmod_plus_x(self, filename):
|
||||
if os.name == "posix":
|
||||
os.chmod(filename, os.stat(filename).st_mode | 0o111)
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def configure(self):
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
|
||||
def layout(self):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def package_id(self):
|
||||
del self.info.settings.compiler
|
||||
|
||||
def build_requirements(self):
|
||||
if self._settings_build.os == "Windows":
|
||||
self.tool_requires("strawberryperl/5.32.1.1")
|
||||
if not is_msvc(self):
|
||||
self.win_bash = True
|
||||
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
|
||||
self.tool_requires("msys2/cci.latest")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
env = VirtualBuildEnv(self)
|
||||
env.generate()
|
||||
if is_msvc(self):
|
||||
tc = NMakeToolchain(self)
|
||||
tc.generate()
|
||||
else:
|
||||
tc = AutotoolsToolchain(self)
|
||||
if self.settings.arch == "x86":
|
||||
tc.extra_cflags.append("-m32")
|
||||
elif self.settings.arch == "x86_64":
|
||||
tc.extra_cflags.append("-m64")
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
if is_msvc(self):
|
||||
with chdir(self, self.source_folder):
|
||||
self.run(f'nmake /f {os.path.join("Mkfiles", "msvc.mak")}')
|
||||
else:
|
||||
with chdir(self, self.source_folder):
|
||||
autotools = Autotools(self)
|
||||
autotools.configure()
|
||||
|
||||
# GCC9 - "pure" attribute on function returning "void"
|
||||
replace_in_file(self, "Makefile", "-Werror=attributes", "")
|
||||
|
||||
# Need "-arch" flag for the linker when cross-compiling.
|
||||
# FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration
|
||||
# TODO it is time to revisit, not sure what to do here though...
|
||||
if str(self.version).startswith("2.13"):
|
||||
replace_in_file(self, "Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o")
|
||||
replace_in_file(self, "Makefile", "$(INSTALLROOT)", "$(DESTDIR)")
|
||||
autotools.make()
|
||||
|
||||
def package(self):
|
||||
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||
if is_msvc(self):
|
||||
copy(self, pattern="*.exe", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False)
|
||||
with chdir(self, os.path.join(self.package_folder, "bin")):
|
||||
shutil.copy2("nasm.exe", "nasmw.exe")
|
||||
shutil.copy2("ndisasm.exe", "ndisasmw.exe")
|
||||
else:
|
||||
with chdir(self, self.source_folder):
|
||||
autotools = Autotools(self)
|
||||
autotools.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
self._chmod_plus_x(self._nasm)
|
||||
self._chmod_plus_x(self._ndisasm)
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libdirs = []
|
||||
self.cpp_info.includedirs = []
|
||||
|
||||
compiler_executables = {"asm": self._nasm}
|
||||
self.conf_info.update("tools.build:compiler_executables", compiler_executables)
|
||||
self.buildenv_info.define_path("NASM", self._nasm)
|
||||
self.buildenv_info.define_path("NDISASM", self._ndisasm)
|
||||
self.buildenv_info.define_path("AS", self._nasm)
|
||||
|
||||
# TODO: Legacy, to be removed on Conan 2.0
|
||||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
|
||||
self.env_info.NASM = self._nasm
|
||||
self.env_info.NDISASM = self._ndisasm
|
||||
self.env_info.AS = self._nasm
|
||||
@@ -0,0 +1,34 @@
|
||||
--- Mkfiles/msvc.mak
|
||||
+++ Mkfiles/msvc.mak
|
||||
@@ -218,7 +218,7 @@
|
||||
x86\regs.h: x86\regs.dat x86\regs.pl
|
||||
$(RUNPERL) $(srcdir)\x86\regs.pl h \
|
||||
$(srcdir)\x86\regs.dat > x86\regs.h
|
||||
-
|
||||
+!IF 0
|
||||
# Extract warnings from source code. This is done automatically if any
|
||||
# C files have changed; the script is fast enough that that is
|
||||
# reasonable, but doesn't update the time stamp if the files aren't
|
||||
@@ -242,7 +242,7 @@ include\warnings.h: asm\warnings.pl asm\warnings.time
|
||||
|
||||
doc\warnings.src: asm\warnings.pl asm\warnings.time
|
||||
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src $(srcdir)
|
||||
-
|
||||
+!ENDIF
|
||||
# Assembler token hash
|
||||
asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl \
|
||||
perllib\phash.ph
|
||||
@@ -426,7 +426,7 @@
|
||||
# @exclude: "config/config.h"
|
||||
# @external: "msvc.dep"
|
||||
# @selfrule: "1"
|
||||
-#-- Everything below is generated by mkdep.pl - do not edit --#
|
||||
+!IF 0
|
||||
asm\assemble.$(O): asm\assemble.c asm\assemble.h asm\directiv.h \
|
||||
asm\listing.h asm\pptok.h asm\preproc.h asm\srcfile.h asm\tokens.h \
|
||||
config\msvc.h config\unconfig.h config\unknown.h config\watcom.h \
|
||||
@@ -935,3 +935,4 @@
|
||||
x86\regvals.$(O): x86\regvals.c config\msvc.h config\unconfig.h \
|
||||
config\unknown.h config\watcom.h include\compiler.h include\nasmint.h \
|
||||
include\tables.h x86\insnsi.h
|
||||
+!ENDIF
|
||||
@@ -0,0 +1,34 @@
|
||||
--- Mkfiles/msvc.mak
|
||||
+++ Mkfiles/msvc.mak
|
||||
@@ -226,7 +226,7 @@
|
||||
x86\regs.h: x86\regs.dat x86\regs.pl
|
||||
$(RUNPERL) $(srcdir)\x86\regs.pl h \
|
||||
$(srcdir)\x86\regs.dat > x86\regs.h
|
||||
-
|
||||
+!IF 0
|
||||
# Extract warnings from source code. This is done automatically if any
|
||||
# C files have changed; the script is fast enough that that is
|
||||
# reasonable, but doesn't update the time stamp if the files aren't
|
||||
@@ -262,7 +262,7 @@
|
||||
|
||||
doc\warnings.src : doc\warnings.src.time
|
||||
@: Side effect
|
||||
-
|
||||
+!ENDIF
|
||||
# Assembler token hash
|
||||
asm\tokhash.c: x86\insns.dat x86\insnsn.c asm\tokens.dat asm\tokhash.pl \
|
||||
perllib\phash.ph
|
||||
@@ -402,7 +402,7 @@
|
||||
# @exclude: "config/config.h"
|
||||
# @external: "msvc.dep"
|
||||
# @selfrule: "1"
|
||||
-#-- Everything below is generated by mkdep.pl - do not edit --#
|
||||
+!IF 0
|
||||
asm\assemble.$(O): asm\assemble.c asm\assemble.h asm\directiv.h \
|
||||
asm\listing.h asm\pptok.h asm\preproc.h asm\srcfile.h asm\tokens.h \
|
||||
config\msvc.h config\unconfig.h config\unknown.h config\watcom.h \
|
||||
@@ -854,3 +854,4 @@
|
||||
x86\regvals.$(O): x86\regvals.c config\msvc.h config\unconfig.h \
|
||||
config\unknown.h config\watcom.h include\compiler.h include\nasmint.h \
|
||||
include\tables.h x86\insnsi.h
|
||||
+!ENDIF
|
||||
30
recipes/nasm/all/test_package/conanfile.py
Normal file
30
recipes/nasm/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "VirtualBuildEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires(self.tested_reference_str)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def test(self):
|
||||
self.run("nasm --version")
|
||||
asm_file = os.path.join(self.source_folder, "hello_linux.asm")
|
||||
out_file = os.path.join(self.build_folder, "hello_linux.o")
|
||||
self.run(f"nasm -felf64 {asm_file} -o {out_file}")
|
||||
if can_run(self):
|
||||
if self.settings.os == "Linux" and self.settings.arch == "x86_64":
|
||||
# TODO was tools.get_env, what should it be?
|
||||
ld = os.getenv("LD", "ld")
|
||||
bin_file = os.path.join(self.build_folder, "hello_linux")
|
||||
self.run(f"{ld} hello_linux.o -o {bin_file}")
|
||||
self.run(bin_file)
|
||||
16
recipes/nasm/all/test_package/hello_linux.asm
Normal file
16
recipes/nasm/all/test_package/hello_linux.asm
Normal file
@@ -0,0 +1,16 @@
|
||||
; Print "Hello, Conan"
|
||||
|
||||
global _start
|
||||
|
||||
section .text
|
||||
_start: mov rax, 1 ; system call for write
|
||||
mov rdi, 1 ; file handle 1 is stdout
|
||||
mov rsi, message ; address of string to output
|
||||
mov rdx, 13 ; number of bytes
|
||||
syscall ; invoke operating system to do the write
|
||||
mov rax, 60 ; system call for exit
|
||||
xor rdi, rdi ; exit code 0
|
||||
syscall ; invoke operating system to exit
|
||||
|
||||
section .data
|
||||
message: db "Hello, Conan", 10 ; note the newline at the end
|
||||
22
recipes/nasm/all/test_v1_package/conanfile.py
Normal file
22
recipes/nasm/all/test_v1_package/conanfile.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
from conans import ConanFile, tools
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
test_type = "explicit"
|
||||
|
||||
def build_requirements(self):
|
||||
self.build_requires(self.tested_reference_str)
|
||||
|
||||
def test(self):
|
||||
self.run("nasm --version")
|
||||
asm_file = os.path.join(self.source_folder, "hello_linux.asm")
|
||||
out_file = os.path.join(self.build_folder, "hello_linux.o")
|
||||
self.run(f"nasm -felf64 {asm_file} -o {out_file}")
|
||||
if not tools.cross_building(self):
|
||||
if self.settings.os == "Linux" and self.settings.arch == "x86_64":
|
||||
ld = tools.get_env("LD", "ld")
|
||||
bin_file = os.path.join(self.build_folder, "hello_linux")
|
||||
self.run(f"{ld} hello_linux.o -o {bin_file}")
|
||||
self.run(bin_file)
|
||||
16
recipes/nasm/all/test_v1_package/hello_linux.asm
Normal file
16
recipes/nasm/all/test_v1_package/hello_linux.asm
Normal file
@@ -0,0 +1,16 @@
|
||||
; Print "Hello, Conan"
|
||||
|
||||
global _start
|
||||
|
||||
section .text
|
||||
_start: mov rax, 1 ; system call for write
|
||||
mov rdi, 1 ; file handle 1 is stdout
|
||||
mov rsi, message ; address of string to output
|
||||
mov rdx, 13 ; number of bytes
|
||||
syscall ; invoke operating system to do the write
|
||||
mov rax, 60 ; system call for exit
|
||||
xor rdi, rdi ; exit code 0
|
||||
syscall ; invoke operating system to exit
|
||||
|
||||
section .data
|
||||
message: db "Hello, Conan", 10 ; note the newline at the end
|
||||
11
recipes/nasm/config.yml
Normal file
11
recipes/nasm/config.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
versions:
|
||||
"2.16.01":
|
||||
folder: all
|
||||
"2.15.05":
|
||||
folder: all
|
||||
"2.14":
|
||||
folder: all
|
||||
"2.13.02":
|
||||
folder: all
|
||||
"2.13.01":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user