トップ 追記

Masa's blog

検索キーワード:

2017年06月27日 mscore-1.3 on Slackware-14.2 [長年日記]

_ mscore-1.3 on Slackware-14.2

Build

$ tar xvf mscore-1.3.tar.bz2
$ cd mscore-1.3
$ patch ../mscore-1.3.diff | patch -p0
*** ./mscore/mscore/CMakeLists.txt.ORG	2017-06-27 00:14:09.333969024 +0900
--- ./mscore/mscore/CMakeLists.txt	2017-06-27 00:14:41.637968660 +0900
***************
*** 274,279 ****
--- 274,280 ----
        qtsingleapp
        fluid
        z
+       pthread
        )

     if (HAS_AUDIOFILE)
$ make release
$ sudo make install

Setting

Edit -> Setting -> I/O -> check `JACK AUDIO SERVER'


2017年06月20日 How to make WLI-UC-GNM working stably with Slackware-14.2 [長年日記]

_ How to make WLI-UC-GNM working stably with Slackware-14.2

$ lsusb

Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 056e:0084 Elecom Co., Ltd
Bus 003 Device 003: ID 0411:01a2 BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM Wireless LAN Adapter [Ralink RT8070]    # <- This is WLI-UC-GNM
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/etc/rc.d/rc.wireless.conf

DC:FB:02:*)
    ESSID="_YOUR_ESSID_"
    MODE="Managed"
    KEY="_YOUR_PASSWORD_"
    IWCONFIG="power off"       # <- This is important!
    ;;

/etc/modprobe.d/rt2800usb.conf

options rt2800usb nohwcrypt=1

2017年06月04日 Version up php-5.5.11 to php-7.1.5 [長年日記]

_ Version up php-5.5.11 to php-7.1.5

Build

$ tar xvf php-7.1.5.tar.bz2
$ cd php-7.1.5
$ cat ../php-7.1.5.diff | patch -p0
*** ./configure.ORG     2017-06-04 10:50:30.000000000 +0900
--- ./configure 2017-06-04 10:55:11.000000000 +0900
***************
*** 79826,79832 ****
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 79826,79832 ----
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 79837,79843 ****
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 79837,79843 ----
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95505,95511 ****
  ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isfinite" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95505,95511 ----
  ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isfinite" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95516,95522 ****
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95516,95522 ----
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95527,95533 ****
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95527,95533 ----
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-gd --with-zlib --with-bz2 --with-openssl=/usr/local/ssl
$ make
$ su
# make install && ldconfig
# cp php.ini-development /usr/local/lib/php7.ini
# vim /usr/local/lib/php7.ini
# cd /usr/local/lib
# rm php.ini
# ln -s php7.ini php.ini

_ After install php-7, apache got segfault

I have to remove line for old php5.

/usr/local/apache2/conf/httpd.conf

#DEL_LoadModule php5_module        modules/libphp5.so
LoadModule php7_module        modules/libphp7.so

2017年05月27日 let's encrypt [長年日記]

_ let's encrypt

pre-requirement

  • mercurial-1.8.2.tar.gz
  • python-2.7.11.tar.gz
  • curl-7.53.1.tar.gz (must be enabled SNI)

getssl-2.10.zip

Create default config files.

# getssl -c myh.no-ip.org

~/.getssl/getssl.cfg

CA="https://acme-v01.api.letsencrypt.org"
ACCOUNT_EMAIL="m-ito@myh.no-ip.org"
ACCOUNT_KEY_LENGTH=4096
ACCOUNT_KEY="/root/.getssl/account.key"
PRIVATE_KEY_ALG="rsa"
RENEW_ALLOW="30"
SERVER_TYPE="https"
CHECK_REMOTE="true"

~/.getssl/myh.no-ip.org/getssl.cfg

CA="https://acme-v01.api.letsencrypt.org"
SANS=""
ACL=('/usr/local/apache2/htdocs/.well-known/acme-challenge')

Create certificate etc.

# getssl myh.no-ip.org

Update certificate.

# getssl -u -a -q && cp `find /root/.getssl/myh.no-ip.org/archive/ -type d|tail -1`/* /root/.getssl/myh.no-ip.org/

2017年04月30日 firefox-53 with cairo-gtk3 and lprng [長年日記]

_ firefox-53 with cairo-gtk3 and lprng

I tried to build firefox-53, but it failed. because firefox-53 already doesn't support cailo-gtk2 ! Of course, I have succeeded to build firefox-53 with cairo-gtk3.

But I faced to another issue about printing by firefox. gtk2 supports printing by lpr, but gtk3 doesn't support it. And I have been LPRng's user in long time :P

CUPS is one of solutions for this issue, but I don't like it. So I resolved this issue by another way ;)

notify_change.c

#include <errno.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/inotify.h>
#include <unistd.h>

/* Read all available inotify events from the file descriptor 'fd'.
   wd is the table of watch descriptors for the directories in argv.
   argc is the length of wd and argv.
   argv is the list of watched directories.
   Entry 0 of wd and argv is unused. */

static void handle_events(int fd, int *wd, int argc, char *argv[])
{
    /* Some systems cannot read integer variables if they are not
       properly aligned. On other systems, incorrect alignment may
       decrease performance. Hence, the buffer used for reading from
       the inotify file descriptor should have the same alignment as
       struct inotify_event. */

    char buf[4096]
        __attribute__ ((aligned(__alignof__(struct inotify_event))));
    const struct inotify_event *event;
    int i;
    ssize_t len;
    char *ptr;

    /* Loop while events can be read from inotify file descriptor. */

    for (;;) {

        /* Read some events. */

        len = read(fd, buf, sizeof buf);
        if (len == -1 && errno != EAGAIN) {
            perror("read");
            exit(EXIT_FAILURE);
        }

        /* If the nonblocking read() found no events to read, then
           it returns -1 with errno set to EAGAIN. In that case,
           we exit the loop. */

        if (len <= 0)
            break;

        for (ptr = buf; ptr < buf + len;
             ptr += sizeof(struct inotify_event) + event->len) {

            event = (const struct inotify_event *) ptr;

            /* Print event type */

            if (event->mask & IN_OPEN)
                printf("IN_OPEN: ");
            if (event->mask & IN_CLOSE_NOWRITE)
                printf("IN_CLOSE_NOWRITE: ");
            if (event->mask & IN_CLOSE_WRITE)
                printf("IN_CLOSE_WRITE: ");

            /* Print the name of the watched directory */

            for (i = 1; i < argc; ++i) {
                if (wd[i] == event->wd) {
                    printf("%s/", argv[i]);
                    break;
                }
            }

            /* Print the name of the file */

            if (event->len)
                printf("%s", event->name);

            /* Print type of filesystem object */

            if (event->mask & IN_ISDIR)
                printf(" [directory]\n");
            else
                printf(" [file]\n");

            fflush(stdout);
        }
    }
}

int main(int argc, char *argv[])
{
    char buf;
    int fd, i;
    int *wd;

    if (argc < 2) {
        printf("Usage: %s PATH [PATH ...]\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    /* Create the file descriptor for accessing the inotify API */

    fd = inotify_init();
    if (fd == -1) {
        perror("inotify_init");
        exit(EXIT_FAILURE);
    }

    /* Allocate memory for watch descriptors */

    wd = calloc(argc, sizeof(int));
    if (wd == NULL) {
        perror("calloc");
        exit(EXIT_FAILURE);
    }

    /* Mark directories for events
       - file was opened
       - file was closed */

    for (i = 1; i < argc; i++) {
        wd[i] = inotify_add_watch(fd, argv[i], IN_OPEN | IN_CLOSE);
        if (wd[i] == -1) {
            fprintf(stderr, "Cannot watch '%s'\n", argv[i]);
            perror("inotify_add_watch");
            exit(EXIT_FAILURE);
        }
    }

    while (1) {
        handle_events(fd, wd, argc, argv);
    }

    close(fd);
    free(wd);
    exit(EXIT_SUCCESS);
}

printspool.sh

#! /bin/sh
trap "rm -fr ~/printspool/LOCK.DIR; exit 0" INT TERM
mkdir ~/printspool/LOCK.DIR || exit 1
echo -n $$ >~/printspool/LOCK.DIR/pid
notify_change ~/printspool |\
while :
do
        read line
        if [ "X`echo $line | egrep 'IN_CLOSE_WRITE.*\[file\]'`" = "X" ]
        then
                :
        else
                file=`echo $line | cut -d ' ' -f 2`
                lpr $file && rm $file
        fi
done
rm -fr ~/printspool/LOCK.DIR

How to use

  • Run printspool.sh in background.
  • When you want to print from firefox, output file(postscript or pdf) into ~/printspool/ from print menu in firefox.
  • lpr will be invoked automatically to print file and after that, file will be removed.

2017年03月20日 SlackwareARM 13.37 with chroot on rooted android smart phone(Sony Xperia SO-03D) [長年日記]

_ Equipments

_ Applications on android side

Required

Recommended

_ Extract Slackware file tree into MicroSD (by Slackware 14.2 x86)

Get SlackwareARM 13.37

Format MicroSD

# fdisk -l /dev/sdb
Disk /dev/sdb: 31.9 GB, 31914983424 bytes
4 heads, 16 sectors/track, 973968 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/sdb1              33       32800     1048576   b Win95 FAT32
Partition 1 does not end on cylinder boundary
/dev/sdb2           32801      163872     4194304  82 Linux swap
Partition 2 does not end on cylinder boundary
/dev/sdb3          163873      973968    25923072  83 Linux
Partition 3 does not end on cylinder boundary
  • mkfs -t vfat /dev/sdb1
  • mkswap /dev/sdb2
  • mkfs -t ext4 /dev/sdb3

Extract

  • mount /dev/sdb3 /mnt/tmp
  • mkdir /mnt/tmp/slackware
  • cd ~/ftp.arm.slackware.com/slackwarearm/armedslack-13.37/slackware/
  • find . -name '*.tgz' | xargs -I '{}' installpkg --root /mnt/tmp/slackware '{}'

make symbolic links in /lib, /usr/lib.

  • cd /mnt/tmp/slackware/lib
  • ldconfig.sh
for i in `file * | egrep 'shared object' | cut -d: -f1 | sort | uniq`
do
	soname=`objdump -p $i | egrep SONAME | sed -e 's/^  *SONAME  *//'`
	if [ $i != ${soname} ]
	then
		ln -sf $i ${soname}
	fi
	linkername=`echo ${soname}|sed -e 's/\.so\..*$/.so/'`
	if [ ${soname} != ${linkername} ]
	then
		ln -sf ${soname} ${linkername}
	fi
done
  • cd /mnt/tmp/slackware/usr/lib
  • ldconfig.sh
  • sync;sync;sync
  • cd ~
  • umount /mnt/tmp

_ Android smart phone side

create mount point for Slackware's partition

  • Put MicroSD into SD slot in phone
  • start Terminal emulator
  • su -
  • cd /mnt/sdcard
  • mkdir chroot

Create scripts to start Slackware

  • mount /dev/block/mmcblk1p3 /mnt/sdcard/chroot
  • mkdir chroot/slackware/system
  • mkdir chroot/slackware/external_sd
  • /mnt/sdcard/slackware.sh
#! /system/bin/sh
(
	export CHROOT=/mnt/sdcard/chroot
	export ROOT=${CHROOT}/slackware
	/system/xbin/mount -t ext4 -o noatime,data=writeback /dev/block/mmcblk1p3 ${CHROOT}
	/system/xbin/mount -t proc none ${ROOT}/proc
	/system/xbin/mount -t sysfs none ${ROOT}/sys
	/system/xbin/mount -o bind /dev ${ROOT}/dev
	/system/xbin/mount -o bind /dev/pts ${ROOT}/dev/pts
	/system/xbin/mount -o bind /dev/socket ${ROOT}/dev/socket
	/system/xbin/mkdir ${ROOT}/dev/shm
	/system/xbin/mount -t tmpfs none ${ROOT}/dev/shm
	/system/xbin/mount -o bind /system ${ROOT}/system
	/system/xbin/mount -o bind /mnt/sdcard/external_sd ${ROOT}/external_sd
	export HOME=/root
	export SHELL=/bin/bash
	export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/arm-slackware-linux-gnueabi/lib:${LD_LIBRARY_PATH}

	/system/xbin/swapon /dev/block/mmcblk1p2

	/system/xbin/cp /sys/module/lowmemorykiller/parameters/adj ${CHROOT}/adj.ORG
	/system/xbin/cp /sys/module/lowmemorykiller/parameters/minfree ${CHROOT}/minfree.ORG
	echo 9999 >/sys/module/lowmemorykiller/parameters/adj
	echo 1 >/sys/module/lowmemorykiller/parameters/minfree

#	/system/xbin/chroot ${ROOT} /bin/bash -l
	/system/xbin/chroot ${ROOT} /bin/su -c /etc/rc.d/rc.local

	for i in `/system/xbin/lsof | /system/xbin/egrep /mnt/sdcard/chroot/ | /system/xbin/cut -f 1 | /system/xbin/sort | /system/xbin/uniq`
	do
		/system/xbin/kill $i
	done

	/system/xbin/sync;/system/xbin/sync;/system/xbin/sync

	/system/xbin/cp ${CHROOT}/adj.ORG /sys/module/lowmemorykiller/parameters/adj
	/system/xbin/cp ${CHROOT}/minfree.ORG /sys/module/lowmemorykiller/parameters/minfree

	/system/xbin/swapoff /dev/block/mmcblk1p2

	/system/xbin/umount ${ROOT}/external_sd
	/system/xbin/umount ${ROOT}/system
	/system/xbin/umount ${ROOT}/dev/shm
	/system/xbin/umount ${ROOT}/dev/socket
	/system/xbin/umount ${ROOT}/dev/pts
	/system/xbin/umount ${ROOT}/dev
	/system/xbin/umount ${ROOT}/sys
	/system/xbin/umount ${ROOT}/proc
	/system/xbin/umount ${CHROOT}
)

_ Start slackware

start Slackware with next commands from Terminal emulator.

  • su -
  • cd /mnt/sdcard
  • sh slackware.sh
  • su - m-ito
  • sh .xinitrc

Change application to XSDL, then you will see terminal and window manager running in it.

_ inside of chrooted Slackware-13.37

/root/setdns.sh

#! /bin/sh
ns=`netstat -r | egrep default | head -1 | tr -s ' ' | cut -d' ' -f2`
cat /etc/resolv.conf.setdns.ORG |
sed -e "s/_nameserver_/$ns/g" >/etc/resolv.conf.setdns
ln -sf /etc/resolv.conf.setdns /etc/resolv.conf

/etc/resolv.conf.setdns.ORG

search artie.or.jp
nameserver _nameserver_

/root/killxorg.sh

#! /bin/sh
killall -9 x.org.server

/etc/X11/app-defaults/Kinput2

*Font: -*-fixed-medium-r-normal--16-*-*-*-c-*-iso8859-1
*KanjiFont: -*-fixed-medium-r-normal--16-*-*-*-c-*-jisx0208.1983-0
*KanaFont: -*-fixed-medium-r-normal--16-*-*-*-c-*-jisx0201.1976-0

*IMProtocol.locales: ja_JP.UTF-8, ja_JP.SJIS, ja_JP.EUC, ja_JP, japanese, japan, ja
*defaultFontList: -*-fixed-medium-r-normal--16-*-*-*-c-*

/etc/rsyncd.conf

uid = root
gid = root
[root_partition]
      comment = so03d root partition
      path = /
      read only = true
      hosts allow = 192.168.0.100
      hosts deny = *

/etc/ld.so.conf

/usr/local/canna/lib

/etc/termcap

rxvt-unicode|rxvt-unicode terminal (X Window System):\
      :am:bw:eo:hs:km:mi:ms:xn:xo:\
      :co#80:it#8:li#24:lm#0:\
      :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
      :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\
      :RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E(B:al=\E[L:\
      :as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\
      :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\
      :dl=\E[M:do=^J:ds=\E]2;\007:ec=\E[%dX:ei=\E[4l:fs=^G:\
      :ho=\E[H:i1=\E[!p:ic=\E[@:im=\E[4h:\
      :is=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l:\
      :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
      :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:\
      :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:kd=\E[B:ke=\E>:\
      :kh=\E[7~:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\
      :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:\
      :sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:te=\E[r\E[?1049l:\
      :ti=\E[?1049h:ts=\E]2;:ue=\E[24m:up=\E[A:us=\E[4m:\
      :vb=\E[?5h\E[?5l:ve=\E[?12l\E[?25h:vi=\E[?25l:\
      :vs=\E[?12;25h:

rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System):\
      :Co#256:pa#32767:tc=rxvt-unicode:
SC|screen|VT 100/ANSI X3.64 virtual terminal:\
      :am:xn:ms:mi:G0:km:\
      :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
      :cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
      :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
      :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
      :li#24:co#80:us=\E[4m:ue=\E[24m:so=\E[3m:se=\E[23m:\
      :mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:sr=\EM:al=\E[L:\
      :AL=\E[%dL:dl=\E[M:DL=\E[%dM:cs=\E[%i%d;%dr:dc=\E[P:\
      :DC=\E[%dP:im=\E[4h:ei=\E[4l:IC=\E[%d@:\
      :ks=\E[?1h\E=:ke=\E[?1l\E>:vb=\Eg:\
      :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:\
      :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:\
      :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:\
      :kh=\E[1~:kI=\E[2~:kD=\E[3~:kH=\E[4~:@7=\E[4~:kP=\E[5~:\
      :kN=\E[6~:eA=\E(B\E)0:as=^N:ae=^O:ti=\E[?1049h:te=\E[?1049l:\
      :vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
      :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
      :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:
SB|screen-bce|VT 100/ANSI X3.64 virtual terminal with bce:\
      :ut:tc=screen:
SH|screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line:\
      :ts=\E_:fs=\E\\:ds=\E_\E\\:tc=screen:

/etc/HOSTNAME

so03d.artie.or.jp

/etc/gtk-2.0/gtkrc

gtk-theme-name="GTK+"
gtk-print-backends="file,lpr,cups"

/etc/group

wheel:x:10:root,m-ito
audio:x:17:root,pulse,m-ito
pulse:x:65:
m-ito:x:503:
openpobox:x:504:
aid_system:x:1000:root,m-ito,bin,pulse
aid_radio:x:1001:root,m-ito,bin,pulse
aid_bluetooth:x:1002:root,m-ito,bin,pulse
aid_graphics:x:1003:root,m-ito,bin,pulse
aid_input:x:1004:root,m-ito,bin,pulse
aid_audio:x:1005:root,m-ito,bin,pulse
aid_camera:x:1006:root,m-ito,bin,pulse
aid_log:x:1007:root,m-ito,bin,pulse
aid_compass:x:1008:root,m-ito,bin,pulse
aid_mount:x:1009:root,m-ito,bin,pulse
aid_wifi:x:1010:root,m-ito,bin,pulse
aid_adb:x:1011:root,m-ito,bin,pulse
aid_install:x:1012:root,m-ito,bin,pulse
aid_media:x:1013:root,m-ito,bin,pulse
aid_dhcp:x:1014:root,m-ito,bin,pulse
aid_sdcard_rw:x:1015:root,m-ito,bin,pulse
aid_media_rw:x:1023:root,m-ito,bin,pulse
aid_shell:x:2000:root,m-ito,bin,pulse
aid_cache:x:2001:root,m-ito,bin,pulse
aid_diag:x:2002:root,m-ito,bin,pulse
aid_net_bt_admin:x:3001:root,m-ito,bin,pulse
aid_net_bt:x:3002:root,m-ito,bin,pulse
aid_inet:x:3003:root,m-ito,bin,pulse
aid_net_raw:x:3004:root,m-ito,bin,pulse
aid_misc:x:9998:root,m-ito,bin,pulse
aid_nobody:x:9999:root,m-ito,bin,pulse
aid_app:x:10000:root,m-ito,bin,pulse

/etc/ssh/sshd_config

#Port 22
Port 8022

/etc/hosts

#127.0.0.1    darkstar.example.net darkstar
192.168.0.5   so03d.artie.or.jp       so03d

/etc/passwd

pulse:x:65:65:User for PulseAudio:/var/run/pulse:/bin/false
m-ito:x:503:503::/home/m-ito:/bin/bash
openpobox:x:504:504::/usr/local/OpenPOBox:/bin/bash
aid_system:x:1000:1000::/:/bin/false
aid_radio:x:1001:1001::/:/bin/false
aid_bluetooth:x:1002:1002::/:/bin/false
aid_graphics:x:1003:1003::/:/bin/false
aid_input:x:1004:1004::/:/bin/false
aid_audio:x:1005:1005::/:/bin/false
aid_camera:x:1006:1006::/:/bin/false
aid_log:x:1007:1007::/:/bin/false
aid_compass:x:1008:1008::/:/bin/false
aid_mount:x:1009:1009::/:/bin/false
aid_wifi:x:1010:1010::/:/bin/false
aid_adb:x:1011:1011::/:/bin/false
aid_install:x:1012:1012::/:/bin/false
aid_media:x:1013:1013::/:/bin/false
aid_dhcp:x:1014:1014::/:/bin/false
aid_sdcard_rw:x:1015:1015::/:/bin/false
aid_media_rw:x:1023:1023::/:/bin/false
aid_shell:x:2000:2000::/:/bin/false
aid_cache:x:2001:2001::/:/bin/false
aid_diag:x:2002:2002::/:/bin/false
aid_net_bt_admin:x:3001:3001::/:/bin/false
aid_net_bt:x:3002:3002::/:/bin/false
aid_inet:x:3003:3003::/:/bin/false
aid_net_raw:x:3004:3004::/:/bin/false
aid_misc:x:9998:9998::/:/bin/false
aid_nobody:x:9999:9999::/:/bin/false
aid_app:x:10000:10000::/:/bin/false

/etc/rc.d/rc.local

#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

if [ -e /dev/graphics/fb0 ]
then
	(cd /dev && ln -sf graphics/fb0 .)
fi

if [ -x /sbin/ldconfig ]
then
	/sbin/ldconfig
fi

if [ -r /etc/HOSTNAME ]
then
	/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
fi

if [ -x /usr/bin/dbus-uuidgen ]
then
	/usr/bin/dbus-uuidgen --ensure
fi

# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
if [ -x /usr/bin/update-gtk-immodules ]
then
	/usr/bin/update-gtk-immodules --verbose
fi
if [ -x /usr/bin/update-gdk-pixbuf-loaders ]
then
	/usr/bin/update-gdk-pixbuf-loaders --verbose
fi
if [ -x /usr/bin/update-pango-querymodules ]
then
	/usr/bin/update-pango-querymodules --verbose
fi

if [ -x /usr/bin/rsync ]
then
	/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
fi

if [ -x /etc/rc.d/rc.sshd ]
then
	/etc/rc.d/rc.sshd start
fi

if [ -x /etc/rc.d/rc.pulseaudio ]
then
	/etc/rc.d/rc.pulseaudio start
fi

if [ -x /usr/local/canna/sbin/cannaserver ]
then
	rm -f /tmp/.iroha_unix/IROHA
	/usr/local/canna/sbin/cannaserver -inet -u bin
	echo "Starting cannaserver."
fi

if [ -x /usr/local/OpenPOBox/server/pbserver.sh ]
then
	/usr/local/OpenPOBox/server/pbserver.sh
fi

/bin/bash -l

/etc/pulse/system.pa

load-module module-simple-protocol-tcp rate=44100 format=s16le channels=2 source=auto_null.monitor record=true port=8000

/etc/mtab

cd /etc && ln -sf ../proc/mounts mtab

/etc/sudoers

%wheel ALL=(ALL) NOPASSWD: ALL

/etc/profile

export LD_PRELOAD="/LD_PRELOAD/libandroid-shmem.so /LD_PRELOAD/libdisableselinux.so /LD_PRELOAD/libpty.so"
alias df='df 2>/dev/null'

/home/m-ito/.gtkrc-2.0

gtk-icon-theme-name = "Tango"

/home/m-ito/.xinitrc

#!/bin/sh
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $

DISPLAY=127.0.0.1:0.0; export DISPLAY

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    /usr/bin/xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    /usr/bin/xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    /usr/bin/xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    /usr/bin/xmodmap $usermodmap
fi

# start some nice programs

xset fp default
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/100dpi
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/75dpi
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/OTF
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/Speedo
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/TTF
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/Type1
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/cyrillic
xset fp+ /mnt/sdcard/chroot/slackware/usr/share/fonts/misc
xset fp rehash

/usr/bin/xkbset m
/usr/bin/xkbset exp m

/usr/bin/kinput2 -kinput +ximp -xim -canna &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=12" -imfont "-misc-fixed-medium-r-normal--12-*-*-*-c-*" -geometry 104x25+0+0 &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=14" -imfont "-misc-fixed-medium-r-normal--14-*-*-*-c-*" -geometry 89x21+0+0 &
/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=16" -imfont "-misc-fixed-medium-r-normal--16-*-*-*-c-*" -geometry 78x19+0+0 &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=18" -imfont "-misc-fixed-medium-r-normal--18-*-*-*-c-*" -geometry 69x17+0+0 &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=20" -imfont "-misc-fixed-medium-r-normal--20-*-*-*-c-*" -geometry 62x15+0+0 &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=22" -imfont "-misc-fixed-medium-r-normal--22-*-*-*-c-*" -geometry 57x14+0+0 &
#/usr/local/bin/urxvt -ls -fn "xft:Sazanami Mincho:size=24" -imfont "-misc-fixed-medium-r-normal--24-*-*-*-c-*" -geometry 52x13+0+0 &
exec /usr/local/fvwm1/bin/fvwm

/home/m-ito/.Xresource

! F1 for Button1, F2 for Button2, F3 for Button3 of Rii RT-MWK02(bluetooth mini keyboard)
keycode 67 = Pointer_Button1
keycode 68 = Pointer_Button2
keycode 69 = Pointer_Button3
remove Shift = Shift_L
remove Control = Control_L
keysym Control_L = Shift_L
keysym Shift_L = Control_L
add Shift = Shift_L
add Control = Control_L

_ Some applications to add

fvwm-1.24r

*** modules/FvwmAudio/Imakefile.ORG     2015-12-02 10:46:14.031822333 +0900
--- modules/FvwmAudio/Imakefile 2015-12-02 10:46:34.219569951 +0900
***************
*** 10,17 ****
   * are correct for your rplay installation.
   */

  #define HAVE_RPLAY
!

  #ifdef HAVE_RPLAY
  AUDIO_DEFINES = -DHAVE_RPLAY
--- 10,18 ----
   * are correct for your rplay installation.
   */

+ #if 0
  #define HAVE_RPLAY
! #endif

  #ifdef HAVE_RPLAY
  AUDIO_DEFINES = -DHAVE_RPLAY
  • cat ../fvwm1_1.24r-56-2.diff | patch -p0
*** configure.h.ORG     2015-12-02 10:59:17.825023569 +0900
--- configure.h 2015-12-02 10:59:31.210856224 +0900
***************
*** 64,69 ****
--- 64,70 ----
   *   If you want to use i18n feature, specify #define I18N
   ***************************************************************************/
  /* #define I18N */
+ #define I18N

  /***************************************************************************
   *#define M4
  • cat ../fvwm1_1.24r-56-3.diff | patch -p0
*** ./modules/FvwmIconBox/FvwmIconBox.c.ORG     2015-12-09 15:24:04.410373438 +0900
--- ./modules/FvwmIconBox/FvwmIconBox.c 2015-12-09 15:24:22.327149447 +0900
***************
*** 1056,1062 ****
    gcv.background = icon_back_pix;
    IconShadowGC = XCreateGC(dpy, Root, gcm, &gcv);

!   gcm = GCForeground|GCBackground|GCFont;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
--- 1056,1062 ----
    gcv.background = icon_back_pix;
    IconShadowGC = XCreateGC(dpy, Root, gcm, &gcv);

!   gcm = GCForeground|GCBackground/* |GCFont */;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
*** ./modules/FvwmIdent/FvwmIdent.c.ORG 2015-12-09 15:24:32.972016368 +0900
--- ./modules/FvwmIdent/FvwmIdent.c     2015-12-09 15:24:48.383823694 +0900
***************
*** 456,462 ****
    XSelectInput(dpy,main_win,MW_EVENTS);
    change_window_name(&MyName[1]);

!   gcm = GCForeground|GCBackground|GCFont;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
--- 456,462 ----
    XSelectInput(dpy,main_win,MW_EVENTS);
    change_window_name(&MyName[1]);

!   gcm = GCForeground|GCBackground/* |GCFont */;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
*** ./modules/FvwmPager/x_pager.c.ORG   2015-12-09 15:24:59.594683539 +0900
--- ./modules/FvwmPager/x_pager.c       2015-12-09 15:25:18.115451998 +0900
***************
*** 393,399 ****
      }
    XMapRaised(dpy,Scr.Pager_w);

!   gcm = GCForeground|GCBackground|GCFont;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;

--- 393,399 ----
      }
    XMapRaised(dpy,Scr.Pager_w);

!   gcm = GCForeground|GCBackground/* |GCFont */;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;

*** ./modules/FvwmWinList/FvwmWinList.c.ORG     2015-12-09 15:25:31.115289477 +0900
--- ./modules/FvwmWinList/FvwmWinList.c 2015-12-09 15:25:45.232112993 +0900
***************
*** 689,695 ****
    gcval.foreground=fore;
    gcval.background=back;
    gcval.font=ButtonFont->fid;
!   gcmask=GCForeground|GCBackground|GCFont;
    graph=XCreateGC(dpy,Root,gcmask,&gcval);

    if(d_depth < 2)
--- 689,695 ----
    gcval.foreground=fore;
    gcval.background=back;
    gcval.font=ButtonFont->fid;
!   gcmask=GCForeground|GCBackground/* |GCFont */;
    graph=XCreateGC(dpy,Root,gcmask,&gcval);

    if(d_depth < 2)
*** ./modules/GoodStuff/GoodStuff.c.ORG 2015-12-09 15:25:57.129964249 +0900
--- ./modules/GoodStuff/GoodStuff.c     2015-12-09 15:26:10.506797016 +0900
***************
*** 834,840 ****
    gcv.background = back_pix;
    ShadowGC = XCreateGC(dpy, Root, gcm, &gcv);

!   gcm = GCForeground|GCBackground|GCFont;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
--- 834,840 ----
    gcv.background = back_pix;
    ShadowGC = XCreateGC(dpy, Root, gcm, &gcv);

!   gcm = GCForeground|GCBackground/* |GCFont */;
    gcv.foreground = fore_pix;
    gcv.background = back_pix;
    gcv.font =  font->fid;
*** ./fvwm/configure.c.ORG      2015-12-09 15:21:08.980566612 +0900
--- ./fvwm/configure.c  2015-12-09 15:23:12.215025970 +0900
***************
*** 1833,1839 ****
    Scr.DrawGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground|GCFont;
    gcv.line_width = 0;
    gcv.function = GXcopy;
    gcv.plane_mask = AllPlanes;
--- 1833,1839 ----
    Scr.DrawGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground/* |GCFont */;
    gcv.line_width = 0;
    gcv.function = GXcopy;
    gcv.plane_mask = AllPlanes;
***************
*** 1854,1865 ****
    gcv.fill_style = FillStippled;
    gcv.stipple = Scr.gray_bitmap;
    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground|GCFont|GCStipple|GCFillStyle;

    Scr.StippleGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground|GCFont;
    gcv.foreground = Scr.HiRelief.fore;
    gcv.background = Scr.HiRelief.back;
    gcv.fill_style = FillSolid;
--- 1854,1865 ----
    gcv.fill_style = FillStippled;
    gcv.stipple = Scr.gray_bitmap;
    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground/* |GCFont */|GCStipple|GCFillStyle;

    Scr.StippleGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

    gcm = GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!     GCBackground/* |GCFont */;
    gcv.foreground = Scr.HiRelief.fore;
    gcv.background = Scr.HiRelief.back;
    gcv.fill_style = FillSolid;
***************
*** 1877,1887 ****
        gcv.fill_style = FillStippled;
        gcv.stipple = Scr.gray_bitmap;
        gcm=GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!       GCBackground|GCFont|GCStipple|GCFillStyle;
        Scr.MenuStippleGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

        gcm=GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!       GCBackground|GCFont;
        gcv.fill_style = FillSolid;
      }
    else
--- 1877,1887 ----
        gcv.fill_style = FillStippled;
        gcv.stipple = Scr.gray_bitmap;
        gcm=GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!       GCBackground/* |GCFont */|GCStipple|GCFillStyle;
        Scr.MenuStippleGC = XCreateGC(dpy, Scr.Root, gcm, &gcv);

        gcm=GCFunction|GCPlaneMask|GCGraphicsExposures|GCLineWidth|GCForeground|
!       GCBackground/* |GCFont */;
        gcv.fill_style = FillSolid;
      }
    else
*** ./fvwm/misc.h.ORG   2015-12-09 15:23:23.833880714 +0900
--- ./fvwm/misc.h       2015-12-09 15:23:50.353549172 +0900
***************
*** 96,102 ****
     Globalgcv.font = newfont;\
     Globalgcv.foreground = color;\
     Globalgcv.background = backcolor;\
!    Globalgcm = GCFont | GCForeground | GCBackground; \
     XChangeGC(dpy,Scr.FontGC,Globalgcm,&Globalgcv); \
  }
  #ifdef I18N
--- 96,102 ----
     Globalgcv.font = newfont;\
     Globalgcv.foreground = color;\
     Globalgcv.background = backcolor;\
!    Globalgcm = /* GCFont | */GCForeground | GCBackground; \
     XChangeGC(dpy,Scr.FontGC,Globalgcm,&Globalgcv); \
  }
  #ifdef I18N
  • cat ../fvwm1_1.24r-56-4.diff | patch -p0
*** ./fvwm/resize.c.ORG 2015-12-10 01:24:12.408041411 +0900
--- ./fvwm/resize.c     2015-12-10 01:25:18.327419423 +0900
***************
*** 457,465 ****

  #undef FONTSET
  #define FONTSET Scr.StdFont.fontset
    XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC,
               offset, Scr.StdFont.font->ascent + SIZE_VINDENT, str, 13);
!
  }

  /***********************************************************************
--- 457,469 ----

  #undef FONTSET
  #define FONTSET Scr.StdFont.fontset
+ #if 0
    XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC,
               offset, Scr.StdFont.font->ascent + SIZE_VINDENT, str, 13);
! #else
!   XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC,
!              offset, Scr.StdFont.y + SIZE_VINDENT, str, 13);
! #endif
  }

  /***********************************************************************
*** ./fvwm/move.c.ORG   2015-12-10 01:20:49.885301811 +0900
--- ./fvwm/move.c       2015-12-10 01:21:05.863332536 +0900
***************
*** 337,346 ****
--- 337,353 ----
            - XTextWidth(Scr.StdFont.font,str,strlen(str)))/2;
  #undef FONTSET
  #define FONTSET Scr.StdFont.fontset
+ #if 0
    XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC,
               offset,
               Scr.StdFont.font->ascent + SIZE_VINDENT,
               str, strlen(str));
+ #else
+   XDrawString (dpy, Scr.SizeWindow, Scr.NormalGC,
+              offset,
+              Scr.StdFont.y + SIZE_VINDENT,
+              str, strlen(str));
+ #endif
  }
  • cat ../fvwm1.diff | patch -p0
*** ./configure.h.ORG   2017-01-02 03:40:40.280993705 +0900
--- ./configure.h       2017-01-02 03:47:14.560992599 +0900
***************
*** 1,7 ****
! #define FVWMDIR     "/usr/X11R6/lib/X11/fvwm"
  /* #define FVWMDIR        "/local/homes/dsp/nation/modules"*/
! #define FVWM_ICONDIR   "/usr/local/share/images:/usr/local/share/icons:/usr/share/images:/usr/share/icons:/usr/share/pixmaps:/usr/include/X11/pixmaps:/usr/include/X11/bitmaps:/usr/X11R6/include/bitmaps"
! #define FVWMRC         "/etc/X11/fvwm/system.fvwmrc"

  /* Imake command needed to put modules in desired target location */
  /* Use the second version if it causes grief */
--- 1,10 ----
! /* #define FVWMDIR     "/usr/X11R6/lib/X11/fvwm" */
  /* #define FVWMDIR        "/local/homes/dsp/nation/modules"*/
! #define FVWMDIR     "/usr/local/fvwm1"
! /* #define FVWM_ICONDIR   "/usr/local/share/images:/usr/local/share/icons:/usr/share/images:/usr/share/icons:/usr/share/pixmaps:/usr/include/X11/pixmaps:/usr/include/X11/bitmaps:/usr/X11R6/include/bitmaps" */
! #define FVWM_ICONDIR   "/usr/local/fvwm1/pixmaps:/usr/local/fvwm1/bitmaps:/usr/local/share/images:/usr/local/share/icons:/usr/share/images:/usr/share/icons:/usr/share/pixmaps:/usr/include/X11/pixmaps:/usr/include/X11/bitmaps:/usr/X11R6/include/bitmaps"
! /* #define FVWMRC         "/etc/X11/fvwm/system.fvwmrc" */
! #define FVWMRC         "/usr/local/fvwm1/system.fvwmrc"

  /* Imake command needed to put modules in desired target location */
  /* Use the second version if it causes grief */
***************
*** 14,20 ****
   * If you want to install it in a different directory, uncomment and
   * edit the first line */
  /* #define FVWM_BIN_DIR BINDIR=/local/homes/dsp/nation/bin/4.1.3*/
! #define FVWM_BIN_DIR BINDIR=/usr/X11R6/bin
  /*#define FVWM_BIN_DIR*/

  /* Compiler over-ride for Imakefiles */
--- 17,24 ----
   * If you want to install it in a different directory, uncomment and
   * edit the first line */
  /* #define FVWM_BIN_DIR BINDIR=/local/homes/dsp/nation/bin/4.1.3*/
! /* #define FVWM_BIN_DIR BINDIR=/usr/X11R6/bin */
! #define FVWM_BIN_DIR BINDIR=/usr/local/fvwm1/bin
  /*#define FVWM_BIN_DIR*/

  /* Compiler over-ride for Imakefiles */
  • xmkmf
  • make Makefiles && make all
  • make install
  • make install.man
  • mkdir /usr/local/fvwm1/pixmaps
  • mkdir /usr/local/fvwm1/bitmaps
  • cp fvwm_icons/*.xpm /usr/local/fvwm1/pixmaps/
  • cp fvwm_icons/*.xbm /usr/local/fvwm1/bitmaps/
  • cp fvwm_icons/*.bitmap /usr/local/fvwm1/bitmaps/
  • cp fvwm_icons/*.icon /usr/local/fvwm1/bitmaps/

less-382-iso262

gc-7.2g

  • tar xvf gc-7.2g.tar.gz
  • cd gc-7.2g
  • ./configure && make && make install

w3m-0.5.3

*** ./istream.h.ORG     2012-11-28 12:23:44.903821617 +0900
--- ./istream.h 2012-11-28 12:24:31.368727065 +0900
***************
*** 20,26 ****

  typedef struct stream_buffer *StreamBuffer;

! struct file_handle {
      FILE *f;
      void (*close) ();
  };
--- 20,26 ----

  typedef struct stream_buffer *StreamBuffer;

! struct File_handle {
      FILE *f;
      void (*close) ();
  };
***************
*** 53,59 ****

  struct file_stream {
      struct stream_buffer stream;
!     struct file_handle *handle;
      char type;
      char iseos;
      int (*read) ();
--- 53,59 ----

  struct file_stream {
      struct stream_buffer stream;
!     struct File_handle *handle;
      char type;
      char iseos;
      int (*read) ();
*** ./istream.c.ORG     2012-11-28 12:23:39.465130387 +0900
--- ./istream.c 2012-11-28 12:24:16.455831711 +0900
***************
*** 22,29 ****
  static void basic_close(int *handle);
  static int basic_read(int *handle, char *buf, int len);

! static void file_close(struct file_handle *handle);
! static int file_read(struct file_handle *handle, char *buf, int len);

  static int str_read(Str handle, char *buf, int len);

--- 22,29 ----
  static void basic_close(int *handle);
  static int basic_read(int *handle, char *buf, int len);

! static void file_close(struct File_handle *handle);
! static int file_read(struct File_handle *handle, char *buf, int len);

  static int str_read(Str handle, char *buf, int len);

***************
*** 114,120 ****
      stream = New(union input_stream);
      init_base_stream(&stream->base, STREAM_BUF_SIZE);
      stream->file.type = IST_FILE;
!     stream->file.handle = New(struct file_handle);
      stream->file.handle->f = f;
      if (closep)
        stream->file.handle->close = closep;
--- 114,120 ----
      stream = New(union input_stream);
      init_base_stream(&stream->base, STREAM_BUF_SIZE);
      stream->file.type = IST_FILE;
!     stream->file.handle = New(struct File_handle);
      stream->file.handle->f = f;
      if (closep)
        stream->file.handle->close = closep;
***************
*** 638,650 ****
  }

  static void
! file_close(struct file_handle *handle)
  {
      handle->close(handle->f);
  }

  static int
! file_read(struct file_handle *handle, char *buf, int len)
  {
      return fread(buf, 1, len, handle->f);
  }
--- 638,650 ----
  }

  static void
! file_close(struct File_handle *handle)
  {
      handle->close(handle->f);
  }

  static int
! file_read(struct File_handle *handle, char *buf, int len)
  {
      return fread(buf, 1, len, handle->f);
  }
*** ./main.c.ORG        2016-08-01 21:43:32.714706108 +0900
--- ./main.c    2016-08-01 21:45:27.569705061 +0900
***************
*** 833,839 ****
--- 833,844 ----
      mySignal(SIGPIPE, SigPipe);
  #endif

+ #if 0
      orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
+ #else
+     orig_GC_warn_proc = GC_get_warn_proc();
+     GC_set_warn_proc(wrap_GC_warn_proc);
+ #endif
      err_msg = Strnew();
      if (load_argc == 0) {
        /* no URL specified */
  • LIBS="-lX11" ./configure --disable-mouse && make && make install

libandroid-shmem.so

  • git clone https://github.com/pelya/android-shmem.git
  • cd android-shmem
  • git submodule update --init libancillary
  • gcc -shared -fpic -std=gnu99 -Wall *.c -I . -I libancillary -o libandroid-shmem.so -Wl,--version-script=exports.txt -lc -lpthread && strip libandroid-shmem.so
  • cp libandroid-shmem.so /LD_PRELOAD/

libdisableselinux.so

  • git clone https://github.com/pelya/debian-noroot.git
  • cd debian-noroot
  • gcc -shared -fpic disableselinux/*.c -o dist/libdisableselinux.so && strip dist/libdisableselinux.so
  • cp dist/libdisableselinux.so /LD_PRELOAD/

libpty.so

See detail in http://qiita.com/z80oolong/items/d3585cd5542d3d60ce12#chap02

nkf-2.1.1

  • tar xvf nkf-2.1.1.tar.gz
  • cd nkf-2.1.1
  • make && make install
  • cd NKF.mod/
  • perl Makefile.PL
  • make && make install

FD-3.00j

  • tar xvf FD-3.00j.tar.gz
  • cd FD-3.00j
  • vi machine.h
  • vi fd.h
  • make && make install

Canna37p3

  • tar xvf Canna37p3.tar.bz2
  • cd Canna37p3
  • xmkmf
  • make canna
  • make install
  • make install.man
  • touch /var/log/CANNA0msgs
  • chown bin.bin /var/log/CANNA0msgs
  • mkdir ~/.cannax
  • touch ~/.cannax/rkc.conf

rxvt-unicode-9.22

  • tar xvf rxvt-unicode-9.22.tar.gz
  • cd rxvt-unicode-9.22
  • ./configure --enable-unicode3 --enable-iso14755
  • make && make install

kinput2-v3.1

  • tar xvf kinput2-v3.1.tar.gz
  • cd kinput2-v3.1
  • xmkmf
  • make Makefiles
  • make depend
  • make
  • make install

xkbset

screen-4.4.0

pobox-1.2.6

*** configure.ORG       2012-10-30 20:03:59.100019311 +0900
--- configure   2012-10-30 20:04:21.540036701 +0900
***************
*** 665,671 ****
  fi
  if test "x$enable_sary" = "xyes"; then
    CFLAGS="$CFLAGS -DUSESARY"
!   LDFLAGS="$LDFLAGS -lsary -lglib"
  fi
  if test "x$enable_lookup" = "xyes"; then
    CFLAGS="$CFLAGS -DUSELOOKUP"
--- 665,671 ----
  fi
  if test "x$enable_sary" = "xyes"; then
    CFLAGS="$CFLAGS -DUSESARY"
!   LDFLAGS="$LDFLAGS -lsary -lglib -lpthread"
  fi
  if test "x$enable_lookup" = "xyes"; then
    CFLAGS="$CFLAGS -DUSELOOKUP"
*** server/Makefile.in.ORG      2012-10-30 16:51:30.170021724 +0900
--- server/Makefile.in  2012-10-30 16:55:12.940017212 +0900
***************
*** 13,18 ****
--- 13,19 ----
  CC = gcc
  CFLAGS = -DUNIX @CFLAGS@ \
        -I/usr/local/include -I/usr/local/lib/glib/include \
+       -I/usr/include/glib-1.2 -I/usr/lib/glib/include \
        -I@prefix@/include \
        -I../asearch -I../romakana -I../include -g

*** asearch/Makefile.ORG        2012-10-26 16:52:28.690006915 +0900
--- asearch/Makefile    2012-10-26 16:52:28.690006915 +0900
***************
*** 3,9 ****
  #     $Revision: 1.2 $
  #
  CC = gcc
! CFLAGS = -Xcpluscomm
  WTANGLE = perl ../wtangle/wtangle

  libasearch.a: asearch.o
--- 3,10 ----
  #     $Revision: 1.2 $
  #
  CC = gcc
! ##CFLAGS = -Xcpluscomm
! CFLAGS =
  WTANGLE = perl ../wtangle/wtangle

  libasearch.a: asearch.o
*** romakana/rklist.ORG 2012-10-31 00:14:04.790034744 +0900
--- romakana/rklist     2012-10-31 00:14:31.380030341 +0900
***************
*** 123,129 ****
  myi   ミィ
  myo   ミョ
  myu   ミュ
! n'    ン
  na    ナ
  ne    ネ
  ni    ニ
--- 123,129 ----
  myi   ミィ
  myo   ミョ
  myu   ミュ
! nn    ン
  na    ナ
  ne    ネ
  ni    ニ
  • patch -p0 <../pobox-1.2.6-2.diff
*** server/poboxlib.html.ORG    2014-08-09 10:44:42.128742576 +0900
--- server/poboxlib.html        2014-08-09 11:12:57.518742555 +0900
***************
*** 574,580 ****
  //
  /////////////////////////////////////////////////////////////////

! #define MAXCANDS 40
  static UCHAR *cands[MAXCANDS];
  static UCHAR *candspat[MAXCANDS];
  static int ncands = 0;
--- 574,580 ----
  //
  /////////////////////////////////////////////////////////////////

! #define MAXCANDS 256
  static UCHAR *cands[MAXCANDS];
  static UCHAR *candspat[MAXCANDS];
  static int ncands = 0;
*** server/pbserver.html.ORG    2014-08-09 11:11:47.318743457 +0900
--- server/pbserver.html        2015-12-27 01:17:18.561114232 +0900
***************
*** 67,73 ****

  #define POBOXSERVERPORT 1178

! #define MAXCANDS 100
  #define MAXWORDLEN 100
  unsigned char *cands[MAXCANDS],*candspat[MAXCANDS];

--- 67,73 ----

  #define POBOXSERVERPORT 1178

! #define MAXCANDS 256
  #define MAXWORDLEN 100
  unsigned char *cands[MAXCANDS],*candspat[MAXCANDS];

***************
*** 137,143 ****

  process(int sock)
  {
!       unsigned char buf[1000],combuf[BUFSIZE];

        unsigned char w[100],p[100];
        int i,n;
--- 137,143 ----

  process(int sock)
  {
!       unsigned char buf[65536],combuf[BUFSIZE];

        unsigned char w[100],p[100];
        int i,n;
***************
*** 178,187 ****
                else {
                        strcpy(buf,"1\t");
                        for(i=0;i< n;i++){
!                               strcat(buf,cands[i]);
!                               strcat(buf,"\t");
                        }
-                       strcat(buf,"\n");
                }
                if(send(sock, buf, strlen(buf), 0) < 0) return -1;
                return 0;
--- 178,192 ----
                else {
                        strcpy(buf,"1\t");
                        for(i=0;i< n;i++){
!                               strncat(buf,cands[i],sizeof(buf) - strlen(buf) - 1);
!                               strncat(buf,"\t",sizeof(buf) - strlen(buf) - 1);
!                       }
!                       if ((sizeof(buf) - strlen(buf)) < 2){
!                               buf[sizeof(buf) - 2] = '\n';
!                               buf[sizeof(buf) - 1] = '\0';
!                       }else{
!                               strncat(buf,"\n",sizeof(buf) - strlen(buf) - 1);
                        }
                }
                if(send(sock, buf, strlen(buf), 0) < 0) return -1;
                return 0;
  • patch -p0 <../pobox-1.2.6-3.diff
*** server/pbserver.html.ORG    2015-12-28 23:34:45.403055697 +0900
--- server/pbserver.html        2015-12-28 23:34:51.003055322 +0900
***************
*** 45,53 ****
--- 45,57 ----
  #else
  #include <strings.h>
  #endif
+ #include <signal.h>
+ #include <sys/signal.h>
  #include "server.h"
  #include "poboxlib.h"

+ void sigtrap(int);
+
  #ifdef USE_PROFILER
  #include <sys/time.h>
  struct timeval ts,te;
***************
*** 121,126 ****
--- 125,133 ----
  #else
  main(int argc, char **argv)
  {
+       signal(SIGINT, sigtrap);
+       signal(SIGTERM, sigtrap);
+
        if(argc > 1) poboxdebug = 1;
  #endif
        if(pobox_init() < 0) exit(0);
***************
*** 239,244 ****
--- 246,257 ----
                return -1;
        }
  }
+
+ void sigtrap(int signum)
+ {
+       pobox_save(&learndic);
+       exit(1);
+ }
  </pre>
  • ./configure --enable-lookup && make
  • cd server
  • nkf -e ../dict/data/fugodic | sort | uniq >staticdic.tmp
  • perl ../fugodicnn.pl <staticdic.tmp | sort | uniq >staticdic
  • rm staticdic.tmp
  • touch learndic
  • cd ../..
  • cp -r OpenPOBox /usr/local/
  • chown -R openpobox.openpobox /usr/local/OpenPOBox
  • chmod u+s /usr/local/OpenPOBox/server/pbserver
server/pbserver.sh
#! /bin/sh
cd /usr/local/OpenPOBox/server/ || exit 1
exec ./pbserver &
fugodicnn.pl
## POBox fugodic change ん'n' -> ん'nn'
## Time-stamp: <Nov 25 2002>

while(<>){
#    my $orig = $_;

    #konna -> konnna
    if(/nn[aiueo]/){
        s/nn([aiueo])/nnn$1/g;
    }

    #an'i -> anni  (konna->konnna yori atoni oku)
    if(/n\'/){
        s/n\'/nn/g;
    }

    #ten -> tenn
    if(/[^n]n\t/){
        s/n\t/nn\t/;
    }

    #ronsi -> ronnsi
    if(/[aiouo]n[^naiueo]/){
        s/([aiouo])n([^naiueo])/$1nn$2/g;
    }

    #output
    print $_;    #put a new modified entry
#    if($orig ne $_){
#        print $orig; #leave original entry
#    }
}

pefop-0.4.5

  • tar xvf pefop-0.4.5.tar.gz
  • cd pefop-0.4.5
  • make && make install
  • alias scon='PEFOP_HS=no PEFOP_EXACT=no exec pefop-utf8 sh -c "exec screen -U -R"'

htop-2.0.2

pulseaudio-8.0

json-c-json-c-0.11-20130402
pulseaudio-8.0
  • tar xvf pulseaudio-8.0.tar.xz
  • cd pulseaudio-8.0
  • ./bootstrap.sh --prefix=/usr --libdir=/usr/lib --sysconfdir=/etc --localstatedir=/var --mandir=/usr/man --disable-tcpwrap --disable-static --disable-hal-compat --disable-bluez4 --with-system-user=pulse --with-system-group=pulse --with-access-group=audio --with-bash-completion-dir=/usr/share/bash-completion/completions --host=arm-slackware-linux-gnueabi --target=arm-slackware-linux-gnueabi --build=arm-slackware-linux-gnueabi
  • make && make install

ffmpeg-3.2.2

lame-3.99.5
opencore-amr-0.1.4
openh264-1.6.0
x264-snapshot-20170114-2245
  • tar xvf x264-snapshot-20170114-2245.tar.bz2
  • cd x264-snapshot-20170114-2245
  • ./configure --enable-shared --extra-cflags="-march=armv7-a -mfpu=vfp -mfpu=vfpv3 -mfpu=neon -mthumb -mfloat-abi=softfp"
  • make
  • install-cli install-lib-dev install-lib-static install-lib-shared
ffmpeg-3.2.2
  • tar xvf ffmpeg-3.2.2.tar.bz2
  • cd ffmpeg-3.2.2
  • export CPPFLAGS="-I/usr/local/include"
  • export CFLAGS="-I/usr/local/include"
  • export LDFLAGS="-L/usr/local/lib"
  • ./configure --enable-shared --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-libmp3lame --enable-nonfree --enable-libx264 --enable-gpl --enable-libopenh264 --enable-libpulse --extra-cflags="-march=armv7-a -mfpu=vfp -mfpu=vfpv3 -mfpu=neon -mthumb -mfloat-abi=softfp -D__ARM_PCS"
  • make && make install

MPlayer-1.3.0

MPlayer-1.3.0
  • tar xvf MPlayer-1.3.0.tar.xz
  • cd MPlayer-1.3.0
  • export CFLAGS="-I/usr/local/include"
  • export CPPFLAGS="-I/usr/local/include"
  • export LDFLAGS="-L/usr/local/lib"
  • ./configure --enable-gui --disable-ffmpeg_a --extra-libs=-lgcrypt --extra-cflags="-march=armv7-a -mfpu=vfp -mfpu=vfpv3 -mfpu=neon -mthumb -mfloat-abi=softfp -D__ARM_PCS"
  • make && make install
essential-20071007
all-20110131
Blue-1.12
  • cd /usr/local/share/mplayer/
  • mkdir skins
  • cd skins
  • tar xvf Blue-1.12.tar.bz2
  • ln -s Blue default
font
  • cd /usr/local/share/mplayer/
  • ln -s /usr/share/fonts/TTF/sazanami-mincho.ttf subfont.ttf

alsa-1.1.1

sdl-1.2.14
  • tar xvvf SDL_image-1.2.10.tar.xz
  • cd SDL_image-1.2.10
  • CFLAGS="-O2" ./configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --enable-shared=yes --enable-static=no --enable-jpg-shared=no --enable-png-shared=no --enable-tif-shared=no
  • make
  • make install
  • sed -i -e "s/ -lmikmod//g" /usr/lib/libSDL_mixer.la
  • tar xvvf SDL_mixer-1.2.11.tar.xz
  • cd SDL_mixer-1.2.11
  • zcat ../SDL_mixer.usrlocal.diff.gz | patch -p1
  • CFLAGS="-O2" ./configure --prefix=/usr --mandir=/usr/man --libdir=/usr/lib --enable-shared=yes --enable-music-mod --enable-static=no
  • make
  • make install
  • tar xvvf SDL_net-1.2.7.tar.xz
  • cd SDL_net-1.2.7
  • CFLAGS="-O2" ./configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --enable-shared=yes --enable-static=no
  • make
  • make install
  • tar xvvf SDL_ttf-2.0.10.tar.xz
  • cd SDL_ttf-2.0.10
  • CFLAGS="-O2" ./configure --prefix=/usr --mandir=/usr/man --libdir=/usr/lib --enable-shared=yes --enable-static=no
  • make
  • make install
speexdsp-1.2rc3
speex-1.2.0
  • tar xvf speex-1.2.0
  • cd speex-1.2.0
  • ./configure && make && make install
alsa-1.1.1
alsa-lib-1.1.1
/etc/asound.conf
pcm.default pulse
ctl.default pulse
alsa-oss-1.0.28
  • tar xvvf alsa-oss-1.0.28.tar.xz
  • cd alsa-oss-1.0.28
  • ./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/man --disable-static --build=arm-slackware-linux-gnueabi
  • make
  • make install
alsa-plugins-1.1.1
  • tar xvvf alsa-plugins-1.1.1.tar.xz
  • cd alsa-plugins-1.1.1
  • CFLAGS="-DHAVE_STDINT_H -DUSE_LIBSPEEX" CXXFLAGS="-DHAVE_STDINT_H -DUSE_LIBSPEEX" ./configure --prefix=/usr --libdir=/usr/lib --sysconfdir=/etc --localstatedir=/var --with-speex=lib --enable-maemo-plugin --mandir=/usr/man --docdir=/usr/doc/alsa-plugins-1.1.1 --host=arm-slackware-linux-gnueabi --target=arm-slackware-linux-gnueabi --build=arm-slackware-linux-gnueabi
  • make
  • make install
alsa-utils-1.1.1
  • tar xvvf alsa-utils-1.1.1.tar.xz
  • cd alsa-utils-1.1.1
  • ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --mandir=/usr/man --disable-alsaconf --host=arm-slackware-linux-gnueabi --build=arm-slackware-linux-gnueabi
  • make
  • make install
  • zcat ../rc.alsa.gz > /etc/rc.d/rc.alsa
  • chmod 644 /etc/rc.d/rc.alsa
  • zcat ../rc.alsa-oss.gz > /etc/rc.d/rc.alsa-oss
  • chmod 644 /etc/rc.d/rc.alsa-oss
  • ( cd /usr/man/man1 && rm -f arecord.1 && ln -sf aplay.1 arecord.1 )

firefox-36.0.4

autoconf-2.13
  • tar xvf autoconf-2.13.tar.gz
  • cd autoconf-2.13
  • ./configure --prefix=/usr/local/autoconf-2.13
  • make && make install
  • cd /usr/local/autoconf-2.13/bin/ && ln -s autoconf autoconf-2.13
Python-2.7.13
  • tar xvf Python-2.7.13.tar.xz
  • cd Python-2.7.13
  • ./configure && make && make install
binutils-2.27
oprofile-1.1.0
  • tar xvf oprofile-1.1.0.tar.gz
  • cd oprofile-1.1.0
  • ./autogen.sh
  • ./configure --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --infodir=/usr/info --with-kernel-support
  • make
  • make install
  • mv /usr/share/mangled-name /usr/share/oprofile/mangled-name
make-3.82
  • export ARCH=arm
  • SLKCFLAGS="-O2"
  • LIBDIRSUFFIX=""
  • tar xvf make-3.82.tar.bz2
  • cd make-3.82
  • zcat ../make-3.82-android-build-fix.diff.gz | patch -p1
  • zcat ../make-3.82-bugfixes.patch.gz | patch -p1
  • CFLAGS="$SLKCFLAGS" ./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --mandir=/usr/man --infodir=/usr/info --build=$ARCH-slackware-linux
  • make -j6 || make
  • make install
  • cd /usr/bin; rm gmake; ln -s make gmake
firefox-36.0.4
*** ./js/src/jit/arm/Architecture-arm.cpp.ORG   2017-03-08 01:28:06.126964957 +0900
--- ./js/src/jit/arm/Architecture-arm.cpp       2017-03-08 01:28:31.826964953 +0900
***************
*** 30,41 ****
--- 30,53 ----
  # define AT_HWCAP 16
  #else
  # include <asm/hwcap.h>
+ # if !defined(HWCAP_VFPv4)
+ #  define HWCAP_VFPv4     (1 << 16)
+ # endif
  # if !defined(HWCAP_IDIVA)
  #  define HWCAP_IDIVA     (1 << 17)
  # endif
+ # if !defined(HWCAP_IDIVT)
+ #  define HWCAP_IDIVT     (1 << 18)
+ # endif
  # if !defined(HWCAP_VFPD32)
  #  define HWCAP_VFPD32    (1 << 19) /* set if VFP has 32 regs (not 16) */
  # endif
+ # if !defined(HWCAP_IDIV)
+ #  define HWCAP_IDIV      (HWCAP_IDIVA | HWCAP_IDIVT)
+ # endif
+ # if !defined(HWCAP_ARMv7)
+ #  define HWCAP_ARMv7     (1 << 29)
+ # endif
  #endif

  namespace js {
*** ./security/nss/cmd/lowhashtest/Makefile.ORG 2017-03-08 12:10:24.990247306 +0900
--- ./security/nss/cmd/lowhashtest/Makefile     2017-03-08 12:12:24.520247283 +0900
***************
*** 56,61 ****
--- 56,62 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  #######################################################################
*** ./security/nss/cmd/pk11mode/Makefile.ORG    2017-03-08 12:10:25.010247306 +0900
--- ./security/nss/cmd/pk11mode/Makefile        2017-03-08 12:12:49.330247278 +0900
***************
*** 41,46 ****
--- 41,47 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/cmd/platlibs.mk.ORG  2017-03-08 12:10:25.030247306 +0900
--- ./security/nss/cmd/platlibs.mk      2017-03-08 12:13:34.940247268 +0900
***************
*** 143,148 ****
--- 143,149 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif

***************
*** 191,196 ****
--- 192,198 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif

*** ./security/nss/cmd/shlibsign/mangle/Makefile.ORG    2017-03-08 12:10:25.070247306 +0900
--- ./security/nss/cmd/shlibsign/mangle/Makefile        2017-03-08 12:14:19.250247260 +0900
***************
*** 39,44 ****
--- 39,45 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/cmd/shlibsign/Makefile.ORG   2017-03-08 12:10:25.050247306 +0900
--- ./security/nss/cmd/shlibsign/Makefile       2017-03-08 12:13:58.890247264 +0900
***************
*** 39,44 ****
--- 39,45 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/lib/nss/config.mk.ORG        2017-03-08 12:10:25.190247306 +0900
--- ./security/nss/lib/nss/config.mk    2017-03-08 12:18:18.900247213 +0900
***************
*** 22,27 ****
--- 22,28 ----
        -lplc4 \
        -lplds4 \
        -lnspr4\
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 44,49 ****
--- 45,51 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/lib/smime/config.mk.ORG      2017-03-08 12:10:25.210247306 +0900
--- ./security/nss/lib/smime/config.mk  2017-03-08 12:18:53.530247207 +0900
***************
*** 24,29 ****
--- 24,30 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 46,51 ****
--- 47,53 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/lib/freebl/config.mk.ORG     2017-03-08 12:10:25.170247306 +0900
--- ./security/nss/lib/freebl/config.mk 2017-03-08 12:17:38.980247220 +0900
***************
*** 66,71 ****
--- 66,72 ----
        -lnssutil3 \
        -L$(NSPR_LIB_DIR) \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 86,91 ****
--- 87,93 ----
        -lnssutil3 \
        -L$(NSPR_LIB_DIR) \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif
  endif
*** ./security/nss/lib/softoken/config.mk.ORG   2017-03-08 12:10:25.230247306 +0900
--- ./security/nss/lib/softoken/config.mk       2017-03-08 12:19:35.430247198 +0900
***************
*** 30,35 ****
--- 30,36 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC

***************
*** 55,60 ****
--- 56,62 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif

*** ./security/nss/lib/softoken/legacydb/config.mk.ORG  2017-03-08 12:10:25.250247306 +0900
--- ./security/nss/lib/softoken/legacydb/config.mk      2017-03-08 12:20:09.730247192 +0900
***************
*** 30,35 ****
--- 30,36 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC

***************
*** 53,57 ****
--- 54,59 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif
*** ./security/nss/lib/ckfw/nssmkey/Makefile.ORG        2017-03-08 12:10:25.150247306 +0900
--- ./security/nss/lib/ckfw/nssmkey/Makefile    2017-03-08 12:17:05.940247227 +0900
***************
*** 22,27 ****
--- 22,28 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else
  EXTRA_SHARED_LIBS += \
***************
*** 37,42 ****
--- 38,44 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        -framework Security \
        -framework CoreServices \
        $(NULL)
*** ./security/nss/lib/ckfw/capi/Makefile.ORG   2017-03-08 12:10:25.120247306 +0900
--- ./security/nss/lib/ckfw/capi/Makefile       2017-03-08 12:15:45.390247243 +0900
***************
*** 24,29 ****
--- 24,30 ----
        -lcrypt32 \
        -ladvapi32 \
        -lrpcrt4 \
+       -lrt \
        $(NULL)
  else
  EXTRA_SHARED_LIBS += \
***************
*** 42,47 ****
--- 43,49 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif

*** ./security/nss/lib/ckfw/builtins/Makefile.ORG       2017-03-08 12:10:25.100247306 +0900
--- ./security/nss/lib/ckfw/builtins/Makefile   2017-03-08 12:15:02.370247251 +0900
***************
*** 21,26 ****
--- 21,27 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else
  EXTRA_SHARED_LIBS += \
***************
*** 36,41 ****
--- 37,43 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  endif

*** ./security/nss/lib/ssl/config.mk.ORG        2017-03-08 12:10:25.270247306 +0900
--- ./security/nss/lib/ssl/config.mk    2017-03-08 12:20:43.920247186 +0900
***************
*** 41,46 ****
--- 41,47 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 64,69 ****
--- 65,71 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  ifeq ($(OS_ARCH), BeOS)
*** ./security/nss/lib/util/config.mk.ORG       2017-03-08 12:10:25.300247306 +0900
--- ./security/nss/lib/util/config.mk   2017-03-08 12:21:49.680247173 +0900
***************
*** 20,25 ****
--- 20,26 ----
        -lplc4 \
        -lplds4 \
        -lnspr4\
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 39,44 ****
--- 40,46 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
*** ./security/nss/lib/sysinit/config.mk.ORG    2017-03-08 12:10:25.280247306 +0900
--- ./security/nss/lib/sysinit/config.mk        2017-03-08 12:21:17.100247179 +0900
***************
*** 27,32 ****
--- 27,33 ----
        -lplc4 \
        -lplds4 \
        -lnspr4\
+       -lrt \
        $(NULL)
  else # ! NS_USE_GCC
  EXTRA_SHARED_LIBS += \
***************
*** 49,54 ****
--- 50,56 ----
        -lplc4 \
        -lplds4 \
        -lnspr4 \
+       -lrt \
        $(NULL)

  endif
  • .mozconfig
export LIBS="-lrt"
export CFLAGS="-D__ARM_PCS -Dnullptr=0"
export CXXFLAGS="-D__ARM_PCS -Dnullptr=0"
export MOZ_DEBUG_FLAGS="-v"
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_MAKE_FLAGS=-j1
ac_add_options --enable-optimize
ac_add_options --enable-default-toolkit=cairo-gtk2
ac_add_options --disable-debug
ac_add_options --disable-tests
ac_add_options --enable-gold
ac_add_options --enable-skia
  • PATH=/usr/local/autoconf-2.13/bin:${PATH}; export PATH
  • export LANG=C; export LC_ALL=C
  • nice make -f client.mk build && cd obj-armv7l-unknown-linux-gnueabi/ && nice make package
  • mkdir /usr/local/firefox-36.0.4
  • cd /usr/local/firefox-36.0.4
  • tar xvvf /home/m-ito/tmp/mozilla-release/obj-armv7l-unknown-linux-gnueabi/dist/firefox-36.0.4.en-US.linux-gnueabi-armv7l.tar.bz2
  • mkdir /usr/local/gecko-sdk-36.0.4
  • cd /usr/local/gecko-sdk-36.0.4
  • cp -rL /home/m-ito/tmp/mozilla-release/obj-armv7l-unknown-linux-gnueabi/dist/sdk .
  • cd sdk
  • cp -rL /home/m-ito/tmp/mozilla-release/obj-armv7l-unknown-linux-gnueabi/dist/idl .
  • cp -rL /home/m-ito/tmp/mozilla-release/obj-armv7l-unknown-linux-gnueabi/dist/include .
  • dbus-uuidgen > /var/lib/dbus/machine-id
  • export ARMHWCAP=`cat /proc/cpuinfo |egrep '^Features'|sed -e 's/^Features.*: *//;s/ *$//'|tr -s ' '|tr ' ' ','`

update just im-xim.so from gtk+2-2.24.4

thunar

Error message

Thunar-ERROR **: Failed to load fallback icon from "/usr/share/pixmaps/Thunar/Thunar-fallback-icon.png" (Unrecognized image file format). Check your installation!
aborting...
Aborted

How to fix

update-mime-database /usr/share/mime/

calligra-2.5.5

calligra-2.5.5
  • tar xvf calligra-2.5.5.tar.bz2
  • cd calligra-2.5.5
  • mkdir build
  • cd build
  • cmake -DKDE4_BUILD_TESTS=OFF -DSITE="slackware.com" -DKDE_PLATFORM_FEATURE_DISABLE_DEPRECATED=TRUE -DCMAKE_C_FLAGS:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_C_FLAGS_RELEASE:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_CXX_FLAGS:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DMAN_INSTALL_DIR=/usr/man -DSYSCONF_INSTALL_DIR=/etc/kde -DLIB_SUFFIX= ..
  • make && make install
calligra-l10n-ja-2.5.5
  • tar xvf calligra-l10n-ja-2.5.5.tar.bz2
  • cd calligra-l10n-ja-2.5.5
  • mkdir build
  • cd build
  • cmake -DKDE4_BUILD_TESTS=OFF -DSITE="slackware.com" -DKDE_PLATFORM_FEATURE_DISABLE_DEPRECATED=TRUE -DCMAKE_C_FLAGS:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_C_FLAGS_RELEASE:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_CXX_FLAGS:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -march=armv7-a -mtune=arm7 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DMAN_INSTALL_DIR=/usr/man -DSYSCONF_INSTALL_DIR=/etc/kde -DLIB_SUFFIX= ..
  • make && make install
Rebuilds the system configuration cache
  • kbuildsycoca4

lha-master

  • unzip -x lha-master.zip
  • cd lha-master
  • aclocal
  • autoheader
  • automake -a
  • autoconf
  • ./configure && make && make install

unzip60 + cp932 patch


2017年01月09日 SlackwareARM 14.2 with chroot on rooted android smart phone(Sony Xperia SO-03D) [長年日記]

_ Equipments

_ Applications on android side

Required

Recommended

_ Extract Slackware file tree into MicroSD (on Slackware 14.2 x86)

Get SlackwareARM 14.2

Format MicroSD

  • fdisk -l /dev/sdb
Disk /dev/block/mmcblk1: 31.9 GB, 31914983424 bytes
4 heads, 16 sectors/track, 973968 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1              33       32800     1048576   b Win95 FAT32
Partition 1 does not end on cylinder boundary
/dev/sdb2           32801      973968    30117376  83 Linux
Partition 2 does not end on cylinder boundary
  • mkfs -t vfat /dev/sdb1
  • mkfs -t ext4 /dev/sdb2

Extract phase1

  • mount /dev/sdb2 /mnt/tmp
  • mkdir /mnt/tmp/slackware
  • cd ~/ftp.arm.slackware.com/slackwarearm/slackwarearm-14.2/slackware/
  • find . -name '*.txz' | xargs -I '{}' installpkg --root /mnt/tmp/slackware '{}'

Extract phase2

  • cd /mnt/tmp/slackware
  • tar xvpif ~/ftp.arm.slackware.com/slackwarearm/slackwarearm-devtools/minirootfs/roots/slack-14.2-miniroot_01Jul16.tar.xz
  • sync;sync;sync
  • cd ~
  • umount /mnt/tmp

_ Android smart phone side

create mount point for Slackware's partition

  • Put MicroSD into SD slot in phone
  • start Terminal emulator
  • su -
  • cd /mnt/sdcard
  • mkdir chroot

Create scripts to start Slackware

  • mount /dev/block/mmcblk1p2 /mnt/sdcard/chroot
  • mkdir chroot/slackware/system
  • mkdir chroot/slackware/external_sd
  • vi slackware.sh
#! /system/bin/sh
(
        export CHROOT=/mnt/sdcard/chroot
        export ROOT=${CHROOT}/slackware
        /system/xbin/mount -t ext4 /dev/block/mmcblk1p2 ${CHROOT}
        /system/xbin/mount -t proc none ${ROOT}/proc
        /system/xbin/mount -t sysfs none ${ROOT}/sys
        /system/xbin/mount -o bind /dev ${ROOT}/dev
        /system/xbin/mount -o bind /dev/pts ${ROOT}/dev/pts
        /system/xbin/mount -o bind /dev/socket ${ROOT}/dev/socket
        /system/xbin/mount -o bind /system ${ROOT}/system
        /system/xbin/mount -o bind /mnt/sdcard/external_sd ${ROOT}/external_sd
        export HOME=/root
        export SHELL=/bin/bash
        export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/arm-slackware-linux-gnueabi/lib:${LD_LIBRARY_PATH}

        /system/xbin/chroot ${ROOT} /bin/su -c /etc/rc.d/rc.local
#       /system/xbin/chroot ${ROOT} /bin/bash -l

        for i in `lsof | egrep /mnt/sdcard/chroot/ | tr -s ' ' | cut -d ' ' -f 2 | sort | uniq`
        do
                kill $i
        done

        sync;sync;sync
        umount ${ROOT}/external_sd
        umount ${ROOT}/system
        umount ${ROOT}/dev/socket
        umount ${ROOT}/dev/pts
        umount ${ROOT}/dev
        umount ${ROOT}/sys
        umount ${ROOT}/proc
        umount ${CHROOT}
)
  • vi chroot/slackware/etc/rc.d/rc.local
#!/bin/sh
if [ -e /dev/graphics/fb0 ]
then
        (cd /dev && ln -sf graphics/fb0 .)
fi

if [ -x /sbin/ldconfig ]
then
        /sbin/ldconfig
fi

if [ -r /etc/HOSTNAME ]
then
        /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
fi

if [ -x /usr/bin/rsync ]
then
        /usr/bin/rsync --daemon -config=/etc/rsyncd.conf
fi

if [ -x /etc/rc.d/rc.sshd ]
then
        /etc/rc.d/rc.sshd start
fi

if [ -x /etc/rc.d/rc.pulseaudio ]
then
        /etc/rc.d/rc.pulseaudio start
fi

if [ -x /usr/local/canna/sbin/cannaserver ]
then
        rm -f /tmp/.iroha_unix/IROHA
        /usr/local/canna/sbin/cannaserver -inet -u bin
        echo "Starting cannaserver."
fi

if [ -x /usr/local/OpenPOBox/server/pbserver.sh ]
then
        /usr/local/OpenPOBox/server/pbserver.sh
fi

/bin/bash -l
  • vi chroot/slackware/root/.xinitrc
#!/bin/sh
DISPLAY=127.0.0.1:0.0; export DISPLAY

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then
    /usr/bin/xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    /usr/bin/xmodmap $sysmodmap
fi

if [ -f $userresources ]; then
    /usr/bin/xrdb -merge $userresources
fi

if [ -f $usermodmap ]; then
    /usr/bin/xmodmap $usermodmap
fi

# start some nice programs

/usr/bin/xkbset m
/usr/bin/xkbset exp m

/usr/bin/xterm -ls &
exec /usr/bin/twm

Start slackware

start Slackware with next commands from Terminal emulator.

  • su -
  • cd /mnt/sdcard
  • sh slackware.sh
  • sh .xinitrc

Change application to XSDL, then you will see xterm and twm running in it.

Some setting in Slackware

  • vi /etc/rsyncd.conf
uid = root
gid = root
[root_partition]
        comment = so03d root partition
        path = /
        read only = true
        hosts allow = 192.168.0.100
        hosts deny = *
  • vi /etc/ssh/sshd_config
Port 8022
  • vipw
aid_system:x:1000:1000::/:/bin/false
aid_radio:x:1001:1001::/:/bin/false
aid_bluetooth:x:1002:1002::/:/bin/false
aid_graphics:x:1003:1003::/:/bin/false
aid_input:x:1004:1004::/:/bin/false
aid_audio:x:1005:1005::/:/bin/false
aid_camera:x:1006:1006::/:/bin/false
aid_log:x:1007:1007::/:/bin/false
aid_compass:x:1008:1008::/:/bin/false
aid_mount:x:1009:1009::/:/bin/false
aid_wifi:x:1010:1010::/:/bin/false
aid_adb:x:1011:1011::/:/bin/false
aid_install:x:1012:1012::/:/bin/false
aid_media:x:1013:1013::/:/bin/false
aid_dhcp:x:1014:1014::/:/bin/false
aid_sdcard_rw:x:1015:1015::/:/bin/false
aid_media_rw:x:1023:1023::/:/bin/false
aid_shell:x:2000:2000::/:/bin/false
aid_cache:x:2001:2001::/:/bin/false
aid_diag:x:2002:2002::/:/bin/false
aid_net_bt_admin:x:3001:3001::/:/bin/false
aid_net_bt:x:3002:3002::/:/bin/false
aid_inet:x:3003:3003::/:/bin/false
aid_net_raw:x:3004:3004::/:/bin/false
aid_misc:x:9998:9998::/:/bin/false
aid_nobody:x:9999:9999::/:/bin/false
aid_app:x:10000:10000::/:/bin/false
  • vipw -g
aid_system:x:1000:root,pulse
aid_radio:x:1001:root,pulse
aid_bluetooth:x:1002:root,pulse
aid_graphics:x:1003:root,pulse
aid_input:x:1004:root,pulse
aid_audio:x:1005:root,pulse
aid_camera:x:1006:root,pulse
aid_log:x:1007:root,pulse
aid_compass:x:1008:root,pulse
aid_mount:x:1009:root,pulse
aid_wifi:x:1010:root,pulse
aid_adb:x:1011:root,pulse
aid_install:x:1012:root,pulse
aid_media:x:1013:root,pulse
aid_dhcp:x:1014:root,pulse
aid_sdcard_rw:x:1015:root,pulse
aid_media_rw:x:1023:root,pulse
aid_shell:x:2000:root,pulse
aid_cache:x:2001:root,pulse
aid_diag:x:2002:root,pulse
aid_net_bt_admin:x:3001:root,pulse
aid_net_bt:x:3002:root,pulse
aid_inet:x:3003:root,pulse
aid_net_raw:x:3004:root,pulse
aid_misc:x:9998:root,pulse
aid_nobody:x:9999:root,pulse
aid_app:x:10000:root,pulse
  • vi /etc/pulse/system.pa
load-module module-simple-protocol-tcp rate=44100 format=s16le channels=2 source=auto_null.monitor record=true port=8000
  • chmod +x /etc/rc.d/rc.pulse
  • vi /root/.Xresource
! F1 for Button1, F2 for Button2, F3 for Button3 of Rii RT-MWK02(bluetooth mini keyboard)
keycode 67 = Pointer_Button1
keycode 68 = Pointer_Button2
keycode 69 = Pointer_Button3
remove Shift = Shift_L
remove Control = Control_L
keysym Control_L = Shift_L
keysym Shift_L = Control_L
add Shift = Shift_L
add Control = Control_L

_ BUGS

Unfortunatery, binary built by gcc-4.7 or later requires __kernel_cmpxchg64 system call in kernel-3.1 or later.

So I have to say that SlackwareARM-14.2 is not suitable for Xperia SO-03D which is powerd by Android 4.0 with kernle-3.0.8.


2016年12月22日 dns transfer check by dig [長年日記]

dig +norec @ns.foo.org foo.org axfr

2016年12月09日 PHP memo [長年日記]

_ Hello.php

<?php
	echo "Hello World!";
?>

_ args(command line)

#! /usr/bin/php
#
# ./args.php aaa bbb ccc
#
<?php
        echo "$argc\n";			# 4

        for ($i = 0; $i < $argc; $i++){
                 echo $argv[$i] . "\n";	# show $argv[0] to $argv[3] and $argv[0] is "./args.php"
        }

        foreach ($argv as $arg){
                echo $arg . "\n";
        }
?>

_ args(cgi)

<?php
	if ($_SERVER["REQUEST_METHOD"] == "POST"){
 		$id = $_POST['id'];
 	}else{
 		$id = $_GET['id'];
 	}
 	print "id is " . htmlspecialchars($id) . "<br>";
?>

_ stdio

<?php
 	print "Hello";				# without CRLF
 	print "Hello\n";			# with CRLF
 	printf("%s\n","Hello");			# with CRLF
 	fprintf(STDOUT,"%s\n","Hello");		# with CRLF

 	fputs(STDOUT, "Input: ");
 	$input = fgets(STDIN);

 	print "[$input]\n";		# with CRLF
 	$output = trim($input);		# suppress top space and bottom space
 	print "[$output]\n";
 	$output = ltrim($input);	# suppress top space
 	print "[$output]\n";
 	$output = rtrim($input);	# suppress bottom space
 	print "[$output]\n";
?>

_ variable

<?php
 	$str1 = "string";
 	$str2 = "This is ${str1}\n";				# "This is string"
 	$str3 = 'This is ${str1}\n';				# 'This is ${str1}\n'
 	$str5 = substr("This is string", 5, 2);			# "is"
 	$str6 = substr("これはUTF8文字列です", 9, 12);		# "UTF8"
 	$str7 = mb_substr("これはUTF8文字列です", 3, 7, "UTF-8");	# "UTF8文字列"
?>

_ list

<?php
 	$array3 = [ "data1", "data2", "data3" ];
 	print $array3[1] . "\n";			# "data2"

 	$array4[0] = "data1";
 	$array4[2] = "data3";
 	print count($array4) . "\n";			# 2

 	$array5 = [ "data1", "data2", "data3" ];
 	foreach ($array5 as $value){
 		print $value . "\n";
 	}
?>

_ hash

<?php
 	$array1 = [ "key1" => "data1", "key2" => "data2", "key3" => "data3" ];
 	print $array1["key2"] . "\n";			# "data2"

 	$array2["key1"] = "data1";
 	$array2["key2"] = "data2";
 	$array2["key3"] = "data3";
 	print $array2["key2"] . "\n";			# "data2"

 	$array6 = [ "key1" => "data1", "key2" => "data2", "key3" => "data3" ];
 	foreach ($array6 as $key => $value){
 		print $key . " => " . $value . "\n";
 	}
?>

_ operator

<?php
 	$wk = "abc" . "def";	# "abcdef"
 	$wk = 10 + 20;		# 30
 	$wk = 10 - 20;		# -10
 	$wk = 10 * 20;		# 200
 	$wk = 10 / 20;		# 0.5
 	$wk = 10.0 / 20;	# 0.5
 	$wk = pow(3, 2);	# 9
 	$wk = 7 % 5;		# 2
?>

_ if

<?php
 	$wk1 = 10;
 	$wk2 = 20;
 	$wk3 = 30;
 	$wk4 = 40;

 	if ($wk1 == $wk2){
 		print "cond1\n";
 	}elseif ($wk1 > $wk2){
 		print "cond2\n";
 	}else{
 		print "cond3\n";	# true
 	}

 	if ($wk1 != $wk2){
 		print "cond1\n";	# true
 	}else{
 		print "cond2\n";
 	}

 	if ($wk1 < $wk2 &&
 	    $wk3 < $wk4){
 		print "cond1\n";	# true
 	}else{
 		print "cond2\n";
 	}
?>

_ while

<?php
 	while ($rec = fgets(STDIN)){
 		$rec = trim($rec);
 		print $rec . "\n";
 	}
?>

_ for, foreach

<?php
 	for ($i = 0; $i < 5; $i++){
 		print $i . "\n";
 	}

 	$list = [ "data1", "data2", "data3" ];
 	foreach ($list as $value){
 		print $value . "\n";
 	}

 	$hash = [ "kay1" => "data1", "key2" => "data2", "key3" => "data3" ];
 	foreach ($hash as $key => $value){
 		print $key . " => " . $value . "\n";
 	}
?>

_ file

<?php
	$fp = fopen("file.txt", "w");
	fputs($fp, "line 1\n");
	fputs($fp, "line 2\n");
	fputs($fp, "line 3\n");
	fclose($fp);

	$fp = fopen("file.txt", "r");
	while ($rec = fgets($fp)){
		$rec = trim($rec);
		print $rec . "\n";
	}
?>

_ regex

<?php
	if (preg_match('/^abc.*def$/', 'abcpoipoidef')){
		print "true\n";
	}

	$wk = preg_replace('/^abc(.*)def$/', 'ABC${1}DEF', 'abcpoipoidef');	# "ABCpoipoiDEF"

	$list = preg_split('/p.*i/', 'abcpoipoidef');				# [ 'abc', 'def' ]
?>

_ string

<?php
	$str = 'abcあいうdef';
	$wk_str = substr($str,1,1);				# 'b'
	$wk_str = substr($str,3,3);				# 'あ'
	$wk_str_utf8 = mb_substr($str,3,1,'UTF-8');		# 'あ'
	$wk_str_utf8 = mb_substr($str,3,3,'UTF-8');		# 'あいう'
	$wk_str = strlen($str);					# 15
	$wk_str_utf8 = mb_strlen($str,'UTF-8');			# 9
	$wk_str_utf16 = mb_convert_encoding($str,'UTF-16');	# 'abcあいうdef' in UTF-16

	$wk_str = '123';
	$wk_int = (int)$wk_str;				# 123

	$wk_str = (string)$wk_int;			# '123'

	$wk_str = '12.34';
	$wk_float = (float)$wk_str;			# 12.34

	$wk_hex = base_convert('123', 10, 16);		# 7b

	$wk = ord('A');					# 65
	$wk = chr(65);					# 'A'
?>

_ function

<?php
	function add($i1, $i2){
		return ($i1 + $i2);
	}

	wk = add(10,20);		# 30
?>

_ try

<?php
	function div($i1, $i2){
		if ($i2 == 0){
			throw new Exception("zero divided");
		}else{
			return ($i1 / $i2);
		}
	}

	try {
		div(1, 0);
	} catch (Exception $e) {
		echo '捕捉した例外: ',  $e->getMessage(), "\n";
	}
?>

_ daytime

<?php
	date_default_timezone_set('Asia/Tokyo');

	$epoch_time = time();
	$str_date_week_time = date('Y/m/d(w) H:i:s', $epoch_time);	# '2016/12/03(6) 16:57:54' <- Sat
	print $str_date_week_time . "\n";

	$epoch_time = $epoch_time + (24 * 60 * 60);
	$str_date_week_time = date('Y/m/d(w) H:i:s', $epoch_time);	# '2016/12/04(0) 16:57:54' <- Sun
	print $str_date_week_time . "\n";

	$epoch_time = mktime(1,2,3,4,5,2016);
	$str_date_week_time = date('Y/m/d(w) H:i:s', $epoch_time);	# '2016/04/05(2) 01:02:03' <- Tue
	print $str_date_week_time . "\n";
?>

_ filesystem

<?php
	error_reporting(0);
	mkdir('NewDir');
	if (file_exists('NewDir')){
		print "NewDir exists" . "\n";
		if (is_file('NewDir')){
			print "NewDir is file" . "\n";
		}
		if (is_dir('NewDir')){
			print "NewDir is dir" . "\n";
		}
	}
	rmdir('NewDir');

	$fp = fopen('file.txt', 'w');
	fputs($fp, "line1\n");
	fclose($fp);
	unlink('file.txt');

	print getcwd() . "\n";

	foreach (scandir('.') as $dir){
		print $dir . "\n";
	}
?>

_ class

<?php
	class MySwitch{
		private $intSw;
		function __construct($value = 0){
			if (func_num_args() == 0){
				$this->intSw = 0;
			}else{
				$this->intSw = $value;
			}
		}
		function turnOn(){
			$this->intSw = 1;
		}
		function turnOff(){
			$this->intSw = 0;
		}
		function isOn(){
			return ($this->intSw == 1);
		}
		function isOff(){
			return (!isOn());
		}
	}

	class MyToggleSwitch extends MySwitch{
		function __construct(){
			parent::__construct();
		}
		function toggle(){
			if (parent::isOn()){
				parent::turnOff();
			}else{
				parent::turnOn();
			}
		}
	}

	$oSw = new MySwitch();

	if ($oSw->isOn()){
		print "oSw is ON\n";
	}else{
		print "oSw is OFF\n";
	}

	$oSw->turnOn();

	if ($oSw->isOn()){
		print "oSw is ON\n";
	}else{
		print "oSw is OFF\n";
	}

	$oToggleSw = new MyToggleSwitch;

	if ($oToggleSw->isOn()){
		print "oToggleSw is ON\n";
	}else{
		print "oToggleSw is OFF\n";
	}

	$oToggleSw->toggle();

	if ($oToggleSw->isOn()){
		print "oToggleSw is ON\n";
	}else{
		print "oToggleSw is OFF\n";
	}
?>

_ sqlite

<?php
	error_reporting(0);
	$dbfile = 'sqlite.db';
	unlink($dbfile);
	$conn = new SQLite3($dbfile);

	print "テーブルを作成する\n";
	$result = $conn->exec("
		create table t_test (
			id text primary key,
			name text,
			syozoku text
		)
	");
	if (!$result){
		print "テーブル作成出来ません " . $conn->lastErrorMsg() . "\n";
	}

	print "テーブルを作成する2\n";
	$result = $conn->exec("
		create table t_test (
			id text primary key,
			name text,
			syozoku text
		)
	");
	if (!$result){
		print "テーブル作成出来ません " . $conn->lastErrorMsg() . "\n";
	}

	print "初期データセットアップ\n";
	$conn->exec("begin");

	$init_data = [ ['001', '山田 太郎', '本社'],
		       ['002', '山田 花子', '営業第1課'],
		       ['003', '山田 次郎', '営業第2課']];

	$stmt = $conn->prepare("
		insert into t_test
			(id, name, syozoku)
			values(:id, :name, :syozoku)
	");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}

	foreach ($init_data as $array){
		$stmt->reset();
		$stmt->clear();
		$stmt->bindValue(':id', $array[0] ,SQLITE3_TEXT);
		$stmt->bindValue(':name', $array[1] ,SQLITE3_TEXT);
		$stmt->bindValue(':syozoku', $array[2] ,SQLITE3_TEXT);
		$result = $stmt->execute();
		if (!$result){
			print "追加出来ません " . $conn->lastErrorMsg() . ", ";
			$stmt->reset();
			print $conn->lastErrorMsg() . "\n";
		}else{
			$result->finalize();
		}
	}

	$conn->exec("commit");

	print "初期データセットアップ2\n";
	$conn->exec("begin");

	$init_data = [ ['001', '山田 太郎', '本社'],
		       ['002', '山田 花子', '営業第1課'],
		       ['003', '山田 次郎', '営業第2課']];

	$stmt = $conn->prepare("
		insert into t_test
			(id, name, syozoku)
			values(:id, :name, :syozoku)
	");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}

	foreach ($init_data as $array){
		print $array[0] . "," . $array[1] . "," . $array[2] . "\n";
		$stmt->reset();
		$stmt->clear();
		$stmt->bindValue(':id', $array[0] ,SQLITE3_TEXT);
		$stmt->bindValue(':name', $array[1] ,SQLITE3_TEXT);
		$stmt->bindValue(':syozoku', $array[2] ,SQLITE3_TEXT);
		$result = $stmt->execute();
		if (!$result){
			print "追加出来ません " . $conn->lastErrorMsg() . ", ";
			$stmt->reset();
			print $conn->lastErrorMsg() . "\n";
		}else{
			$result->finalize();
			$stmt->reset();
		}
		$stmt->clear();
	}

	$conn->exec("commit");

	print "全件検索\n";
	$conn->exec("begin");
	$stmt = $conn->prepare("select * from t_test");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$result = $stmt->execute();
	while($array = $result->fetchArray()){
		fprintf(STDOUT,"%s,%s,%s\n",$array['id'],$array['name'],$array['syozoku']);
	}

	print "~課のみ検索\n";
	$stmt = $conn->prepare("select * from t_test where syozoku like :syozoku");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$stmt->reset();
	$stmt->clear();
	$stmt->bindValue(':syozoku', '%課' ,SQLITE3_TEXT);
	$result = $stmt->execute();
	while($array = $result->fetchArray()){
		printf("%s,%s,%s\n",$array['id'],$array['name'],$array['syozoku']);
	}

	print "id=001を山田 三郎に更新\n";
	$stmt = $conn->prepare("update t_test set name = :name where id = :id");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$stmt->reset();
	$stmt->clear();
	$stmt->bindValue(':name', '山田 三郎' ,SQLITE3_TEXT);
	$stmt->bindValue(':id', '001' ,SQLITE3_TEXT);
	$result = $stmt->execute();

	$stmt = $conn->prepare("select * from t_test where id = :id");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$stmt->reset();
	$stmt->clear();
	$stmt->bindValue(':id', '001' ,SQLITE3_TEXT);
	$result = $stmt->execute();
	while($array = $result->fetchArray()){
		printf("%s,%s,%s\n",$array['id'],$array['name'],$array['syozoku']);
	}

	$conn->exec("commit");

	print "id=002を削除\n";
	$conn->exec("begin");
	$stmt = $conn->prepare("delete from t_test where id = :id");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$stmt->reset();
	$stmt->clear();
	$stmt->bindValue(':id', '002' ,SQLITE3_TEXT);
	$result = $stmt->execute();

	$stmt = $conn->prepare("select * from t_test");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$result = $stmt->execute();
	while($array = $result->fetchArray()){
		printf("%s,%s,%s\n",$array['id'],$array['name'],$array['syozoku']);
	}

	print "ロールバック\n";
	$conn->exec("rollback");

	print "全件検索\n";
	$conn->exec("begin");
	$stmt = $conn->prepare("select * from t_test");
	if (!$stmt){
		print "ステートメントエラー " . $conn->lastErrorMsg() . "\n";
	}
	$result = $stmt->execute();
	while($array = $result->fetchArray()){
		printf("%s,%s,%s\n",$array['id'],$array['name'],$array['syozoku']);
	}

	$conn->exec("commit");

	$conn->close();
	print "終了\n";
?>

_ sqlite実行結果

テーブルを作成する
テーブルを作成する2
テーブル作成出来ません table t_test already exists
初期データセットアップ
初期データセットアップ2
001,山田 太郎,本社
追加出来ません constraint failed, column id is not unique
002,山田 花子,営業第1課
追加出来ません constraint failed, column id is not unique
003,山田 次郎,営業第2課
追加出来ません constraint failed, column id is not unique
全件検索
001,山田 太郎,本社
002,山田 花子,営業第1課
003,山田 次郎,営業第2課
~課のみ検索
002,山田 花子,営業第1課
003,山田 次郎,営業第2課
id=001を山田 三郎に更新
001,山田 三郎,本社
id=002を削除
001,山田 三郎,本社
003,山田 次郎,営業第2課
ロールバック
全件検索
001,山田 三郎,本社
002,山田 花子,営業第1課
003,山田 次郎,営業第2課
終了

2016年11月23日 Setting font for flashplayer [長年日記]

_ /etc/fonts/conf.avail/69-language-selector-ja-jp.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <!-- Japanese (ja) -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="append" binding="same">
            <string>IPA Pゴシック</string>
        </edit>
    </match>
    <!-- Japanese (ja) ends -->
</fontconfig>

_ symbolic link

# cd /etc/fonts/conf.d
# ln -s ../conf.avail/69-language-selector-ja-jp.conf