public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Rust: New package.
@ 2019-09-02 12:44 Stefan Schantl
  2019-09-02 12:44 ` [PATCH 2/2] suricata: Update to 4.1.4 Stefan Schantl
  2019-09-02 13:16 ` [PATCH 1/2] Rust: New package Stefan Schantl
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Schantl @ 2019-09-02 12:44 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 5788 bytes --]

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 rust/rust.nm | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 175 insertions(+)
 create mode 100644 rust/rust.nm

diff --git a/rust/rust.nm b/rust/rust.nm
new file mode 100644
index 000000000..96f198f85
--- /dev/null
+++ b/rust/rust.nm
@@ -0,0 +1,175 @@
+###############################################################################
+# IPFire.org    - An Open Source Firewall Solution                            #
+# Copyright (C) - IPFire Development Team <info(a)ipfire.org>                   #
+###############################################################################
+
+name       = rust
+version    = 1.37.0
+release    = 1
+
+groups     = Applications/System
+url        = https://www.rust-lang.org/
+license    = 
+summary    = A language empowering everyone to build reliable and efficient software.
+
+description
+	
+end
+
+source_dl  = https://static.rust-lang.org/dist/
+sources    = rustc-%{version}-src.tar.gz
+
+# For building rustc a bootstrapped rust toolchain has to be downloaded and used.
+if %{DISTRO_ARCH} == "armv7hl"
+	rust_bootstrap = armv7-unknown-linux-gnueabihf
+elif %{DISTRO_ARCH} == "armv5tel"
+	rust_bootstrap = arm-unknown-linux-gnueabi
+else
+	rust_bootstrap = %{DISTRO_ARCH}-unknown-linux-gnu
+end
+
+sources += rust-%{version}-%{rust_bootstrap}.tar.gz
+
+build
+	requires
+		/usr/bin/llvm-config
+		/usr/bin/FileCheck
+		cmake
+		libcurl-devel >= 7.65.3
+		llvm
+		libffi-devel
+		libgit2-devel
+		libssh2-devel
+		openssl-devel
+		pakfire >= 0.9.27-3
+		python3
+		xz-devel
+		zlib-devel
+	end
+
+	local_rust_root = "/opt"
+	rustlibdir = "%{libdir}/rustlib"
+
+	DIR_APP = %{DIR_SRC}/rustc-%{version}-src
+	DIR_BOOTSTRAPPED = %{DIR_SRC}/rust-%{version}-%{rust_bootstrap}
+
+	configure_options +=\
+		--build=%{rust_bootstrap} \
+		--host=%{rust_bootstrap} \
+		--target=%{rust_bootstrap} \
+		--disable-option-checking \
+		--local-rust-root=%{local_rust_root} \
+		--llvm-root=%{prefix} \
+		--enable-llvm-link-shared \
+		--disable-rpath \
+		--enable-extended \
+		--enable-vendor \
+		--release-channel="stable"
+
+	prepare_cmds
+		# Install precompiled rust toolchain.
+		cd %{DIR_BOOTSTRAPPED}
+
+		./install.sh --components=cargo,rustc,rust-std-%{rust_bootstrap} \
+		--prefix=%{local_rust_root} --disable-ldconfig
+
+		# Test if the bootstrapped tools correctly have been installed.	
+		test -f %{local_rust_root}/bin/cargo
+		test -f %{local_rust_root}/bin/rustc
+	end
+
+	build
+		# Change into main rust source directory.
+		cd %{DIR_APP}
+
+		# Do not build with shipped llvm and llvm-emscripten.
+		rm -rf src/llvm-project/
+		rm -rf src/llvm-emscripten/
+
+		# Remove other unused vendored libraries
+		rm -rf vendor/curl-sys/curl/
+		rm -rf vendor/jemalloc-sys/jemalloc/
+		rm -rf vendor/libz-sys/src/zlib/
+		rm -rf vendor/lzma-sys/xz-*/
+		rm -rf vendor/openssl-src/openssl/
+
+		# Use the distro libgit2
+		export LIBGIT2_SYS_USE_PKG_CONFIG=1
+		rm -rf vendor/libgit2-sys/libgit2/
+
+		# Use the distro libssh2
+		export LIBSSH2_SYS_USE_PKG_CONFIG=1
+		rm -rf vendor/libssh2-sys/libssh2/
+
+		# Use the dynamic xz-libs
+		sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
+
+		# The configure macro will modify some autoconf-related files, which upsets
+		# cargo when it tries to verify checksums in those files.  If we just truncate
+		# that file list, cargo won't have anything to complain about.
+		find vendor -name .cargo-checksum.json \
+			-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
+
+		# Launch configure script
+		./configure %{configure_options}
+
+		# Build rust.
+		%{python3} ./x.py build --exclude src/tools/miri
+	end
+
+	install
+		DESTDIR=%{BUILDROOT} %{python3} ./x.py install
+
+		# The shared libraries should be executable for debuginfo extraction.
+		find %{BUILDROOT}%{libdir} -maxdepth 1 -type f -name '*.so' -exec chmod -v +x '{}' '+'
+	
+		# The libdir libraries are identical to those under rustlib/.  It's easier on
+		# library loading if we keep them in libdir, but we do need them in rustlib/
+		# to support dynamic linking for compiler plugins, so we'll symlink.
+		(
+			cd %{BUILDROOT}%{rustlibdir}/%{rust_bootstrap}/lib
+
+			for i in *.so; do
+				[ -f %{BUILDROOT}%{rustlibdir}/%{rust_bootstrap}/lib/${i} ] && ln -svf ../../../${i} \
+					%{BUILDROOT}%{rustlibdir}/%{rust_bootstrap}/lib/${i};
+			done
+		)
+	
+		# Remove installer artifacts (manifests, uninstall scripts, etc.)
+		find %{BUILDROOT}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+'
+	
+		# Remove backup files from %%configure munging
+		find %{BUILDROOT}%{rustlibdir} -type f -name '*.orig' -exec rm -v '{}' '+'
+
+		# Remove documentation files.
+		rm -rvf %{BUILDROOT}%{docdir}%{name}
+
+		# Remove rust source.
+		rm -rvf %{BUILDROOT}%{rustlibdir}/src
+
+		# Create the path for crate-devel packages
+		mkdir -pv %{BUILDROOT}%{datadir}/cargo/registry
+
+		# Remove zsh related files.
+		rm -rvf %{BUILDROOT}%{datadir}/zsh/
+	end
+
+
+	# While we don't want to encourage dynamic linking to Rust shared libraries, as
+	# there's no stable ABI, we still need the unallocated metadata (.rustc) to
+	# support custom-derive plugins like #[proc_macro_derive(Foo)].  But eu-strip is
+	# very eager by default, so it has to be limited to keep the rustc sections.
+	debuginfo_options = --keep-section .rustc
+end
+
+packages
+	package %{name}
+		provides += \
+			bundled(libbacktrace) = 8.1.0 \
+			bundled(miniz) = 2.0.7
+	end
+
+	package %{name}-debuginfo
+		template DEBUGINFO
+	end
+end
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] suricata: Update to 4.1.4
  2019-09-02 12:44 [PATCH 1/2] Rust: New package Stefan Schantl
@ 2019-09-02 12:44 ` Stefan Schantl
  2019-09-02 13:16 ` [PATCH 1/2] Rust: New package Stefan Schantl
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Schantl @ 2019-09-02 12:44 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

* Enable JSON support.
* Enable rust support.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 suricata/suricata.nm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/suricata/suricata.nm b/suricata/suricata.nm
index 4825612e2..c17f75d7d 100644
--- a/suricata/suricata.nm
+++ b/suricata/suricata.nm
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = suricata
-version    = 4.0.6
-release    = 3
+version    = 4.1.4
+release    = 1
 
 groups     = Networking/IDS
 url        = http://www.openinfosecfoundation.org/
@@ -24,6 +24,7 @@ build
 	requires
 		file-devel
 		libcap-ng-devel
+		libjansson-devel
 		libnfnetlink-devel
 		libnetfilter_queue-devel
 		libnet-devel
@@ -32,12 +33,14 @@ build
 		libhtp-devel >= 0.5.20
 		pcre-devel
 		pkg-config
+		rust
 		zlib-devel >= 1.2.5-2
 	end
 
 	configure_options += \
 		--enable-gccprotect \
 		--enable-nfqueue \
+		--enable-rust \
 		--disable-gccmarch-native \
 		--disable-static \
 		--enable-non-bundled-htp \
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Rust: New package.
  2019-09-02 12:44 [PATCH 1/2] Rust: New package Stefan Schantl
  2019-09-02 12:44 ` [PATCH 2/2] suricata: Update to 4.1.4 Stefan Schantl
@ 2019-09-02 13:16 ` Stefan Schantl
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Schantl @ 2019-09-02 13:16 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 6111 bytes --]

This rust patch is broken.

Please use the PATCHv2 one.

Thanks in advance,

-Stefan
> Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
> ---
>  rust/rust.nm | 175
> +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 175 insertions(+)
>  create mode 100644 rust/rust.nm
> 
> diff --git a/rust/rust.nm b/rust/rust.nm
> new file mode 100644
> index 000000000..96f198f85
> --- /dev/null
> +++ b/rust/rust.nm
> @@ -0,0 +1,175 @@
> +####################################################################
> ###########
> +# IPFire.org    - An Open Source Firewall
> Solution                            #
> +# Copyright (C) - IPFire Development Team <info(a)ipfire.org>         
>           #
> +####################################################################
> ###########
> +
> +name       = rust
> +version    = 1.37.0
> +release    = 1
> +
> +groups     = Applications/System
> +url        = https://www.rust-lang.org/
> +license    = 
> +summary    = A language empowering everyone to build reliable and
> efficient software.
> +
> +description
> +	
> +end
> +
> +source_dl  = https://static.rust-lang.org/dist/
> +sources    = rustc-%{version}-src.tar.gz
> +
> +# For building rustc a bootstrapped rust toolchain has to be
> downloaded and used.
> +if %{DISTRO_ARCH} == "armv7hl"
> +	rust_bootstrap = armv7-unknown-linux-gnueabihf
> +elif %{DISTRO_ARCH} == "armv5tel"
> +	rust_bootstrap = arm-unknown-linux-gnueabi
> +else
> +	rust_bootstrap = %{DISTRO_ARCH}-unknown-linux-gnu
> +end
> +
> +sources += rust-%{version}-%{rust_bootstrap}.tar.gz
> +
> +build
> +	requires
> +		/usr/bin/llvm-config
> +		/usr/bin/FileCheck
> +		cmake
> +		libcurl-devel >= 7.65.3
> +		llvm
> +		libffi-devel
> +		libgit2-devel
> +		libssh2-devel
> +		openssl-devel
> +		pakfire >= 0.9.27-3
> +		python3
> +		xz-devel
> +		zlib-devel
> +	end
> +
> +	local_rust_root = "/opt"
> +	rustlibdir = "%{libdir}/rustlib"
> +
> +	DIR_APP = %{DIR_SRC}/rustc-%{version}-src
> +	DIR_BOOTSTRAPPED = %{DIR_SRC}/rust-%{version}-%{rust_bootstrap}
> +
> +	configure_options +=\
> +		--build=%{rust_bootstrap} \
> +		--host=%{rust_bootstrap} \
> +		--target=%{rust_bootstrap} \
> +		--disable-option-checking \
> +		--local-rust-root=%{local_rust_root} \
> +		--llvm-root=%{prefix} \
> +		--enable-llvm-link-shared \
> +		--disable-rpath \
> +		--enable-extended \
> +		--enable-vendor \
> +		--release-channel="stable"
> +
> +	prepare_cmds
> +		# Install precompiled rust toolchain.
> +		cd %{DIR_BOOTSTRAPPED}
> +
> +		./install.sh --components=cargo,rustc,rust-std-
> %{rust_bootstrap} \
> +		--prefix=%{local_rust_root} --disable-ldconfig
> +
> +		# Test if the bootstrapped tools correctly have been
> installed.	
> +		test -f %{local_rust_root}/bin/cargo
> +		test -f %{local_rust_root}/bin/rustc
> +	end
> +
> +	build
> +		# Change into main rust source directory.
> +		cd %{DIR_APP}
> +
> +		# Do not build with shipped llvm and llvm-emscripten.
> +		rm -rf src/llvm-project/
> +		rm -rf src/llvm-emscripten/
> +
> +		# Remove other unused vendored libraries
> +		rm -rf vendor/curl-sys/curl/
> +		rm -rf vendor/jemalloc-sys/jemalloc/
> +		rm -rf vendor/libz-sys/src/zlib/
> +		rm -rf vendor/lzma-sys/xz-*/
> +		rm -rf vendor/openssl-src/openssl/
> +
> +		# Use the distro libgit2
> +		export LIBGIT2_SYS_USE_PKG_CONFIG=1
> +		rm -rf vendor/libgit2-sys/libgit2/
> +
> +		# Use the distro libssh2
> +		export LIBSSH2_SYS_USE_PKG_CONFIG=1
> +		rm -rf vendor/libssh2-sys/libssh2/
> +
> +		# Use the dynamic xz-libs
> +		sed -i.lzma -e '/LZMA_API_STATIC/d'
> src/bootstrap/tool.rs
> +
> +		# The configure macro will modify some autoconf-related 
> files, which upsets
> +		# cargo when it tries to verify checksums in those
> files.  If we just truncate
> +		# that file list, cargo won't have anything to complain
> about.
> +		find vendor -name .cargo-checksum.json \
> +			-exec sed -i.uncheck -e
> 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
> +
> +		# Launch configure script
> +		./configure %{configure_options}
> +
> +		# Build rust.
> +		%{python3} ./x.py build --exclude src/tools/miri
> +	end
> +
> +	install
> +		DESTDIR=%{BUILDROOT} %{python3} ./x.py install
> +
> +		# The shared libraries should be executable for
> debuginfo extraction.
> +		find %{BUILDROOT}%{libdir} -maxdepth 1 -type f -name
> '*.so' -exec chmod -v +x '{}' '+'
> +	
> +		# The libdir libraries are identical to those under
> rustlib/.  It's easier on
> +		# library loading if we keep them in libdir, but we do
> need them in rustlib/
> +		# to support dynamic linking for compiler plugins, so
> we'll symlink.
> +		(
> +			cd
> %{BUILDROOT}%{rustlibdir}/%{rust_bootstrap}/lib
> +
> +			for i in *.so; do
> +				[ -f
> %{BUILDROOT}%{rustlibdir}/%{rust_bootstrap}/lib/${i} ] && ln -svf
> ../../../${i} \
> +					%{BUILDROOT}%{rustlibdir}/%{rus
> t_bootstrap}/lib/${i};
> +			done
> +		)
> +	
> +		# Remove installer artifacts (manifests, uninstall
> scripts, etc.)
> +		find %{BUILDROOT}%{rustlibdir} -maxdepth 1 -type f
> -exec rm -v '{}' '+'
> +	
> +		# Remove backup files from %%configure munging
> +		find %{BUILDROOT}%{rustlibdir} -type f -name '*.orig'
> -exec rm -v '{}' '+'
> +
> +		# Remove documentation files.
> +		rm -rvf %{BUILDROOT}%{docdir}%{name}
> +
> +		# Remove rust source.
> +		rm -rvf %{BUILDROOT}%{rustlibdir}/src
> +
> +		# Create the path for crate-devel packages
> +		mkdir -pv %{BUILDROOT}%{datadir}/cargo/registry
> +
> +		# Remove zsh related files.
> +		rm -rvf %{BUILDROOT}%{datadir}/zsh/
> +	end
> +
> +
> +	# While we don't want to encourage dynamic linking to Rust
> shared libraries, as
> +	# there's no stable ABI, we still need the unallocated metadata
> (.rustc) to
> +	# support custom-derive plugins like
> #[proc_macro_derive(Foo)].  But eu-strip is
> +	# very eager by default, so it has to be limited to keep the
> rustc sections.
> +	debuginfo_options = --keep-section .rustc
> +end
> +
> +packages
> +	package %{name}
> +		provides += \
> +			bundled(libbacktrace) = 8.1.0 \
> +			bundled(miniz) = 2.0.7
> +	end
> +
> +	package %{name}-debuginfo
> +		template DEBUGINFO
> +	end
> +end

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-02 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 12:44 [PATCH 1/2] Rust: New package Stefan Schantl
2019-09-02 12:44 ` [PATCH 2/2] suricata: Update to 4.1.4 Stefan Schantl
2019-09-02 13:16 ` [PATCH 1/2] Rust: New package Stefan Schantl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox