Skip to content

Commit

Permalink
ccl: restore PPC support
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 authored and herbygillot committed Jan 4, 2023
1 parent 596e827 commit 32a7ae7
Showing 1 changed file with 107 additions and 52 deletions.
159 changes: 107 additions & 52 deletions lang/ccl/Portfile
@@ -1,41 +1,65 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

PortGroup github 1.0
github.setup Clozure ccl 1.12.1 v
PortSystem 1.0

name ccl

categories lang
license Apache-2
maintainers {easieste @easye} openmaintainer
supported_archs x86_64 ppc ppc64
description The Clozure Common Lisp Implementation
long_description Clozure CL is an open source Common Lisp implementation. \
Clozure CL used to be called OpenMCL. It is also sometimes \
called CCL. You will see the three names being used interchangeably.
homepage https://github.com/Clozure/ccl

platform darwin i386 {
PortGroup github 1.0

github.setup Clozure ccl 1.12.1 v
revision 0

checksums ${name}-${version}${extract.suffix} \
rmd160 549ca42bde4390f3735b069b279f8e469afe1125 \
sha256 9e369fe0e7983eca68b9a33c68568ec4e16c3d56ac6a801c1e2d9dc758c48aa1 \
size 5017255
dist_subdir ${name}/${version}
worksrcdir ccl-${version}
}

name ccl
revision 0
dist_subdir ${name}/${version}
# Pegged, do not update:
platform darwin powerpc {
if {${os.major} > 8} {
version 1.6

set shortversion ${version}

categories lang
license Apache-2
maintainers {easieste @easye} openmaintainer
platforms darwin
supported_archs x86_64
description The Clozure Common Lisp Implementation
long_description \
Clozure CL is an open source Common Lisp implementation. \
Clozure CL used to be called OpenMCL. It is also sometimes \
called CCL. You will see the three names being used interchangeably.
checksums ${name}-${version}-darwinppc${extract.suffix} \
rmd160 8ec32a06899c7a0687221257561dabf4cff23626 \
sha256 563ed539c588df6137612f957d66554c6e453b1b17adc14d2c1773b395732e43 \
size 124226791
} else {
version 1.4

homepage https://github.com/Clozure/ccl
checksums ${name}-${version}-darwinppc${extract.suffix} \
rmd160 be383bbbaa002cae14ad8c2faffa407f687a6a4e \
sha256 6033422accffe8ab2d4d176f3673da48afd35408e9675c6594d775037e5c26bf \
size 71167804
}
master_sites https://ccl.clozure.com/ftp/pub/release/${version}/
distname ${name}-${version}-darwinppc
worksrcdir ccl
}

checksums ${name}-${version}${extract.suffix} \
rmd160 549ca42bde4390f3735b069b279f8e469afe1125 \
sha256 9e369fe0e7983eca68b9a33c68568ec4e16c3d56ac6a801c1e2d9dc758c48aa1 \
size 5017255
set shortversion ${version}

worksrcdir ccl-${version}
use_configure no
use_configure no

compiler.whitelist macports-clang-9.0
platform darwin i386 {
compiler.whitelist macports-clang-9.0
}

platform darwin {
global bootimg
global bootimg
global ccl_script

if { ${configure.build_arch} eq "x86_64" } {
Expand All @@ -49,6 +73,12 @@ platform darwin {
extract.only-delete darwinx86${extract.suffix}
set bootimg dx86cl64
set ccl_script ccl64
} elseif { ${configure.build_arch} == "ppc64" } {
set bootimg dppccl64
set ccl_script ccl64
} elseif { ${configure.build_arch} == "ppc" } {
set bootimg dppccl
set ccl_script ccl
} else {
pre-fetch {
return -code error "architecture ${configure.build_arch} has not been ported to ${name}"
Expand All @@ -57,37 +87,62 @@ platform darwin {
}

post-extract {
system "cd ${worksrcpath} && tar -x -f ${distpath}/darwinx86${extract.suffix}"
if { ${configure.build_arch} eq "x86_64" } {
system "cd ${worksrcpath} && tar -x -f ${distpath}/darwinx86${extract.suffix}"
}
}

build {
system "cd ${worksrcpath}/lisp-kernel/darwinx8664 && make clean && make"
system "cd ${worksrcpath} && echo '(ccl::rebuild-ccl :clean t)' | ./${bootimg} --batch"
# FIXME: doc target no longer exists with ccl-1.11
#
# Generating the manual would involve using ccl with Quicklisp to
# run <https://github.com/Clozure/ccldoc>.
if { ${configure.build_arch} eq "x86_64" } {
system "cd ${worksrcpath}/lisp-kernel/darwinx8664 && make clean && make"
system "cd ${worksrcpath} && echo '(ccl::rebuild-ccl :clean t)' | ./${bootimg} --batch"
# FIXME: doc target no longer exists with ccl-1.11
#
# Generating the manual would involve using ccl with Quicklisp to run.
# https://github.com/Clozure/ccldoc
} else {
# PPC:
system "cd ${worksrcpath} && echo '(ccl::rebuild-ccl :full t)' | ./${bootimg} --batch"
}
}

set prefixpath \\\"[regsub -all / [strsed ${prefix}/share/asdf-install {g/^\///}] "\\\" \\\""]\\\"

destroot {
set install_root ${prefix}/share/${name}/${shortversion}
set stage_root ${destroot}${install_root}
file mkdir ${stage_root}
system "cd ${worksrcpath} && tar -c -f - . | ( cd ${stage_root} && tar -x -f -)"
set ccl_wrapper ${worksrcpath}/scripts/${ccl_script}
reinplace "s|/usr/local/src/ccl|${install_root}|" \
${ccl_wrapper}
system "chmod +x ${ccl_wrapper}"
file copy ${ccl_wrapper} ${destroot}${prefix}/bin

xinstall -d ${destroot}${prefix}/share/doc/${name}
xinstall -d ${destroot}${prefix}/share/examples
xinstall -m 644 -W ${worksrcpath}/doc \
release-notes-1.1.txt release-notes-1.2.txt release-notes.txt \
compiler-changes-in-CCL-1.12-trunk.pdf \
${destroot}${prefix}/share/doc/${name}
file copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${name}
if { ${configure.build_arch} eq "x86_64" } {
set install_root ${prefix}/share/${name}/${shortversion}
set stage_root ${destroot}${install_root}
file mkdir ${stage_root}
system "cd ${worksrcpath} && tar -c -f - . | (cd ${stage_root} && tar -x -f -)"
set ccl_wrapper ${worksrcpath}/scripts/${ccl_script}
reinplace "s|/usr/local/src/ccl|${install_root}|" ${ccl_wrapper}
system "chmod +x ${ccl_wrapper}"
file copy ${ccl_wrapper} ${destroot}${prefix}/bin

xinstall -d ${destroot}${prefix}/share/doc/${name}
xinstall -d ${destroot}${prefix}/share/examples
xinstall -m 644 -W ${worksrcpath}/doc \
release-notes-1.1.txt release-notes-1.2.txt release-notes.txt \
compiler-changes-in-CCL-1.12-trunk.pdf \
${destroot}${prefix}/share/doc/${name}
file copy ${worksrcpath}/examples ${destroot}${prefix}/share/examples/${name}
} else {
# PPC:
file mkdir ${destroot}${prefix}/share/${name}/${shortversion}
system "cd ${worksrcpath} && tar cf - . | (cd ${destroot}${prefix}/share/${name}/${shortversion} && tar xf -)"
reinplace "s|/usr/local/src/ccl|${prefix}/share/${name}/${shortversion}|" ${workpath}/ccl/scripts/${ccl_script}
system "chmod +x ${workpath}/ccl/scripts/${ccl_script}"
file copy ${workpath}/ccl/scripts/${ccl_script} ${destroot}${prefix}/bin
reinplace "s|\"usr\" \"local\" \"asdf-install\")))))|${prefixpath})))))|" \
${destroot}${prefix}/share/${name}/${shortversion}/tools/asdf-install/installer.lisp
}
}

post-activate {
if { ${configure.build_arch} in [list ppc ppc64] } {
# Prepare asdf install folders and so forth.
file mkdir ${prefix}/share/asdf-install
system "chgrp admin ${prefix}/share/asdf-install"
system "chmod g+w ${prefix}/share/asdf-install"
}
}

8 comments on commit 32a7ae7

@MarcusCalhoun-Lopez
Copy link
Contributor

@MarcusCalhoun-Lopez MarcusCalhoun-Lopez commented on 32a7ae7 Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to cause portindex to fail on Apple Silicon Machines:

Failed to parse file lang/ccl/Portfile: can't read "version": no such variable

@herbygillot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be cause portindex to fail on Apple Silicon Machines:

Failed to parse file lang/ccl/Portfile: can't read "version": no such variable

@barracuda156 Can you address this?

@barracuda156
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be cause portindex to fail on Apple Silicon Machines:

Failed to parse file lang/ccl/Portfile: can't read "version": no such variable

@barracuda156 Can you address this?

I will look for a similar case to borrow a fix. (These failures to parse happen quite often on PPC, so there should be some cases where that was fixed.)

@kencu
Copy link
Contributor

@kencu kencu commented on 32a7ae7 Jan 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the portfile is written there is no version of this port that applies to "platform arm" -- only i386 and ppc are taken care of.

@barracuda156
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way the portfile is written there is no version of this port that applies to "platform arm" -- only i386 and ppc are taken care of.

@kencu What is the correct way to deal with such cases?

@kencu
Copy link
Contributor

@kencu kencu commented on 32a7ae7 Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a block for arm, like the others... or some way of accounting for it. Add arm to another appropriate block perhaps. Or rejig the blocks to "ppc" and "not ppc"... etc.

platform darwin arm {
   blah blah blah
}

it's a logic error, but not a hard one.

@barracuda156
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a block for arm, like the others... or some way of accounting for it. Add arm to another appropriate block perhaps. Or rejig the blocks to "ppc" and "not ppc"... etc.

platform darwin arm {
   blah blah blah
}

it's a logic error, but not a hard one.

Ok, sure. I just thought maybe there is a standardized clause – there must be other ports like this.

I think I can do something like: if PPC > this, else > that.

@barracuda156
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.