From f3fe0032f29f536a443205fea1a1f35d2978def1 Mon Sep 17 00:00:00 2001 From: "B. Wilson" Date: Fri, 27 Sep 2019 17:41:02 +0900 Subject: [PATCH] New package: j-807 --- srcpkgs/j/INSTALL | 10 ++ srcpkgs/j/INSTALL.msg | 8 ++ srcpkgs/j/REMOVE | 3 + srcpkgs/j/files/profilex_template.ijs | 28 +++++ srcpkgs/j/patches/crossbuild-jconsole.patch | 11 ++ srcpkgs/j/patches/crossbuild-libj.patch | 61 +++++++++++ srcpkgs/j/template | 111 ++++++++++++++++++++ srcpkgs/j/update | 2 + 8 files changed, 234 insertions(+) create mode 100644 srcpkgs/j/INSTALL create mode 100644 srcpkgs/j/INSTALL.msg create mode 100644 srcpkgs/j/REMOVE create mode 100644 srcpkgs/j/files/profilex_template.ijs create mode 100644 srcpkgs/j/patches/crossbuild-jconsole.patch create mode 100644 srcpkgs/j/patches/crossbuild-libj.patch create mode 100644 srcpkgs/j/template create mode 100644 srcpkgs/j/update diff --git a/srcpkgs/j/INSTALL b/srcpkgs/j/INSTALL new file mode 100644 index 00000000000..0a8b6c61cd1 --- /dev/null +++ b/srcpkgs/j/INSTALL @@ -0,0 +1,10 @@ +case "${ACTION}" in +post) + # Detect whether all CPUs have AVX flag set + if sed -n '/^flags/{s/\//;t;q1}' /proc/cpuinfo; then + ln -sf "libj-avx.so" "/usr/lib/j/libj.so" + else + ln -sf "libj-nonavx.so" "/usr/lib/j/libj.so" + fi + ;; +esac diff --git a/srcpkgs/j/INSTALL.msg b/srcpkgs/j/INSTALL.msg new file mode 100644 index 00000000000..ca578961646 --- /dev/null +++ b/srcpkgs/j/INSTALL.msg @@ -0,0 +1,8 @@ +The J CLI (jconsole) is provided as /usr/bin/jc. + +To install addons use the 'jpkg' verb, documented here: +https://code.jsoftware.com/wiki/JAL/Package_Manager/jpkg + +See /etc/j/profile.ijs for the default J profile settings. System-wide +overrides may be provided in /etc/j/profilex.ijs; see the corresponding +template /etc/j/profilex_template.ijs for details. diff --git a/srcpkgs/j/REMOVE b/srcpkgs/j/REMOVE new file mode 100644 index 00000000000..cfa7af8a6e6 --- /dev/null +++ b/srcpkgs/j/REMOVE @@ -0,0 +1,3 @@ +case "${ACTION}" in +pre) rm "/usr/lib/j/libj.so";; +esac diff --git a/srcpkgs/j/files/profilex_template.ijs b/srcpkgs/j/files/profilex_template.ijs new file mode 100644 index 00000000000..75965d7f2a5 --- /dev/null +++ b/srcpkgs/j/files/profilex_template.ijs @@ -0,0 +1,28 @@ +NB. profilex.ijs template +NB. copy template to profilex and edit as required +NB. profilex.ijs overrides profile definitions +NB. profilex.ijs is not replaced by installs/updates +NB. errors may prevent startup +NB. check SystemFolders_j_ before/after changes +NB. install is J folder +NB. home is HOME +NB. userx is /807-user or /j64-807-user +NB. see profile.ijs for more info + +NB. example 1: user in J folder +NB. user=. install,userx + +NB. example 2: user in d:/ +NB. user=. 'd:',userx + +NB. example 3: user in home/Documents +NB. user=. home,'/Documents',userx + +NB. example 4: user in same folder as install +NB. user=. ('/'(i:~{.])install),userx + +user=. home,userx NB. profile default - edit to change +break=. user,'/break' +config=. user,'/config' +snap=. user,'/snap' +temp=. user,'/temp' diff --git a/srcpkgs/j/patches/crossbuild-jconsole.patch b/srcpkgs/j/patches/crossbuild-jconsole.patch new file mode 100644 index 00000000000..a21271e47e9 --- /dev/null +++ b/srcpkgs/j/patches/crossbuild-jconsole.patch @@ -0,0 +1,11 @@ +--- make/build_jconsole.sh 2019-09-27 16:31:47.494999152 +0900 ++++ make/build_jconsole.sh 2019-09-27 16:35:41.162381710 +0900 +@@ -8,7 +8,7 @@ + + linux_j32) + COMPILE="$common -m32 -DREADLINE" +-LINK=" -l:libedit.so.2 -m32 -ldl -o jconsole " ++LINK=" -ledit -m32 -ldl -o jconsole " + ;; + linux_j64) + COMPILE="$common -DREADLINE" diff --git a/srcpkgs/j/patches/crossbuild-libj.patch b/srcpkgs/j/patches/crossbuild-libj.patch new file mode 100644 index 00000000000..66da953609a --- /dev/null +++ b/srcpkgs/j/patches/crossbuild-libj.patch @@ -0,0 +1,61 @@ +--- make/build_libj.sh 2019-09-27 16:31:51.711078190 +0900 ++++ make/build_libj.sh 2019-09-27 16:35:36.406292466 +0900 +@@ -7,36 +7,32 @@ + # use -DC_NOMULTINTRINSIC to continue to use more standard c in version 4 + # too early to move main linux release package to gcc 5 + +-compiler=${CC:0:3} +- + USE_OPENMP="${USE_OPENMP:=0}" +-if [ $USE_OPENMP -eq 1 ] ; then + OPENMP=" -fopenmp " + LDOPENMP=" -fopenmp " +-if [ "x$compiler" = x'gcc' ] ; then +-LDOPENMP32=" -l:libgomp.so.1 " # gcc +-else +-LDOPENMP32=" -l:libomp.so.5 " # clang +-fi +-fi + +-if [ "x$compiler" = x'gcc' ] ; then +-# gcc +-common="$OPENMP -fPIC -O1 -fwrapv -fno-strict-aliasing -Wextra -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-sign-compare -Wno-clobbered -Wno-empty-body -Wno-unused-value -Wno-pointer-sign -Wno-parentheses -Wno-shift-negative-value" +-# alternatively, add comment /* fall through */ +-OVER_GCC_VER7=$(echo `$CC -dumpversion | cut -f1 -d.` \>= 7 | bc) +-if [ $OVER_GCC_VER7 -eq 1 ] ; then +-common="$common -Wno-implicit-fallthrough" +-fi +-OVER_GCC_VER8=$(echo `$CC -dumpversion | cut -f1 -d.` \>= 8 | bc) +-if [ $OVER_GCC_VER8 -eq 1 ] ; then +-common="$common -Wno-cast-function-type" +-fi +-else +-# clang 3.5 .. 5.0 +-common="$OPENMP -Werror -fPIC -O1 -fwrapv -fno-strict-aliasing -Wextra -Wno-consumed -Wno-uninitialized -Wno-unused-parameter -Wno-sign-compare -Wno-empty-body -Wno-unused-value -Wno-pointer-sign -Wno-parentheses -Wno-unsequenced -Wno-string-plus-int" +-fi +-darwin="$OPENMP -fPIC -O1 -fwrapv -fno-strict-aliasing -Wno-string-plus-int -Wno-empty-body -Wno-unsequenced -Wno-unused-value -Wno-pointer-sign -Wno-parentheses -Wno-return-type -Wno-constant-logical-operand -Wno-comment -Wno-unsequenced" ++common="${OPENMP} -Werror -fPIC -O1 -fwrapv -fno-strict-aliasing -Wextra" ++for wflag in no-maybe-uninitialized \ ++ no-unused-parameter \ ++ no-sign-compare \ ++ no-clobbered \ ++ no-empty-body \ ++ no-unused-value \ ++ no-pointer-sign \ ++ no-parentheses \ ++ no-shift-negative-value \ ++ no-implicit-fallthrough \ ++ no-cast-function-type \ ++ no-consumed \ ++ no-uninitialized \ ++ no-unsequenced \ ++ no-string-plus-int \ ++ no-return-type \ ++ no-constant-logical-operand \ ++ no-comment; do ++ ${CC} -### -x c -W"${wflag}" /dev/null >/dev/null 2>/dev/null && \ ++ common="${common} -W${wflag}" ++done + + case $jplatform\_$1 in + diff --git a/srcpkgs/j/template b/srcpkgs/j/template new file mode 100644 index 00000000000..d818200267d --- /dev/null +++ b/srcpkgs/j/template @@ -0,0 +1,111 @@ +# Template file for 'j' +pkgname=j +version=807 +revision=1 +archs="x86_64 aarch64" +wrksrc="jsource-j${version}-release" +makedepends="libedit-devel libgomp-devel libomp-devel" +short_desc="Modern, high-performance, ASCII-based successor to APL" +maintainer="B. Wilson " +license="GPL-3.0-or-later" +homepage="https://jsoftware.com/" +distfiles="https://github.com/jsoftware/jsource/archive/j${version}-release.tar.gz" +checksum=324ff0b046c9f7f24f18a72fa8a4253ad54c99a48c397fd2c724392f5e097d7f + +_jsz="j${XBPS_TARGET_WORDSIZE}" +_jtype="release" +_jbuilder="voidlinux.org" +_jlib="/usr/lib/j" +_jshare="/usr/share/j" +_jetc="/etc/j" +_juser=".j" + +case "${XBPS_TARGET_MACHINE}" in +aarch64*) _jplatform="raspberry";; +*) _jplatform="linux";; +esac + + +## +# Crossbuilds do not distinguish between AVX- and non-AVX-enabled targets, so +# here we build libraries for both cases. See do_install() for further details. +do_build() { + sed "/jplatform/s@unknown@${_jplatform}@ + /jtype/s@beta@${_jtype}@ + /jbuilder/s@unknown@${_jbuilder}@" \ + jsrc/jversion-x.h > jsrc/jversion.h + + sed -i "/jgit=/s@~/git/jsource@${wrksrc}@ + /jbld=/s@~/jbld@${wrksrc}/build@ + /jplatform=/s@=.*\$@=${_jplatform}@ + /CC=/s@clang@${CC}@" \ + make/jvars.sh + + sed -i "/^install=./s@/usr/share/j/[0-9.]\+@${_jshare}@ + /^user=./s@home,userx@home,'/${_juser}'@" \ + jlibrary/bin/profile.ijs + + mkdir -p build/${_jsz}/bin + . make/jvars.sh + + make/build_jconsole.sh ${_jsz} + make/build_libj.sh ${_jsz} + make/build_libj.sh ${_jsz}nonavx +} + +_runtestdir() { + dir=${1} + jc=${2} + libj=${3} + + for f in "${dir}"/*.ijs; do + printf '%s(%s): ' "${f}" "${libj}" + if ${jc} -lib "${libj}" <"${f}" >/dev/null; then + echo "PASS" + else + echo "FAIL" + return 1 + fi + done +} + +do_check() { + ln -srf jlibrary/bin/* build/${_jsz}/bin/ + ln -srf jlibrary/{addons,system,tools} build/${_jsz}/ + + # Test AVX-enabled library if all host CPUs have AVX flag set + if sed -n '/^flags/{s/\//;t;q1}' /proc/cpuinfo; then + _runtestdir ./test "build/${_jsz}/bin/jconsole" "libj.so" + fi + _runtestdir ./test "build/${_jsz}/bin/jconsole" "libj-nonavx.so" +} + +## +# We install the AVX-enabled library libj.so as libj-avx.so. An INSTALL script +# then symlinks the appropriate library to libj.so, depending on whether the +# installing machine supports AVX or not. +do_install() { + vmkdir "${_jshare}" 0755 + vcopy jlibrary/addons "${_jshare}" + vcopy jlibrary/system "${_jshare}" + vcopy jlibrary/tools "${_jshare}" + + vmkdir "${_jlib}" 0755 + vinstall "build/${_jsz}/bin/jconsole" 755 "${_jlib}" + vinstall "build/${_jsz}/bin/libj.so" 755 "${_jlib}" libj-avx.so + if [ -f "build/${_jsz}/bin/libj-nonavx.so" ]; then + vinstall "build/${_jsz}/bin/libj-nonavx.so" 755 "${_jlib}" + fi + + vmkdir "${_jetc}" 0755 + vinstall "${FILESDIR}/profilex_template.ijs" 644 "${_jetc}" + vinstall "jlibrary/bin/profile.ijs" 644 "${_jetc}" + + cat >build/${_jsz}/bin/jc.sh <<-JC + #!/usr/bin/env sh + ${_jlib}/jconsole -lib "${_jlib}/libj.so" \\ + -jprofile "${_jetc}/profile.ijs" \\ + "\${@}" + JC + vbin "build/${_jsz}/bin/jc.sh" jc +} diff --git a/srcpkgs/j/update b/srcpkgs/j/update new file mode 100644 index 00000000000..2947eb06d95 --- /dev/null +++ b/srcpkgs/j/update @@ -0,0 +1,2 @@ +site='https://jsoftware.com/indexno.html' +pattern='The latest release is \K[\d]+(=?\.)'