brew更改包安装位置

时间:2015-07-25 01:57:28

标签: macos homebrew

如何更改Homebrew安装包的位置?这甚至可能吗?我尝试在#include <stdio.h> #include <stdlib.h> typedef unsigned OUTCODE; typedef int COORD; typedef int BOOL; #define TRUE 1 #define FALSE 0 #define XMIN 0 #define YMIN 0 #define XMAX 5000 #define YMAX 3000 // Not strictly portable, but usually fine. #define SIGN_BIT (~(~0u >> 1)) #define LEFT SIGN_BIT #define TOP (LEFT >> 1) #define RIGHT (TOP >> 1) #define BOTTOM (RIGHT >> 1) #define ALL (LEFT | BOTTOM | RIGHT | TOP) // Mask the sign bit. #define M(X) ((X) & SIGN_BIT) // Shift previous value and mask in the new sign bit. #define SM(Prev, New) (((OUTCODE)(Prev) >> 1) | M(New)) __inline OUTCODE outcode(COORD x, COORD y) { return SM(SM(SM(M(YMAX - y), XMAX - x), y - YMIN), x - XMIN); } // In the S-T coordinate system, pO is outside boundary C and will be moved // to the boundary while pI doesn't move. I is the termination correction. #define MOVE_TO_BOUNDARY(SO, TO, SI, TI, C, I, IS_OUTSIDE) do { \ COORD tsi = SI, tti = TI; \ while (SO IS_OUTSIDE C) { \ COORD sm = (tsi + SO + I) >> 1; \ COORD tm = (tti + TO + I) >> 1; \ if (sm IS_OUTSIDE ## = C) { \ SO = sm; \ TO = tm; \ } else { \ tsi = sm; \ tti = tm; \ } \ } \ } while (0) BOOL clip(COORD *x0p, COORD *y0p, COORD *x1p, COORD *y1p) { COORD x0 = *x0p, y0 = *y0p, x1 = *x1p, y1 = *y1p; OUTCODE code0 = outcode(x0, y0); OUTCODE code1 = outcode(x1, y1); for (;;) { if ((code0 | code1) == 0) { *x0p = x0; *y0p = y0; *x1p = x1; *y1p = y1; return TRUE; } else if (code0 & code1) { return FALSE; } else if (code0) { if (code0 & BOTTOM) MOVE_TO_BOUNDARY(y0, x0, y1, x1, YMAX, 0, >); else if (code0 & RIGHT) MOVE_TO_BOUNDARY(x0, y0, x1, y1, XMAX, 0, >); else if (code0 & TOP) MOVE_TO_BOUNDARY(y0, x0, y1, x1, YMIN, 1, <); else /* LEFT */ MOVE_TO_BOUNDARY(x0, y0, x1, y1, XMIN, 1, <); code0 = outcode(x0, y0); } else { if (code1 & BOTTOM) MOVE_TO_BOUNDARY(y1, x1, y0, x0, YMAX, 0, >); else if (code1 & RIGHT) MOVE_TO_BOUNDARY(x1, y1, x0, y0, XMAX, 0, >); else if (code1 & TOP) MOVE_TO_BOUNDARY(y1, x1, y0, x0, YMIN, 1, <); else /* LEFT */ MOVE_TO_BOUNDARY(x1, y1, x0, y0, XMIN, 1, <); code1 = outcode(x1, y1); } } } int main(void) { int n = 0, margin = 2000; for (;;) { // Generate some random points around the viewport. int x0 = rand() % (2 * margin + XMAX - XMIN) - margin; int y0 = rand() % (2 * margin + YMAX - YMIN) - margin; int x1 = rand() % (2 * margin + XMAX - XMIN) - margin; int y1 = rand() % (2 * margin + YMAX - YMIN) - margin; printf("a(%d, %d)--(%d, %d) %x--%x\n", x0, y0, x1, y1, outcode(x0,y0) >> 28, outcode(x1,y1) >> 28); BOOL r = clip(&x0, &y0, &x1, &y1); printf("a(%d, %d)--(%d, %d): %d\n", x0, y0, x1, y1, r); } return 0; } 中手动移动已安装的文件夹,但该位置的动态链接是“硬连线”。

1 个答案:

答案 0 :(得分:5)

不,这是不可能的。 You can change the location of the whole Homebrew install(例如~/homebrew代替/usr/local),但您无法更改一个包的位置。