Skip to content

Instantly share code, notes, and snippets.

@jmroot
jmroot / gist:1d5e7ec3d18cef5b8b998438f3fa762e
Created November 8, 2023 11:14
android-platform-tools
% port info
android-platform-tools @31.0.3 (java, devel)
Description: Platform-Tools for Google Android SDK (adb and fastboot)
Homepage: https://developer.android.com/studio/
Extract Dependencies: unzip
Platforms: darwin
License: BSD and MIT and NCSA and Apache-2 and GPL-2 and LGPL-2.1
Maintainers: Email: judaew@macports.org, GitHub: judaew
@jmroot
jmroot / gist:55bbbc6e1f7f0fc383132e9a4125708c
Created November 6, 2023 23:14
changing version in variant
testport1 has a variant defined like this:
variant oldversion {
version 1.0
}
% port info --version testport1
version: 2.0
% port info --version testport1 +oldversion
version: 1.0
% sudo port install testport1 +oldversion
@jmroot
jmroot / Portfile
Created November 6, 2023 20:37
android-platform-tools with subports for older CPUs
# -*- 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
name android-platform-tools
version 34.0.5
categories java devel
installs_libs no
maintainers {judaew @judaew} openmaintainer
@jmroot
jmroot / has_archive.tcl
Created October 31, 2023 15:17
Check if a port has an archive available
#! /usr/bin/env port-tclsh
package require macports
mportinit
array set portinfo [lindex [mportlookup [lindex $argv 0]] 1]
set mport [mportopen $portinfo(porturl) [list subport $portinfo(name)] ""]
set available [[ditem_key $mport workername] eval [list _archive_available]]
if {$available} {
set status has
if {[catch {sysctl hw.optional.sse4_1} result] || $result == 0}]} {
depends_run-append port:whatever-installs-old-adb
notes-append "The current version of adb requires SSE 4.1, which is not\
supported by your CPU. An older version is provided at /path/to/adb"
}
@jmroot
jmroot / Portfile-osxphotos
Created September 7, 2023 08:19
Incomplete Portfile for osxphotos
# -*- 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 python 1.0
name osxphotos
version 0.63.0
categories graphics
platforms {darwin any}
supported_archs noarch
@jmroot
jmroot / lintportindex.tcl
Last active March 1, 2023 03:35
basic PortIndex lint script
#!/usr/bin/env port-tclsh
# check a PortIndex for duplicate portnames and malformed portinfo
set fd [open [lindex $argv 0]]
array set counts {}
while {[gets $fd line] >= 0} {
set name [string tolower [lindex $line 0]]
incr counts($name)
if {$counts($name) > 1} {
puts stderr "Warning: $counts($name) occurrences of $name"
}
@jmroot
jmroot / all_distributable.tcl
Created December 26, 2022 13:37
Check which MacPorts ports are binary distributable
#!/usr/bin/env port-tclsh
# For every available port, outputs the port name to distributable.txt
# if binaries are considered distributable, or to not-distributable.txt
# if not (along with an explanation).
# Set this to where distributable_lib.tcl can be found
set distributable_lib_path .
package require macports
@jmroot
jmroot / all_bin_available.tcl
Last active April 6, 2024 00:07
Check which MacPorts ports have binary archives available
#!/usr/bin/env port-tclsh
# For every available port, outputs the port name to available.txt
# if a binary archive is available on packages.macports.org, or to
# unavailable.txt if not.
package require macports
mportinit
set yesfile [open ./available.txt w]
@jmroot
jmroot / compatver.sh
Created September 5, 2022 06:08
Script to test compatibility_version behaviour
#!/bin/sh
CC=${CC-clang}
echo '#include <stdio.h>
#include "lib.h"
int libcall(void) {
printf("working\\n");
return 0;